2. Design

2.1. Determining necessary utilities

Loading the kernel without manually typing parameters is easy to do if we read the grub info page. According to the section entitled "configuration" all of the commands used for booting can be put in a file called menu.lst and placed in the /boot/grub directory.

Note

Be sure to type the menu.lst filename correctly with a lowercase L after the dot and not a number one.

To automate system start-up we will need an init daemon. We know this because the Bootdisk-HOWTO and From-Powerup-To-BASH-Prompt-HOWTO both make mention of init as the first program to start after the kernel loads. The latter HOWTO also goes into some detail about the /etc/inittab file and the organization of startup scripts. This could be helpful since FHS, the blueprint we have used so far, makes no recommendation for init scripts.

We will also need to find the shutdown command to fulfill the second goal of graceful shutdown capability.

2.2. Obtaining source code

Searching the Linux Software Map on Ibiblio for the keyword "init" gives a large number of results. From reading the From-Powerup-To-BASH-Prompt-HOWTO however, we know that most Linux systems use a System V style init daemon. Narrowing the search with the additional key phrase of "System V" gives much better results. The sysvinit package contains init, shutdown, halt and reboot which is everything we need. The version listed in the LSM entry looks to be pretty old, but there is a primary-site URL that will probably lead to the latest version.

2.3. Checking dependencies

The manpage for init mentions a FIFO called /dev/initctl that is required for init to communicate with other programs in the sysvinit package. We will have to create this file for init to function properly.

2.4. Designing a simple GRUB configuration file.

Using a GRUB configuration file is slightly more complex than specifying the bootloader commands manually. There are directives for features like menus, default selections and timeouts that need to be specified in the configuration file as well as the familiar kernel loading command. The info page for GRUB gives much of the necessary information. We may also be able to use the GRUB configuration file on the development system as a template. However, there is some inconsistency between vendors as to the name and location of the file. Regardless of what the path is on the development system it should be /boot/grub/menu.lst on the Pocket Linux System.

2.5. Outlining start-up scripts

Many of the popular GNU/Linux distributions use System V style init scripts. Since we are using a "sysvinit" daemon it makes sense to use System V style scripts as well. The following documents all touch upon the System V style init scripts in some way and will serve as references when building the scripts for this project:

After glancing at one or two of the above references we should have a pretty good idea of how the System V style system initialization process works. We should also know what it takes to create System V style init scripts for the Pocket Linux project. Below is a brief list of what needs to be done:

  • Create an inittab file to call an rc script with a numerical argument giving the runlevel.

  • Write an rc script that uses the runlevel argument to execute the appropriate "K" and "S" scripts.

  • Modify the previously built local_fs script to take start and stop arguments.

  • Create new scripts for shutdown and reboot.

  • Set up /etc/rcN.d directories and links to scripts in /etc/init.d.

As always, the BASH(1) manpage and the Advanced BASH Scripting Guide are very helpful for writing and understanding shell scripts.