Monday, January 11, 2021

Init process

 

I had to dig up information to understand how the init process was getting executed the kernel. The links below provide information of the start sequence follow by linux kernel 

* The article in the Wikipedia provides good information about it https://en.wikipedia.org/wiki/Linux_startup_process

* The article in the Wikipedia which provides the systemd information https://en.wikipedia.org/wiki/Systemd

* The initial post which details of the initiramfs getting included in the kernel  https://lwn.net/Articles/14776/ 

* The git repo containing the sysvinit code https://github.com/slicer69/sysvinit

* systemd git repo  https://github.com/systemd/systemd

* The code in the kernel which invokes the init process is present in the ./init/main.c of the kernel

static int __ref kernel_init(void *unused)
{

 ......

 ......

if (!try_to_run_init_process("/sbin/init") ||
	    !try_to_run_init_process("/etc/init") ||
	    !try_to_run_init_process("/bin/init") ||
	    !try_to_run_init_process("/bin/sh"))
		return 0;

 }