Boot the latest Linux kernel from a floppy disk on a 486 computer



Back in August 2019, I ran a Sing-Along Week competition to synchronize a MIDI file with a speech synthesizer that sings a song. In my warehouse I found an MQX-32M MIDI card (Roland MPU-401 clone) that I wanted to use to convert MIDI signals to Apple II + interface with Echo II speech synthesizer, but ended up using a laptop with USB MIDI interface. Another Pizza Week competition got me interested in finding a 486 computer that would fit in a pizza box, and now an opportunity presented itself.



Searching on eBay was not easy because it couldn't come up with a really good search term. I didn't bother saving the search, as this project is not a priority. Instead, from time to time, something inspired me to go to eBay and try new searches. A couple of weeks ago, I spotted this 486 computer and made an assumption about the size of the case, judging by the height of the 5.25-inch bay. It is quite thin and has a dedicated card to insert other cards sideways, and the chassis is shorter than the ISA card. Although thicker than a pizza box, it's getting close!



Motherboard TMC PAT48PG4comes with 32MB of RAM (technically 36MB, it has four 30-pin SIMs) and four cards: VGA, SoundBlaster, modem and multifunctional I / O. The seller checked the computer and sold it as non-working, since it did not pass the POST, although all the cards worked. I mostly needed a case, so I didn't bother too much. Of course, when I got the computer, I had to check if the motherboard was really dead. It didn't work for me either, but then I discovered that if I press the reset button, there are several error beeps. I tried another power supply and the systems came to life after pressing the Reset button! It still won't boot from cold shutdown by pressing the power button, not sure ifthere is a bad cover or a slight damage to the battery (the battery was changed before) prevents the Reset line from being disconnected after turning on the power. However, he worked hard enough to explore his possibilities.



My ultimate goal is to install the latest Linux and Python 3 distribution on a "large" hard drive. Since we have a 486 computer, installing the current Linux distribution is not a trivial task. The only Linux distributions that still support floppy installation are rather outdated. I usually completely bypassed the floppy installation and just booted the old computer through PXE and then installed the system over the network. I thought I could write iPXE to floppy and insert into ISA NIC, but iPXE just hangs without any error messages right after booting from floppy.



The BIOS is ancient and struggles with support for the "big" hard drive I plugged in. The disk size is 8.45 GB, but the BIOS only sees 8.0 GB. Enabling LBA in BIOS causes the computer to freeze during POST after disk detection. Win98 fdisk insists the disk is only 504 MB. FreeDOS doesn't see it at all. I tried plugging the NIC from the XTIDE ROM into the socket, and XTIDE also insists that the drive is not connected.



Since I wanted to see how Linux would detect the drive, I needed to find a way to boot Linux. After a little googling, I discovered the make tinyconfig optionwhich makes a very small (but useless) kernel small enough to fit on a floppy disk. I turned on a couple of other options, found a small enough initramfs and was able to load it on the 486. As expected, Linux sees the disk and its full capacity without any problems.



The next step is to actually install Linux on your hard drive. I would prefer not to release my own distribution, but you may need to do so. Another possibility is to boot Linux from a floppy disk, and then boot the kernel and initrd from the current distribution and kexec to it. But I feel like it's like reinventing the iPXE.



Compiling the Linux Kernel from Source



A summary of the steps to create a floppy image:



  • git clone git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git



    • v5.8-rc2-1-g625d3449788f 
  • make ARCH=x86 tinyconfig
  • make ARCH=x86 menuconfig



    • 486: CONFIG_M486=y



      • Processor type and features > Processor family > 486
    • tty: CONFIG_TTY=y

      • Device Drivers > Character devices > Enable TTY
    • printk: CONFIG_PRINTK=y



      • General Setup > Configure standard kernel features (expert users) > Enable support for printk
    • initramfs: CONFIG_INITRAMFS_COMPRESSION_GZIP=y



      • General Setup > Initial RAM filesystem and RAM disk (initramfs/initrd) support > Support initial ramdisk/ramfs compressed using gzip
    • ELF: CONFIG_BINFMT_ELF=y

      • Executable file formats > Kernel support for ELF binaries
  • make ARCH=x86 bzImage


You need rootfs, grab the system-image-486 from Aboriginal Linux image , extract rootfs.cpio.gz.



Test boot from qemu:



qemu-system-i386 -kernel arch/x86/boot/bzImage -initrd ../system-image-486/rootfs.cpio.gz


Creating an empty floppy image:



dd if=/dev/zero of=linux-boot.img bs=1k count=1440
mkdosfs linux-boot.img
syslinux --install linux-boot.img
mount -o loop linux-boot.img /mnt
cp arch/x86/boot/bzImage /mnt
cp rootfs.cpio.gz /mnt


Creating /mnt/syslinux.cfg:



DEFAULT linux
LABEL linux
 SAY Now booting the kernel from SYSLINUX...
 KERNEL bzImage
 APPEND initrd=rootfs.cpio.gz


Writing an image to a floppy disk:



umount /mnt
fdformat /dev/fd0
ddrescue -f -D linux-boot.img /dev/fd0



All Articles