Linux Distribution for 386SX
I have a Commodore PC 50-II system with a Intel 386SX CPU running at 16MHz and only 5MB of RAM, in addition, the harddrive controller and harddrive is also missing. To get around this, I have installed a 3Com 3C509B-TPO ISA Network card and have managed to boot Linux on this ancient PC over the network instead.
At first I tried to use Buildroot, but I had to give up on this in the end, as it seems that pure 386 is not supported anywhere anymore. So instead, I have gone the route of building everything from scratch, so I could pick and choose specific source versions of GCC and the Linux kernel that supports 386 with math emulation. The end result is a cross-compiling toolchain for i386, a stripped down kernel and Busybox-based rootfs mounted over NFS from another host computer.
I ended up using these specific software versions:
* linux-2.4.37.9
* gcc-3.4.6
* busybox-1.01
* uClibc-0.9.33.2
* binutils-2.32
I also had to statically link everything. I tried with dynamic linking in the beginning but the system would hang during boot, and I didn't want to troubleshoot this any further.
I have made some scripts to greatly simplify the whole process of building the cross-compiling toolchain and all the binaries. Bundled in a file here.
Unpack this into a directory and then simply run the following:
./build.sh ./rootfs.sh
I have used these on a Slackware 14.2 box with GCC 5.3.0
The result will be a directory with the "rootfs" and a "bzImage" located inside the kernel build tree.
The rootfs is exported over NFS in /etc/exports like this:
/home/nfs/rootfs *(rw,sync,no_root_squash,no_all_squash,no_subtree_check)
Also note that the legacy NFSv2 protocol needs to be actived!
To prepare the kernel is the tricky part. To load it over TFTP with Etherboot you have to use the mkelf-linux script from the mknbi package. This package is not compilable on modern Linux distributions, so I ended up compiling and using it from an old Slackware 11.0 installation running in a QEMU virtual machine.
I used the command as follows:
mkelf-linux --output=pc50linux.nb --ip="192.168.0.3:192.168.0.2:192.168.0.1:255.255.255.0:pc50" --append="root=/dev/nfs nfsroot=/home/nfs/rootfs" bzImage
Where .3 is the booted client PC, .2 is the NFS server and .1 is the gateway and TFTP server.
The final step is to activate the TFTP/DHCP server. I used dnsmasq for this, with the following relevant configuration:
dhcp-host=00:ff:ff:ff:ff:ff,192.168.0.3,infinite,set:pxelinux enable-tftp tftp-root=/var/ftpd dhcp-boot=net:pxelinux,/var/ftpd/pc50linux.nb,boothost,192.168.0.1
Some additional information: I have no Boot ROM on the Ethernet card, so I used a floppy disk to actually kick-start the network booting. More specifically, the "3c509.dsk" image made from compiling parts of the "Etherboot" package. Since this also isn't compilable on modern distributions, I had to use the Slackware 11.0 QEMU virtual machine again.