RedHat 9 customized install media howto

One of the main reasons for customizing install media is to provide a kickstart configuration file. Another is the need for updated network drivers for networked installations.

This is how I modified the RedHat 9 install floppy images to include a ks.cfg on the boot floppy as well as a new network driver on the network driver floppy. I then show how to use these as a basis for making a bootable USB memory device for those laptops that don't come with a floppy drive.

The boot floppy

Let's start by looking at the boot floppy image found in the images directory of your RedHat CD.
Copy the image to somewhere convenient, and mount it like this
mkdir /tmp/bootdisk
mount bootdisk.img /tmp/bootdisk -t vfat -o loop,blocksize=1024
Alternatively, write the image to a floppy and mount it the usual way.

Once you have created your kickstart configuration file, save it on the floppy or the mounted image. Conventionally, call it ks.cfg. You may want different files, so feel free to use other file names. If you called your file ks.cfg, all you have to do now is to unmount and boot from the floppy. When you get the splash screen, type something like linux ks=floppy and your kickstart file should be found.

To make kickstart install the default, edit the syslinux.cfg file on the floppy. I changed the first line from default linux to default kickstart and added the following lines
label kickstart
  kernel vmlinuz
  append ks=floppy initrd=initrd.img
If you want to use a kickstart file that isn't called ks.cfg, specify the full name of the file like this: ks=floppy:/ks-server.cfg

If you did these modifications on a floppy insted of a loop mount you may want to make a new image of the modified floppy using dd so you can create new floppies.

The network floppy

Now... those workstations with unsupported network cards...
First, we have to get binaries compiled for the kernel on the boot floppy. For RH9 this is the 2.4.20-8BOOT kernel. I needed 2 drivers, nvnet.o for nvidia chipsets and bcm5700.o for some laptops. The bcm5700 driver comes with a pre-made image for a rh9 network floppy, but I didn't find anything similar for nvnet.o. I had to compile it myself. To do that, install kernel-BOOT-2.4.20-8 and kernel-source-2.4.20-8. Reboot from 2.4.20-8BOOT. Make sure you have everything you need for compiling locally, as NFS won't work. I guess it's possible to get NFS working since you can use NFS for network installs, but mount tells me nfs is an unknown file system type. Now, edit /boot/kernel.h. This has to be done every time you reboot, as these entries will disappear... At the end of the file I had
#ifndef __BOOT_KERNEL_UP
#define __BOOT_KERNEL_UP 1
I changed that to
#ifndef __BOOT_KERNEL_UP
#define __BOOT_KERNEL_UP 0
#define __BOOT_KERNEL_BOOT 1
Compile those drivers and reboot from your normal kernel again.

