

No matter which version of Linux you choose, you can always find a patch called 921-use_preinit_as_init.patch which injects the OpenWRT init process at the first place of init processes list. From such patches, which are generic patches for certain Linux kernel version and shared amount all the routers, are located in openwrt/target/linux/generic/patches-/. OpenWRT has many patches for different kinds of hardwares and unique applications which do not exist in the mainline kernel. Therefore this article will start analysis of this speciall init process. Additionally this init process is also the first part of preinit of OpenWRT. In OpenWRT system this init process is not a normal process of Linux but a shell scripts desinaged for OpenWRT. OpenWRT system starts actually from step 4. The debug_level will also be handed over to the new procd instance if it was set via command line or during preinit. Instead it is handed over to the new procd process. The watchdog file descriptor is not closed. This will replace init as pid1 with an instance of procd running as the new pid 1. Once preinit is complete the init process is done and will do an exec on the real procd. This process has the job of early system init. The root filesystem (via root=, rootfstype= etc parameters in the kernel cmdline) will be mounted Īt last kernel will start init process (PID 1) īefore the real procd runs, a small init process is started. The Linux kernel will init hardwares for everything built ‘static’ in the kernel It configures low level hardwares, loads Linux kernel imag and device tree blob, finally jumps to Linux kernel image in the RAM with a kernel cmdline The whole system boot process is firstly shown in a nutshell: VFS: Mounted root (ext4 filesystem) readonly on device 179:1. But I believe that it won’t affect the understanding. You may find difference amound different OpenWRT version and LEDE. In this article I will try to summary and analyze the boot sequnece of OpenWRT system in details.
