s i s t e m a o p e r a c i o n a l m a g n u x l i n u x | ~/ · documentação · suporte · sobre |
6. Putting them together: Making the diskette(s)At this point you have a kernel and a compressed root filesystem. If you are making a boot/root disk, check their sizes to make sure they will both fit on one disk. If you are making a two disk boot+root set, check the root filesystem to make sure it will fit on a single diskette. You should decide whether to use LILO to boot the bootdisk kernel. The alternative is to copy the kernel directly to the diskette and boot without LILO. The advantage of using LILO is that it enables you to supply some parameters to the kernel which may be necessary to initialize your hardware (Check the file /etc/lilo.conf on your system. If it exists and has a line like ``append=...'', you probably need this feature). The disadvantage of using LILO is that building the bootdisk is more complicated and takes slightly more space. You will have to set up a small separate filesystem, which we shall call the kernel filesystem, where you transfer the kernel and a few other files that LILO needs. If you are going to use LILO, read on; if you are going to transfer the kernel directly, skip ahead to Section 6.2. 6.1. Transferring the kernel with LILOThe first thing you must do is create a small configuration file for LILO. It should look like this:
Save this file as bdlilo.conf. You now have to create a small filesystem, which we shall call a kernel filesystem, to distinguish it from the root filesystem. First, figure out how large the filesystem should be. Take the size of your kernel in blocks (the size shown by ``ls -s KERNEL'') and add 50. Fifty blocks is approximately the space needed for inodes plus other files. You can calculate this number exactly if you want to, or just use 50. If you're creating a two-disk set, you may as well overestimate the space since the first disk is only used for the kernel anyway. Call this number KERNEL_BLOCKS. Put a floppy diskette in the drive (for simplicity we'll assume /dev/fd0) and create an ext2 kernel filesystem on it:
Next, create devices /dev/null and /dev/fd0. Instead of looking up the device numbers, you can just copy them from your hard disk using -R:
Do not worry if the file sizes are slightly different from yours. Now leave the diskette in the drive and go to Section 6.3. 6.2. Transferring the kernel without LILOIf you are not using LILO, transfer the kernel to the bootdisk with dd:
Finally, set the root device to be the diskette itself, then set the root to be loaded read/write:
6.3. Setting the ramdisk wordInside the kernel image is the ramdisk word that specifies where the root filesystem is to be found, along with other options. The word can be accessed and set via the rdev command, and its contents are interpreted as follows:
If bit 15 is set, on boot-up you will be prompted to place a new floppy diskette in the drive. This is necessary for a two-disk boot set. There are two cases, depending on whether you are building a single boot/root diskette or a double ``boot+root'' diskette set.
After carefully calculating the value for the ramdisk word, set it with rdev -r. Be sure to use the decimal value. If you used LILO, the argument to rdev here should be the mounted kernel path, e.g. /mnt/vmlinuz; if you copied the kernel with dd, instead use the floppy device name (e.g., /dev/fd0).
If you used LILO, unmount the diskette now. 6.4. Transferring the root filesystemThe last step is to transfer the root filesystem.
Congratulations, you are done!
|