Tuesday 5 July 2011

How To Create A linux Boot CD


The kernel in Fedora Core 2 and higher is too big to fit on a floppy disk, so you'll have to create a boot CD instead. Here are the steps.
1. Each installed kernel has a dedicated subdirectory for its modules in the /lib/modules directory. Get a listing of this directory. Here there are two installed kernels; versions 2.6.5-1.358custom and 2.6.8-1.521.
[root@bigboy tmp]# ls /lib/modules/
2.6.5-1.358custom  2.6.8-1.521
[root@bigboy tmp]#
2. Select the desired kernel and use the mkbootdisk command to create a CD ISO image named /tmp/boot.iso of one of the kernels, in this case 2.6.8-1.521:
[root@bigboy tmp]# mkbootdisk --iso --device /tmp/boot.iso \
                     2.6.8-1.521
3. Burn a CD using the image. This creates a boot CD with the specified kernel, named vmlinuz, and a scaled-down version of the grub.conf configuration file named isolinux.cfg, both located in the isolinux subdirectory of the CD. This example mounts the newly created CD-ROM and takes a look at the isolinux.cfg file to confirm that everything is okay.
[root@bigboy tmp]# mount /mnt/cdrom
[root@bigboy tmp]# ls /mnt/cdrom/isolinux/
boot.cat  boot.msg  initrd.img  isolinux.bin  isolinux.cfg   TRANS.TBL  vmlinuz
[root@bigboy tmp]# cat /mnt/cdrom/isolinux/isolinux.cfg
default linux
prompt 1
display boot.msg
timeout 100
label linux
        kernel vmlinuz
        append initrd=initrd.img ro  root=/dev/hda2
[root@bigboy tmp]#
When you reboot your system with the CD, the boot process automatically attempts to access your files in the /root partition and boot normally. The only difference being that the kernel used is on the CD.

Updating The Kernel Using RPMs

It is also possible to install a new standardized kernel from an RPM file. As you can see, it is much simpler than creating a customized one.
To create an additional kernel using RPMs, use the command
[root@bigboy tmp]# rpm -ivh kernel-file.rpm
To replace an existing kernel using RPMs, you need only one line
[root@bigboy tmp]# rpm -Uvh kernel-file.rpm

Conclusion

Building a customized Linux kernel is probably something that most systems administrators won't do themselves. The risk of having a kernel that may fail in some unpredictable way is higher when you modify it, and, therefore, many system administrators hire experts to do the work for them. After reading this chapter, at least you will have an idea of what is going on when the expert arrives, which can help considerably when things don't go according to plan.

No comments: