After kernel mount the root file system, the first program to run is the LINUXRC under the root directory, which is actually a link to/bin/busybox, which means that the first program to run after the system is busybox itself.
BusyBox first resolves the/etc/inittab configuration file, which reads as follows:
# Boot-time System configuration/initialization script.
:: Sysinit:/etc/init.d/rcs (RcS is a script that initializes the configuration and is executed first) # Example of how to put
a Getty on a serial line (for a terminal)
:: Respawn:/sbin/getty-l ttyS000 115200 VT100- n root-i "Auto login as Root ..." (setting console properties) # Stuff to does when
restarting the init process
:: restart:/sbin/in It
# Stuff to do before rebooting
:: Ctrlaltdel:/sbin/reboot
:: Shutdown:/bin/umount-a-R
:: Shutdown :/sbin/swapoff-a
When you enter the console command line, the/etc/profile file is executed automatically, with the following contents:
Set environment variables (such as PATH, Ld_library_path),
Set Umask 0222 (the default permission for the created file is 644),
Set the color of the note and print "Welcom to Linux"
In short, execute/etc/inittab first, then call/etc/init.d/rcs, and finally execute/etc/profile