2010年4月25日 星期日

puppy boot process

I'm not quite sure what you're asking. Here is a brief summary of which files Puppy runs when it boots. I apologize if it's a little unclear. I haven't had a full night's sleep in several days and it's finally starting to catch up with me.



In a full-install of Puppy, the overall process goes something like this:

The BIOS launches the boot manager.
The boot manager launches the kernel.
The kernel launches /sbin/init.
/sbin/init launches /etc/rc.d/rc.sysinit.
/etc/rc.d/rc.sysinit runs several other rc.* scripts. It also runs every executable file in /etc/init.d and passes them the "start" parameter. When it finishes, it runs /etc/rc.d/rc.local.

After this, the system is booted. At this point in most distros you would be presented with a login prompt.

In Puppy, you are instead automatically logged in.

As you are logged in the /etc/profile script runs. It will include any files that match /etc/profile.d/*.sh. It also includes /etc/profile.local. Then, if X is not already running it will start X with xwin. (Unless you boot with the pfix=nox option, in which case it won't start X for you.)

When X starts, ~/.xinitrc runs, which in turn launches any executable file in ~/Startup/. When .xinitrc finishes, it launches the windowmanager.

If you shut down (or reboot) the computer from the menu, the wmpoweroff (or wmreboot) script will write a string into a file, and then kill X. This passes control back to the xwin script, which never actually finished running after X was launched (it was sitting there suspended, waiting for X to complete). It reads the file written by wmpoweroff to determine whether to poweroff the machine, reboot the machine, restart X, or just dump you out to the commandline. If poweroff or reboot, it runs the respective command.

When poweroff or reboot is run, the /etc/shutdown script is run. This script will also run any executable files in /etc/init.d/, but it will give them the "stop" option rather than "start".



In the other methods of running Puppy, the bootloader still starts the kernel, but it also tells the kernel to look in the initrd.gz file first rather than the harddrives. So the kernel will run the /sbin/init script that is inside initrd.gz rather than the binary init program that is on the harddrive. The init script mounts all the partitions and filesystem-images that Puppy needs, and puts them into the UnionFS tree. Then it does a "switch_root" into the new filesystem, which had been mounted at /pup_new in the initrd.gz's filesystem. This causes / to now refer to the things inside /pup_new/ rather than the original /.

After that, it launches the /sbin/init program in this new filesystem tree and everything continues along the same lines as a full install's boot.

沒有留言:

張貼留言