"The first program to run under Slackware besides the Linux kernel is init(8)."

I haven't been able to find what calls this program. Is this called from /boot/vmlinuz?

In the man pages for init it says:

"Init is the parent of all processes."

So, I assume that vmlinuz is the first thing that happens after boot up, or as a part of boot up. And then init is called from there and the system setup branches out from that point. Or is init called from some other program that /boot/vmlinuz launches?

Thanks...

itsjustme

05-18-2003 01:34 PM

Uh.. Actually, I can't find 'init' either. I did find several 'init.c' files in /usr/src/linux-2.4.20/arch'. So, I am assuming (again) that vmlinuz (the actual kernel ??) calls, or runs, the 'init.c' in

'/usr/src/linux-2.4.20/arch/i386/mm'

on this Pentium III machine.

Thanks for any comments/input as I get into this 'guts' level investigation of linux.

Hmmmm... Now I don't know. I searched through init.c for the string 'inittab' and didn't get a hit. And, I read:

"The first program to run under Slackware besides the Linux kernel is init(8). This program reads the /etc/inittab(5) file to see how to run the system."

I just overlooked that tiny /sbin/init. (my eyeballs didn't do their customary carriage return/line feed!! :rolleyes: ) The others are init directories.

So, anyway, I see it's a complicated process. Is my assumption correct that /sbin/init is called from /boot/vmlinuz ?

And, then, does the /sbin/init use the init.c in /usr/src/linux-2.4.20/arch/i386/mm ? I can't view init since it is a binary file, so I don't know what's in it.

Thanks for your patience and for bearing with me while I try to get a grasp of the initialization process.

MasterC

05-18-2003 02:13 PM

I doubt that /sbin/init calls anything from /usr/src since on many distros (and even on slack) this directory is/can be empty. You don't have to have your kernel source available for booting up.

As for my guess on what it calls (since I have no real idea):
/sbin/init
calls
/etc/inittab
which in turns calls it's respective runlevel defined there with the default entry;
which then calls the appropriate /etc/rc.d scripts to get the system rolling.

This is of course after the kernel (/vmlinuz or /boot/vmlinuz depending on which release you are running) has done it's thing (everything before the runlevel).

Cool

itsjustme

05-18-2003 02:22 PM

Quote:

Originally posted by MasterC As for my guess on what it calls (since I have no real idea):
/sbin/init
calls
/etc/inittab
which in turns calls it's respective runlevel defined there with the default entry;
which then calls the appropriate /etc/rc.d scripts to get the system rolling.
Cool

I got this from the info I was reading, but the initial question (which is not answered in the info I was reading) remains about my assumption.

"Is my assumption correct that /sbin/init is called from /boot/vmlinuz ?"

AH!!! I found it. I was just looking in the slackware documentation. I almost forgot I had this "Running Linux" book. (another d'oh!)

Anyway, it says quite clearly, " Once the device drivers are initialized, the kernel executes the program init , which is found in /etc, /bin, or /sbin (it's /sbin/init on most systems). init is a general-purpose program that spawns new processes.... etc."

So, RTFM applies! I was just shying away from "Running Linux" because my initial foray into it scrambled my brains as a rank newbie.
I guess I am starting to pass out of that phase. :)

regards...

Edit: This is in the boot prompt howto:
"Any remaining arguments that were not picked up by the kernel and were not interpreted as environment variables are then passed onto process one, which is usually the init program."
This, of course, pushed the question "where is process one called from?' onto the WTF stack. ;) The statement didn't actaully say init was called from the kernel. It made it appear that the call to process one was after the kernel. Anyway, moot point now.

itsjustme

05-18-2003 03:02 PM

AH!! some more.

That power up to bash prompt howto has some good info on init also.

Thanks...!

edit: from that howto:
"Once the kernel is loaded, the first thing it does is look for an init program to run."

and looked up init in there. Of course, it says the last thing the kernel does involves the /sbin/init file.

Quote:

After the kernel has been unpacked into memory, it begins to execute, initializing hardware. The last thing it does is mount the root file system, which necessarily contains a program /sbin/init, which the kernel executes. init is one of the only programs the kernel ever executes explicitly; the onus is then on init to bring the UNIX system up. init always has the process ID 1.

So, last thing, first thing, who's counting? :rolleyes:

I'm gonna understand this before I move on to runlevels!! ;)

MasterC

05-18-2003 04:14 PM

I think it's confusing the 2 terms:
Once the kernel is loaded the first thing it executes is init VS
The very last thing the kernel does during loading is execute init