| Both sides previous revision Previous revision Next revision | Previous revision |
| docs:techref:process.boot [2018/02/20 21:07] – ↷ Links adapted because of a move operation bobafetthotmail | docs:techref:process.boot [2023/03/09 13:48] (current) – [Process Trinity] Drop redundant word brlin |
|---|
| ====== The Boot Process ====== | ====== The Boot Process ====== |
| | |
| | <WRAP center round alert 60%> |
| | As noted below, this page is woefully out of date |
| | </WRAP> |
| | |
| |
| | Please also see [[docs:techref:requirements.boot.process]]\\ This guide it not up-to-date! It does not mention [[docs:techref:procd]] | | | Please also see [[docs:techref:requirements.boot.process]]\\ This guide it not up-to-date! It does not mention [[docs:techref:procd]] | |
| |
| This guide shall help you understand, e.g. | This guide shall help you understand, e.g. |
| * When is it time for [[docs:user-guide:advanced:kexec]] and when for [[docs:user-guide:additional-software:extroot_configuration]] (see particularly [[docs:user-guide:additional-software:extroot_configuration:extroot.theory]])? | * When is it time for [[docs:guide-user:advanced:kexec]] and when for [[docs:guide-user:additional-software:extroot_configuration]] (see particularly [[docs:guide-user:additional-software:extroot_configuration:extroot.theory]])? |
| * How does the [[docs:user-guide:troubleshooting:failsafe_and_factory_reset|OpenWrt FailSafe]] work? | * How does the [[docs:guide-user:troubleshooting:failsafe_and_factory_reset|OpenWrt FailSafe]] work? |
| * the [[docs:techref:flash.layout]] and the combination of [[docs:techref:filesystems#implementation.in.openwrt|Utilization of file systems in OpenWrt]] | * the [[docs:techref:flash.layout]] and the combination of [[docs:techref:filesystems#implementation_in_openwrt|Utilization of file systems in OpenWrt]] |
| * When does the tmpfs get mounted and ''/tmp'' symlinked to it and ''/var'' symlinked to ''/tmp''? | * When does the tmpfs get mounted and ''/tmp'' symlinked to it and ''/var'' symlinked to ''/tmp''? |
| |
| |
| ===== Process Trinity ===== | ===== Process Trinity ===== |
| The Machine gets powered on and some very very basic very low level hardware stuff gets done. You could connect to it over the [[docs:hardware:port.jtag|JTAG Port]] port and issue commands. | The Machine gets powered on and some very very basic very low level hardware stuff gets done. You could connect to it over the [[docs:techref:hardware:port.jtag|JTAG Port]] and issue commands. |
| |
| ==== Bootloader ==== | ==== Bootloader ==== |
| - the bootloader performs the [[wp>Power-on self-test|POST]], which is a low-level hardware initialization | - the bootloader performs the [[wp>Power-on self-test|POST]], which is a low-level hardware initialization |
| - the bootloader decompresses the Kernel image from its (known!) location on the flash storage into main memory (=RAM) | - the bootloader decompresses the Kernel image from its (known!) location on the flash storage into main memory (=RAM) |
| - the bootloader executes the Kernel with ''init=...'' option (default is ''[[docs:user-guide:base-system:notuci.config#etcpreinit|/etc/preinit]]'') | - the bootloader executes the Kernel with ''init=...'' option (default is <del>''[[docs:guide-user:base-system:notuci.config#etcpreinit|/etc/preinit]]''</del> ''/sbin/init'') |
| |
| ==== Kernel ==== | ==== Kernel ==== |
| - the Kernel further bootstraps itself (sic!) | - the Kernel further bootstraps itself (sic!) |
| - issues the command/op-code ''start_kernel'' | - issues the command/op-code ''start_kernel'' |
| - kernel scans the mtd partition //rootfs// for a valid superblock and mounts the SquashFS partition (which contains ''/etc'') once found. (More info at [[docs:techref:filesystems#technical.details]]) | - kernel scans the mtd partition //rootfs// for a valid superblock and mounts the SquashFS partition (which contains ''/etc'') once found. (More info at [[docs:techref:filesystems#technical_details]]) |
| - ''[[docs:user-guide:base-system:notuci.config#etcpreinit|/etc/preinit]]'' does pre-initialization setups (create directories, mount fs, /proc, /sys, ... ) | - ''[[docs:guide-user:base-system:notuci.config#etcpreinit|/etc/preinit]]'' does pre-initialization setups (create directories, mount fs, /proc, /sys, ... ) |
| - the Kernel ''mounts'' any other partition (e.g. jffs2 partition) under //rootfs (root file system)//. see [[docs:techref:flash.layout]], [[docs:techref:preinit_mount#mount.root.filesystem|preinit and root mount]], and also [[wp>udev]] FIXME **make sure** | - the Kernel ''mounts'' any other partition (e.g. jffs2 partition) under //rootfs (root file system)//. see [[docs:techref:flash.layout]], [[docs:techref:preinit_mount#mount.root.filesystem|preinit and root mount]], and also [[wp>udev]] FIXME **make sure** |
| - if "INITRAMFS" is not defined, calls ''/sbin/init'' (the mother of all processes) | - if "INITRAMFS" is not defined, calls ''/sbin/init'' (the mother of all processes) |
| ==== Init ==== | ==== Init ==== |
| The user space starts when kernel mounts //rootfs// and the very first program to run is (by default) ''/sbin/init''. Please remember, that the interface between application and kernel is the ''[[docs:guide-developer:links.software.libraries#c.standard.library|clib]]'' and the syscalls it offers. | The user space starts when kernel mounts //rootfs// and the very first program to run is (by default) ''/sbin/init''. Please remember, that the interface between application and kernel is the ''[[docs:guide-developer:links.software.libraries#c.standard.library|clib]]'' and the syscalls it offers. |
| - init reads ''[[docs:user-guide:base-system:notuci.config#etcinittab|/etc/inittab]]'' for the "sysinit" entry (default is "::sysinit:/etc/init.d/rcS S boot") | - init reads ''[[docs:guide-user:base-system:notuci.config#etcinittab|/etc/inittab]]'' for the "sysinit" entry (default is "::sysinit:/etc/init.d/rcS S boot") |
| - init calls ''[[docs:user-guide:base-system:notuci.config#etcinit.drcs|/etc/init.d/rcS]] S boot'' | - init calls ''[[docs:guide-user:base-system:notuci.config#etcinit.drcs|/etc/init.d/rcS]] S boot'' |
| - ''rcS'' executes the symlinks to the actual startup scripts located in ''/etc/rc.d/S##xxxxxx'' with option ''"start"'': | - ''rcS'' executes the symlinks to the actual startup scripts located in ''/etc/rc.d/S##xxxxxx'' with option ''"start"'': |
| - after rcS finishes, system should be up and running | - after rcS finishes, system should be up and running |
| |
| === Vanilla Startup Scripts === | === Vanilla Startup Scripts === |
| **//NOTE://** [[Packages:]] you install with ''[[docs:user-guide:additional-software:opkg]]'' will likely add additional scripts! | **//NOTE://** [[Packages:]] you install with ''[[docs:guide-user:additional-software:opkg]]'' will likely add additional scripts! |
| |
| | S05defconfig | create config files with default values for platform (if config file is not exist), really does this on first start after OpenWRT installed (copy unexisted files from /etc/defconfig/$board/ to /etc/config/) | | | S05defconfig | create config files with default values for platform (if config file is not exist), really does this on first start after OpenWrt installed (copy unexisted files from /etc/defconfig/$board/ to /etc/config/) | |
| | S10boot | starts hotplug-script, mounts filesystesm, starts .., starts syslogd, ... | | | S10boot | starts hotplug-script, mounts filesystesm, starts .., starts syslogd, ... | |
| | S39usb | ''mount -t usbfs none /proc/bus/usb'' | | | S39usb | ''mount -t usbfs none /proc/bus/usb'' | |
| | S40network | start a network subsystem (run /sbin/netifd, up interfaces and wifi | | | S40network | start a network subsystem (run /sbin/netifd, up interfaces and wifi | |
| | S45firewall | create and implement firewall rules from /etc/config/firewall | | | S45firewall | create and implement firewall rules from /etc/config/firewall | |
| | S50cron | starts ''crond'', see -> ''[[docs:user-guide:base-system:notuci.config#etccrontabsroot|/etc/crontabs/root]]'' for configuration | | | S50cron | starts ''crond'', see -> ''[[docs:guide-user:base-system:notuci.config#etccrontabsroot|/etc/crontabs/root]]'' for configuration | |
| | S50dropbear | starts ''dropbear'', see -> ''[[docs:user-guide:base-system:dropbear|/etc/config/dropbear]]'' for configuration | | | S50dropbear | starts ''dropbear'', see -> ''[[docs:guide-user:base-system:dropbear|/etc/config/dropbear]]'' for configuration | |
| | S50telnet | checks for root password, if non is set, ''/usr/sbin/telnetd'' gets started | | | S50telnet | checks for root password, if non is set, ''/usr/sbin/telnetd'' gets started | |
| | S60dnsmasq | starts ''dnsmasq'', see -> ''[[docs:user-guide:base-system:dhcp|/etc/config/dhcp]]'' for configuration | | | S60dnsmasq | starts ''dnsmasq'', see -> ''[[docs:guide-user:base-system:dhcp|/etc/config/dhcp]]'' for configuration | |
| | S95done | executes ''[[docs:user-guide:base-system:notuci.config#etcrc.local|/etc/rc.local]]'' | | | S95done | executes ''[[docs:guide-user:base-system:notuci.config#etcrc.local|/etc/rc.local]]'' | |
| | S96led | load a LED configuration from /etc/config/system and set up LEDs (write values to /sys/class/leds/*/*) | | | S96led | load a LED configuration from /etc/config/system and set up LEDs (write values to /sys/class/leds/*/*) | |
| | S97watchdog | start the watchdog daemon (/sbin/watchdog) | | | S97watchdog | start the watchdog daemon (/sbin/watchdog) | |
| | S99sysctl | interprets ''[[docs:user-guide:base-system:notuci.config#etcsysctl.conf|/etc/sysctl.conf]]'' | | | S99sysctl | interprets ''[[docs:guide-user:base-system:notuci.config#etcsysctl.conf|/etc/sysctl.conf]]'' | |
| |
| |
| ===== Notes ===== | ===== Notes ===== |
| * See also [[wp>Booting]] on the boot process in general. | * See also [[wp>Booting]] on the boot process in general. |
| * [[docs:user-guide:troubleshooting:log.essentials]] busybox-klogd and busybox-syslogd | * [[docs:guide-user:base-system:log.essentials]] busybox-klogd and busybox-syslogd |
| * watchdog: [[http://www.google.com/search?sclient=psy&hl=en&source=hp&q=openwrt+watchdog&btnG=Search]] | * watchdog: [[http://www.google.com/search?sclient=psy&hl=en&source=hp&q=openwrt+watchdog&btnG=Search]] |
| * ''pppd'' is configured only in [[doc:uci:network]], need this for you [[docs:user-guide:network:internet.connection]] | * ''pppd'' is configured only in [[doc:uci:network]], need this for you [[docs:guide-user:network:wan:internet.connection]] |
| * see [[wp>init]], [[http://linux.die.net/man/8/init|init manpage]], [[http://linux.die.net/sag/init-intro.html]] | * see [[wp>init]], [[http://linux.die.net/man/8/init|init manpage]], [[http://linux.die.net/sag/init-intro.html]] |