Single-Floppy ADSL Linux Router
background
This single-floppy version of Linux came about as a result of a tech-support job that came up
in march 2001. A client who had been connecting to the internet via dialup modem was wanting
to increase their bandwidth - they were starting to do some web design and authoring work and
they were finding that a modem just wasn't fast enough for them any more.
You can read the whole story here.
What is it?
The single-floppy ADSL disk contains a tiny (500k) ext2 filesystem in blocks 0-499, and
a compressed root filesystem (2.7Mb uncompressed) in the remaining 940 blocks, starting at
block 500.
When booted, it loads linux kernel 2.2.18, dhcpd, named and pppoe. Masquerading and
firewalling is done via ipchains and a set of appropriate rules. If you are looking for
a single-floppy system to connect your home or small-business to an ADSL service (e.g.
here in Australia) then this might be useful to you.
Anatomy
This section describes how to pull apart the 1.44Mb floppy disk image to get at the
two embedded filesystems.
Start by mounting (via loopback) the disk image. You will see a 500k filesystem which
is stored on blocks 0-499 in the image. (If you don't have the loopback device configured,
then go and do that before continuing - it's too useful to live without).
You can look at the lilo.conf file in the /etc directory to see the options passed to lilo
which specify a compressed root filesystem, starting at block 500.
To look at the "real" filesystem (stored in blocks 500 - 1439), you can extract and mount
it as follows:
dd if=disk1440.img of=rootfs.gz bs=1k skip=500
gunzip rootfs.gz
mount -o loop rootfs /mnt/loop
Reverse this procedure to put it all back together again:
umount rootfs
gzip -9 rootfs
dd if=rootfs.gz of=disk1440.img bs=1k seek=500
An important step is knowing how to make the disk "bootable" after you have changed the
linux kernel. This took me a while to work out, so I'll mention it here.
- dd the disk image out onto a floppy:
dd if=disk1440.img of=/dev/fd0
- mount the disk image (the 500k ext2 filesystem):
mount /dev/fd0 /mnt/floppy
- Copy the new kernel version into /mnt/floppy/boot:
cp /usr/src/linux/arch/i386/boot/bzImage /mnt/floppy/boot/bzImage-2.2.19
- Copy the "/boot/boot.b" file from the host linux system into the /mnt/floppy/boot directory.
This is important, as it is the hosts lilo that will be run, and the boot sector must
match up with the version of lilo that you are using.
If you don't do this, then you will likely get confusing error messages from lilo :-)
cp /boot/boot.b /mnt/floppy/boot
- Run the hosts lilo command, and use the -r (chroot) option so that lilo thinks that the
/mnt/floppy directory is the root directory.
lilo -r /mnt/floppy
- All going well, you can umount the floppy image now. It is probably worth copying the
floppy image back from the FDD so that you have a copy on hard disk with the updated boot
sector and /boot/map installer.
umount /mnt/floppy
dd if=/dev/fd0 of=disk1440.img
Where is it?
The disk image is here.
It contains:
- Linux kernel 2.2.18, with support for a lot of common ethernet cards compiled in.
- Roaring Penguin pppoe client
- pppd 2.3.11
- ipchains
- named
- dhcpd
- other misc stuff... scripts etc.
Warning - the disk image is supplied "as-is". It is already set up to work in the
particular case that I had to support, and you would be well advised to look through all
the scripts etc so that you can change it around to suit your needs.
Development Environment
I used a RedHat 5.1 system to compile the binaries that went onto the floppy. RedHat 5.1 uses
glibc-2.0.7, the same version that is on the floppy. The only drama that I had to solve was
installing new libraries into the /lib directory on the floppy and then updating the /etc/ld.so.cache.
I discovered the "-r" option to ldconfig (chroot) did the trick.
You can mail me if you have questions/comments.