Difference between revisions of "Bering-uClibc 4.x - User Guide - Appendices - Overview of the Startup Sequence"

From bering-uClibc
Jump to: navigation, search
(Created skeleton)
 
(Populated the /init Section)
Line 15: Line 15:
 
* inittab (especially for serial consoles)
 
* inittab (especially for serial consoles)
 
* /etc/rc?.d/*
 
* /etc/rc?.d/*
 +
 +
 +
==<code class="filename">/init</code>==
 +
Shell script <code class="filename">/init</code> (actually a symbolic link to <code class="filename">/var/lib/lrpkg/root.linuxrc</code>) is a critical file with a huge influence on the startup of a [[Bering-uClibc 4.x]] machine.
 +
 +
In summary, this script:
 +
# Creates the <code class="filename">/proc/</code> directory and mounts the "<tt>proc</tt>" filesystem at that location.
 +
# Creates the <code class="filename">/sys/</code> directory and mounts the "<tt>sysfs</tt>" filesystem at that location.
 +
# Creates the symbolic links for all of the commands provided by the "busybox" executable.
 +
# Loads all of the kernel Modules listed in file <code class="filename">/boot/etc/modules/</code>
 +
#* Currently just <tt>isofs</tt> and <tt>vfat</tt>.
 +
#* The modules are loaded using "modprobe" so any pre-requisite modules are loaded too, provided they are present in directory <code class="filename">/boot/lib/modules/</code>.
 +
# Loads any modules specified in a comma-separated list against kernel command-line argument "<tt>MODULES</tt>".
 +
#* For example, if the kernel command line includes "<tt>MODULES=e100,natsemi</tt>" then modules <tt>mii</tt> and <tt>e100</tt> will be loaded, provided they are present in directory <code class="filename">/boot/lib/modules/</code>.
 +
#* Again, the kernel Modules are loaded using "modprobe" so any pre-requisite modules are loaded too.
 +
# Loads any kernel Modules which are available in directory <code class="filename">/boot/lib/modules/</code> and which implement device drivers for installed hardware.
 +
#* This is done by looking for files called <code class="filename">modalias</code> within the directory structure under <code class="filename">/sys/devices/</code>, examining the contents of those files and checking for a match in file <code class="filename">/lib/modules/`uname -r`/modules.alias</code>. Any kernel Modules which match are loaded.
 +
#* File <code class="filename">/lib/modules/`uname -r`/modules.alias</code> is generated by the "depmod" command.
 +
# Mounts the disk device specified by kernel command-line argument "<tt>LEAFCFG</tt>".
 +
# "Sources" file <code class="filename">leaf.cfg</code> in the current shell, to set variables required by later processing.
 +
# Creates a standard set of empty directories
 +
#* For example <code class="filename">/mnt/</code>, <code class="filename">/var/run/</code>.
 +
# Mounts the disk device specified by variable "<tt>PKGPATH</tt>".
 +
#* This variable is specified in <code class="filename">leaf.cfg</code>.
 +
# Loads all of the Packages listed against variable "<tt>LRP</tt>", provided the corresponding <code class="filename">.lrp</code> file can be located in "<tt>PKGPATH</tt>".
 +
#* This variable is specified in <code class="filename">leaf.cfg</code>.
 +
# Unmounts the devices for "<tt>LEAFCFG</tt>" and "<tt>PKGPATH</tt>".
 +
# Mounts the "future" root filesystem (type "<tt>tmpfs</tt>") in a dummy directory.
 +
# Mounts separate "<tt>tmpfs</tt>" file systems under directories <code class="filename">/tmp/</code> and <code class="filename">/var/log/</code>.
 +
# Recursively copies the files and directories created earlier (e.g. by loading the Packages) across to the "future" root directory.
 +
# Uses the "switch_root" utility to start using the "future" root directory in place of the original (initrd) one.
  
  

Revision as of 19:50, 24 February 2011

Appendices - Overview of the Startup Sequence
Prev Bering-uClibc 4.x - User Guide Next


TODO Expand this skeleton. Mention:

  • [SYS|ISO|PXE]LINUX and the relevant configuration file
  • Linux kernel, kernel arguments and initrd
  • Bering-uClibc LINUXRC (/init), LEAFCFG, PKGPATH
  • inittab (especially for serial consoles)
  • /etc/rc?.d/*


/init

Shell script /init (actually a symbolic link to /var/lib/lrpkg/root.linuxrc) is a critical file with a huge influence on the startup of a Bering-uClibc 4.x machine.

In summary, this script:

  1. Creates the /proc/ directory and mounts the "proc" filesystem at that location.
  2. Creates the /sys/ directory and mounts the "sysfs" filesystem at that location.
  3. Creates the symbolic links for all of the commands provided by the "busybox" executable.
  4. Loads all of the kernel Modules listed in file /boot/etc/modules/
    • Currently just isofs and vfat.
    • The modules are loaded using "modprobe" so any pre-requisite modules are loaded too, provided they are present in directory /boot/lib/modules/.
  5. Loads any modules specified in a comma-separated list against kernel command-line argument "MODULES".
    • For example, if the kernel command line includes "MODULES=e100,natsemi" then modules mii and e100 will be loaded, provided they are present in directory /boot/lib/modules/.
    • Again, the kernel Modules are loaded using "modprobe" so any pre-requisite modules are loaded too.
  6. Loads any kernel Modules which are available in directory /boot/lib/modules/ and which implement device drivers for installed hardware.
    • This is done by looking for files called modalias within the directory structure under /sys/devices/, examining the contents of those files and checking for a match in file /lib/modules/`uname -r`/modules.alias. Any kernel Modules which match are loaded.
    • File /lib/modules/`uname -r`/modules.alias is generated by the "depmod" command.
  7. Mounts the disk device specified by kernel command-line argument "LEAFCFG".
  8. "Sources" file leaf.cfg in the current shell, to set variables required by later processing.
  9. Creates a standard set of empty directories
    • For example /mnt/, /var/run/.
  10. Mounts the disk device specified by variable "PKGPATH".
    • This variable is specified in leaf.cfg.
  11. Loads all of the Packages listed against variable "LRP", provided the corresponding .lrp file can be located in "PKGPATH".
    • This variable is specified in leaf.cfg.
  12. Unmounts the devices for "LEAFCFG" and "PKGPATH".
  13. Mounts the "future" root filesystem (type "tmpfs") in a dummy directory.
  14. Mounts separate "tmpfs" file systems under directories /tmp/ and /var/log/.
  15. Recursively copies the files and directories created earlier (e.g. by loading the Packages) across to the "future" root directory.
  16. Uses the "switch_root" utility to start using the "future" root directory in place of the original (initrd) one.



Prev Up Next