First userspace executalbe run at boot up
Hi all, I'm actually reading the init/main.c source code to understand which is the first user space program the Linux kernel runs. As far as I understood it: 1. tries to execute the file defined by the rdinit= kernel parameter and sets it to "/init" if the parameter is not given 2. tries to execute the file defined by the init= kernel parameter 3. /sbin/init 4. /etc/init 5. /bin/init 6. /bin/sh 7. No init found - error All of them try to execute init by invoking run_init_process. So my question is, why does the rdinit= parameter exist, I suppose for reasons of compatibility with older kernel versions. But why it is set to "/init"? Searching in the web, I found information saying that the first file, the Linux kernel executes after boot is "/sbin/init". As far as I understand that's not correct. Cheers, Matthias -- motzblog.wordpress.com
On Tue, 27 Aug 2013 11:00:00 +0200, Matthias Brugger said:
All of them try to execute init by invoking run_init_process. So my question is, why does the rdinit= parameter exist, I suppose for reasons of compatibility with older kernel versions. But why it is set to "/init"?
Consider the case where you have an initrd that contains an "init" program that launches your system - but you also have a "busybox" program for rescue purposes. If things get hosed, you can 'rdinit=/busybox' to get into rescue mode.
Searching in the web, I found information saying that the first file, the Linux kernel executes after boot is "/sbin/init". As far as I understand that's not correct.
It's semi-correct, in that /sbin/init is traditionally what gets launched after the initrd/initramfs has done its magic. Also, research the case where there is neither an initrd or initramfs provided.
participants (2)
-
Matthias Brugger -
Valdis.Kletnieks@vt.edu