Now, either mount that drvnet.img image using
mkdir /tmp/drvnet
mount drvnet.img /tmp/drvnet -o loop
or write the image to floppy and mount it.
You will find a file called modinfo. Let's start by adding our drivers there.
This file is sorted alphabetically by driver name. find the appropriate places, and add something like this:
"BCM5700 NetXtreme Gigabit Ethernet Driver"
"nvidia 10/100 megabit"
If you want to enable autodetection of these cards you will also have to find the correct info for the pcitable file. I added the following lines:
0x14e4  0x1644  "bcm5700"       "Broadcom NetXtreme BCM5700 Gigabit Ethernet"
0x14e4 0x1645 "bcm5700" "Broadcom NetXtreme BCM5701 Gigabit Ethernet"
0x14e4 0x1646 "bcm5700" "Broadcom NetXtreme BCM5702 Gigabit Ethernet"
0x14e4 0x16a6 "bcm5700" "Broadcom NetXtreme BCM5702 Gigabit Ethernet"
0x14e4 0x16c6 "bcm5700" "Broadcom NetXtreme BCM5702 Gigabit Ethernet"
0x14e4 0x1647 "bcm5700" "Broadcom NetXtreme BCM5703 Gigabit Ethernet"
0x14e4 0x16a7 "bcm5700" "Broadcom NetXtreme BCM5703 Gigabit Ethernet"
0x14e4 0x16c7 "bcm5700" "Broadcom NetXtreme BCM5703 Gigabit Ethernet"
0x14e4 0x1648 "bcm5700" "Broadcom NetXtreme BCM5704 Gigabit Ethernet"
0x14e4 0x16a8 "bcm5700" "Broadcom NetXtreme BCM5704S Gigabit Ethernet"
0x14e4 0x1653 "bcm5700" "Broadcom NetXtreme BCM5705 Gigabit Ethernet"
0x14e4 0x1654 "bcm5700" "Broadcom NetXtreme BCM5705 Gigabit Ethernet"
0x14e4 0x165d "bcm5700" "Broadcom NetXtreme BCM5705M Gigabit Ethernet"
0x14e4 0x165e "bcm5700" "Broadcom NetXtreme BCM5705M Gigabit Ethernet"
0x14e4 0x1696 "bcm5700" "Broadcom NetXtreme BCM5782 Gigabit Ethernet"
0x14e4 0x169c "bcm5700" "Broadcom NetXtreme BCM5788 Gigabit Ethernet"
0x14e4 0x170d "bcm5700" "Broadcom NetXtreme BCM5901 Fast Ethernet"
0x14e4 0x170e "bcm5700" "Broadcom NetXtreme BCM5901 Fast Ethernet"
0x10de 0x01c3 "nvnet" "MCI|nForce2 10/100Mb/s 0x01c3"
0x10de 0x0066 "nvnet" "MCI|nForce2 10/100Mb/s 0x0066"
Now we'll have to unpack that archive, add the driver files, and repackage. If you run into trouble here because there isn't enough room on your floppy, delete unneeded drivers. You don't really need support for token ring on your boot floppies, do you? If you do, keep one unmodified floppy image for token ring machines, and make one new image for ethernet.

cd to somewhere nice and empty
gunzip < <path to driver disk>/modinfo.cgz | cpio -idv
this creates a new directory called 2.4.20-8BOOT
copy your drivers into this directory. Remove any you don't need.
find 2.4.20-8BOOT -depth -print | cpio -ov -H crc | gzip --best > modules.cgz
and copy the modules.cgz file back to your floppy or mounted image.

That should be it! And as for the boot floppy, make a new image if you did your modifications on a floppy instead of doing the loop mount stuff.

The USB memory device

The next problem is of course those laptops without floppies. I could make a bootable CD, but those handy USB keyring devices tempted me. They would work even for a lightweight laptop without CD-ROM, and they can be modified without burning a new one. I have used a Dell 64MB unit for this testing. On my RH9 desktop it comes up as a SCSI device. Since I don't have SCSI it comes up as the first SCSI device, sda. I just have to plug it in and
mkdir /tmp/usb
mount /dev/sda1 /tmp/usb
If you have SCSI devices, the device name will probably be the first one unused by SCSI units.

Next, mount the boot floppy image or actual boot floppy as above and copy everything over to the USB device.  Then umount and run
syslinux /dev/sda1
This should give you a bootable device. You may want to try booting something from it, but it won't find the kickstart file, and it still doesn't have the network drivers. So if your preliminary test is successfull, mount it again. Now we have to modify the root disk image within the boot image.
cd /tmp/usb
gunzip < initrd.img >
mkdir /tmp/initrd
mount /tmp/initrd -o loop
Now edit the syslinux.cfg file. change the ks=floppy to just ks= and we'll move the file to what will be /tmp once the system boots so linux will find it
cp ks.cfg /tmp/initrd/tmp
cd /tmp/initrd/modules
Now, add the info we previously added to the modinfo to the file called mdule-info. Do the same thing to pcitable. Note that we cannot simply use the files from the network driver floppy, as these files also contain other device drivers (scsi, usb, etc).

Now, we'll have to unpack this modules.cgz, add the new drivers and repack it just like above.

cd /tmp/usb
umount /tmp/initrd
gzip --best < > initrd.img
umount /tmp/usb
And that should be it! As for the floppies, you may want to make a backup of the USB device. I guess I would recommend tar or cpio for this device. When you restore this on a new device, remember to syslinux it.