New #Insentricity post: Getting #Linux to boot on a Toshiba T5200, a 386 luggable with only 4MB of RAM. Linux doesn’t love being this RAM-starved, but that doesn’t mean it can’t be done. The biggest challenge? Compatibility: LOADLIN’s supposed bzImage support and getting Linux to work with my impossibly large (for the period) hard drive.
Checked out #Linux kernel v3.7.10 to see if I can strip it down enough to run on the 386 with 4MB of RAM in the Toshiba T5200. My plan is to do something very similar to what I did in my blog post where I targeted a 486 (https://www.insentricity.com/a.cl/283), but this time use LOADLIN.EXE to load the kernel from DOS since I don't have a working floppy drive.
Setup a Debian 7 Wheezy docker environment to build in. But already running into compile problems which seem to be caused by lack of 386 support:
In file included from include/linux/irq_work.h:4:0, from arch/x86/kernel/irq_work.c:8: include/linux/llist.h: In function 'llist_add': include/linux/llist.h:160:11: error: 'boot_cpu_data' undeclared (first use in this function)
Looks like v3.3.8 was the last version that could be built for 386. After that there's some change that prevents the kernel from compiling. #Linux#RetroComputing#VintageComputing
If I change the BIOS Memory config so that everything above 640k is Extended instead of some being Expanded then my custom kernel doesn't immediately reboot. Instead it just hangs with a cursor on the screen and doesn't print anything. Getting annoyed with the lack of a reset button on the T5200 too.
Would be nice if there was a way I could get qemu to act exactly like the T5200 so I don't have to keep testing on the real hardware.
Still can’t get my kernel to boot. Went and got the Slackware 1 kernel and used LOADLIN and that’s at least something! Maybe I should try to fix the floppy drive so I can do a traditional Linux install? #Linux#RetroComputing#VintageComputing
It will boot using the boot floppy, but if I extract the kernel from the floppy it will NOT boot with LOADLIN and instead the computer reboots.
Also not sure where to get the kernel config that was used for that v2.0.18 kernel. Or where to get the v2.0.18 linux kernel source either, git repo only goes back to v2.6.
Thanks to @nina_kali_nina I've switched to using PCem instead of qemu since it does a better job replicating the experience I get on the T5200. I've been going through old and older distros trying to find one that has a kernel that boots on the emulated 386DX. So far it seems that no distro with a 2.x kernel will work. Newest so far is Slackware 2.3 with a 1.2.8 kernel. Bumping the RAM up to 32MB doesn't get 2.x kernels working either. Very strange.
It seems like my main problem is with the loaders. If I take a kernel which I've had success with booting and move it to a different loader, it fails to boot. If I try to take the 2.4.22 kernel from its floppy and load it with LOADLIN or SYSLINUX it won't boot. If I take my custom 2.4.22 kernel and stick it on the floppy that had 2.4.22 it won't boot.
Until I can find a reliable way of loading the kernel I'll never know if the kernel itself is bad.
That proves that it *is* possible to get a bzImage to boot, so far I've only had luck with older zImage kernels. Unfortunately there is no kernel config to be found anywhere for that distro.
Found LINLD and I'm able to get my own custom v2.4.37 kernel to load on an emulated 386 with 4MB of RAM! I had to put the root filesystem on /dev/fd0 since there's not enough RAM for an initrd.
Got it to boot on the Toshiba! It’s seriously RAM starved and gray386 doesn’t even have swapon. It looks like I’m probably going to have to roll my own distro just for this computer. Many many tools missing and I need to add modules to the kernel. #Linux#RetroComputing#VintageComputing
Got gray386 to load in 4MB! I recompiled the kernel to move PHYS down to 0x100000, extracted the initramfs and put it on an ext2 formatted floppy. Loaded with LINLD and root=/dev/fd0. Can't try this on the Toshiba yet since the Toshiba doesn't have a working floppy drive. #Linux#RetroComputing#VintageComputing
Got a more complete busybox running on T5200! Started with buildroot commit before 386 support was completely removed, hunted down by @jason_duerstock. Fought getting it to compile because of cross-compile issues and slightly incomplete 386 support. Should give me a base to build on top of. Not sure yet if I want to go full "roll your own distro" w/package manager or manually compile things I want to add. Doubt anyone else wants to run Linux on a 386. #Linux#RetroComputing#VintageComputing