2.2.3. Root Disk
For the root disk we will need a floppy that has been prepared with a filesystem. We will also need a BASH
shell that is statically−linked so we can avoid the additional complexities of shared libraries. The configure
program in the BASH source code recognizes the −−enable−static−link option for this feature. We
will also be using the −−enable−minimal−config option to keep the BASH binary down to a
manageable size. Additional requirements for the root disk are a /dev directory and a device file for the
console. The console device is required for BASH to be able to communicate with the keyboard and video
display.
2.2.4. CPU Compatibility
There is one other, less obvious requirement to keep in mind and that is CPU compatibility. Each generation
of CPU features a more complex architecture than its predecessor. Late generation chips have additional
registers and instructions when compared to an older 486 or 386. So a kernel optimized for a new, fast 6x86
machine will not run on an older box. (See the README file in the Linux kernel source code for details.) A
BASH shell built for a 6x86 will probably not run on an older processor either. To avoid this problem, we can
choose the 386 as a lowest common denominator CPU and build all the code for that architecture.
2.3. Construction
In this section, we will be building the actual boot disk and root disk floppies. Lines preceded by bash#
indicate a shell command and lines starting with grub> indicate a command typed within the grub shell.
2.3.1. Prepare the boot disk media
Insert a blank diskette labeled "boot disk".
It may be necessary to erase the "blank" diskette if it comes factory pre−formatted for another,
non−Linux operating system. This can be done using the command dd if=/dev/zero of=/dev/fd0 bs=1k
count=1440
bash# mke2fs −m0 /dev/fd0
bash# mount /dev/fd0 /mnt
2.3.2. Build the GRUB bootloader
Get the GRUB source code from ftp://alpha.gnu.org/gnu/grub/ and unpack it into the /usr/src directory.
Configure and build the GRUB source code for an i386 processor by using the following commands:
bash# cd /usr/src/grub−0.95
bash# export CC="gcc −mcpu=i386"
bash# ./configure −−host=i386−pc−linux−gnu −−without−curses
bash# make
Pocket Linux Guide
Chapter 2. A Simple Prototype 7