α gemini kaethorn at gmail.com

Creating customized Debian Woody install floppies

The following paragraphs explain some steps which took me a while to figure them out. With the new sarge installer being almost stable these steps might become outdated sooner or later. Compared with the new installer, however, it takes less effort to replace specific files, especially the kernel, and create a customized set of floppies tailored to suit specific needs.

Step 1 - Modifying dbootstrap itself

It's absolutely required to use a pure woody system to build the sources of dbootstrap, the program that guides the user through the installation of Debian. Trying otherwise will link the resulting binary against libraries not existent on the target root.bin image and exceeding the space on the target floppy.
All the other steps can be performed on any other distribution.

First we need the source package:

$ apt-get source boot-floppies
$ cd boot-floppies-3.0.2x/utilities/dbootstrap/
The well structured code and can be modified soon after taking a closer look. What exactly needs to be done is not covered here.

Changing text content of the UI requires replacing the needed messages.<language> files in etc/ on the root.bin (see next steps) along with the binary dbootstrap. That means that prior to compilation _all_ the respective .po files in po/ must contain the original message - preferably along with the proper translation.

I used the following steps to install the messages.* files (taken from boot-floppies scripts):

$ install -m 0644 -o root -g root \ 
  C.trm <loop-mounted-root.bin>/etc/messages.en
$ install -m 0644 -o root -g root \
  utf/<language>.trm <loop-mounted-root.bin>/etc/messages.<language>

Step 2 - Modifying the rescue.bin

The rescue.bin image has to be mounted on a loop device:

$ mkdir rescue
$ mount -t msdos -o loop rescue.bin rescue/
Replace the linux.bin with the bzImage of a customized kernel, config.gz with the gzipped .config and the sys_map.gz with the System.map of the kernel you want to use:
$ cp <kernel-tree>/arch/i386/boot/bzImage rescue/linux.bin
$ gzip -v9 -c <kernel-tree>/.config > rescue/config.gz
$ gzip -v9 -c <kernel-tree>/System.map > rescue/sys_map.gz
In most cases syslinux.cfg needs to be adapted to include proper kernel parameters matching your target's hardware configuration.
Once finished, umount and write the image to a floppy:
$ umount rescue
$ dd if=rescue.bin of=/dev/<floppy> bs=1024 conv=sync

Step 3 - Modifying the root.bin

This was somehow tricky. Just don't try to do it from scratch as the filesystem is kinda special. It's not enough to create a new one with a tuned amount of inodes. But it's usually sufficient just to replace the needed files and/or delete unneeded ones (e.g. some dev/ nods) to free space:

$ mount -t ext2 -o root root.bin root
Before dd'ing the image be sure to replace etc/modules.dep and all the modules in lib/modules/ needed by etc/init.d/rcS.
Then write the image to a floppy:
$ dd if=root.bin of=/dev/<floppy> bs=1024 conv=sync

Step 4 - Driver-Disk creation

To split the kernel modules onto several floppies the floppy_split program is needed which is provided by the source package of boot-floppies (in utilities/).
A good idea is to grab the original bf24 drivers.tgz from a mirror and modify it accordingly:

$ mkdir drivers; cd drivers
$ mv ../drivers.tgz .
$ tar xvfz drivers.tgz
$ mkdir modules; cd modules
$ mv ../modules.tgz .
$ tar xvfz modules.tgz
$ cd lib/modules
$ rm <old-kernel>
$ cp -a <path-to-modules> .
$ cd ../../
$ tar cf modules.tar lib/
$ gzip -v9 -c modules.tar > modules.tgz
$ mv modules.tgz ../; cd ../
$ rm -R modules
Maybe edit modcont. Then tar it back:
$ tar cf drivers.tar * 
$ gzip -v9 -c drivers.tar > drivers.tgz
Ok, time to split the .tgz into parts which fit onto floppies:
$ ./floppy_split drivers.tgz drv14 1440
Now the important step. The last floppy - or the only one - has to have its remaining empty blocks padded:
$ mv drv14-<last>.bin drv14-<last>.bin.tmp
$ dd if=/dev/zero of=drv14-<last>.bin bs=1k count=1440
$ dd if=drv14-<last>.bin.tmp of=drv14-<last>.bin bs=1k count=1440 conv=notrunc
$ rm drv14-<last>.bin.tmp
$ dd if=drv14-<last>.bin of=/dev/<floppy> bs=1024 conv=sync
The last step applies for the rest of the driver chunks as well.

Notes about PCMCIA support

The yenta socket can't be activated for installation through the menu of the original dbootstrap. Using the second virtual console, the following steps are needed to activate it - given that the drivers are available:

  • Make sure that pcmcia_core, yenta_socket and ds (in that order) are loaded. The PCMCIA configuration tool of dbootstrap always unloads them, so better check with lsmod.
  • Set PCIC=yenta_socket in /target/etc/default/pcmcia. Then restart cardmgr and things should be working.