How to compile Linux Kernel and write it to a 1.44M floppy disk?
Hi guys! I'm a retro computing nerd and I want to make a Linux Distro for very old computers (486 and up). To start off I just want to compile the kernel and put it on a 1.44M floppy disk. What would be the most recent version of the kernel could I do this with, and how would I go about compiling it to a .img file or whatever?
Thanks! |
Hello, I'm curious about this too but I fear only the old versions 2.4.x still fit on a floppy.
Might also want to look into DamnSmallLinux, you could probably extract the small kernel and root from it. |
You should be asking what is the most recent version of the kernel that would actually run on a machine like that! Probably something in the 2.0 series.
To compile a kernel, you download the source and use a command sequence like make menuconfig->make bzImage->make modules. But again I don't know if a very old kernel would compile at all with modern compilation tools. |
Quote:
|
I don't know about compiling a kernel, but maybe take a look at these.....
https://lunduke.substack.com/p/3-lin...ns-that-fit-on https://hackaday.com/2021/05/24/runn...e-floppy-disk/ |
You would be short of both disc space and memory so you would not want to build any drivers for hardware that was not present on the machine. If it was me, I'd put drivers for the disk controller, partition and filesystem into the kernel (so no need for an initrd) and compile the few other drivers you would need as modules.
|
Not quite what you're asking for, but these projects might still be useful...
No idea if it'll run on a 486, but Tiny Core Linux gets a modern kernel down to 17MB without a GUI, 23MB with GUI. (Maybe check if there are download archives of early versions that go smaller?) The typical "old computer" distro is AntiX Linux, but it requires at least a Pentium 1 (i.e. 586), and would require a CD. More importantly, both of them have forums where you might be able to ask advice on going smaller/older... Tiny Core Linux Forum and AntiX Forum. |
1.44MB? Forget it.
Until recently, you could get tomsrtbt at www.toms.net/rb. That reformatted the floppy to 1.82MB, and wrote a 2.0 kernel and ancient busybox to it. It was libc5 based, and enshrined everything that was bad about early pcs. But you want that, by the sound of it. You may find tomsrtbt mirrored somewhere. Otherwise, pick up a kernel from the 1990s and get a second floppy for the initrd & busybox. Slackware was originally distributed on floppy disks. Slackware goes back to version 1.x on ftp.slackware.uk, which has decent bandwidth. EDIT: Slackware was compiled i486 for most of it's 32bit life. I'm sure it was i386 back then. |
Have you considered looking into FreeDOS instead?
|
2.0 won't compile on modern Ubuntu Linux. Should I try setting up a older linux disro in a VM and compile it on there?
|
Quote:
Early slackware was distributed on floppies in the mid 1990s, when 486s were current. |
floppinux seems to be pretty current - gotta be worth a try.
|
Well, let's say I drop the 1.44MB limit. Would the newest linux kernel run on a 486? (I remember hearing somewhere they were thinking about dropping support for it, not sure if that happened.)
|
Try it and find out!
If you're serious about making your own distro, you need a mindset of exploring and figuring things out. Hint: The Tiny Core Linux website I linked in post #7 contains a FAQ, and the FAQ lists minimum requirements... |
Quote:
|
Look, any 32bit kernel will run on the 486 - all the 5.x kernels anyhow, and anything before. I didn't think they had dropped 486 yet, as there's still support for a lot of 32bit architectures, what space they would save in dropping 486 is minimal.
There's other things you'll need to know. The standard exploit on a linux server back then was to exploit a buffer overrun (inetd, httpd, sendmail & bind were all buggy back then). Directly above the buffers was the stack(?) then executable memory. A 'goto 0x0000' would be placed there, and when the program got to it, you'd have root access to the machine. Numerous root & branch security reforms have come along since, and many, many patches.So stay off the internet. The only security you have is that young hackers were still in nappies/diapers when this was going on. An nmap scan would reveal youropenness to every CVE in the last 15-20 years. If you can lay hands on an old ide hard drive you might get a few hundred MB of storage for the full OS. You need lilo for booting, although those things default to the floppy at boot. There's actually some dweeb selling floppy disks still. I read an article about him once. Internet connectivity was achieved with dialup modems via serial port. No isp has that stuff today. So if you want to risk your OS, get a 10MB nic and connect through your real pc. Alternatively, connect directly to your router, or via mains powerline network adapters. |
Did you investigate tinyroot? IT is a floppy Linux available using GIT. The whole source is bigger, but once you trim down to only the drivers you need it fits on a floppy with room to spare.
Tom's Root Boot is still around, but a bit harder to find these days. I once had sources for it, but reclaimed that space LONG ago! I seem to remember SERIAL TERMINAL LINUX being a thing, and it fit on a floppy. |
Alright, I got the kernel compiled and made the bzImage. I tried to boot from it as a floppy in QEMU but it just says use a boot loader. I shouldn't have to install grub on a floppy, should I?
|
Why not tiny lilo?
|
Quote:
It is possible to configure the linux kernel to boot itself (no external loader) but not on the hardware you are talking about. |
Quote:
Anyway don't give up on trying to fit it on a floppy. Also, this probably isn't relevant to your 486 computer but have you tried MenuetOS yet? It's not Linux but it's very impressive. Boot from a floppy into a GUI. |
Quote:
Quote:
|
After a while I decided to come back to this project. I figured out how to boot the bzImage in QEMU with -kernel flag. But of course when it boots it gives errors about not finding a root FS. Now I'm having trouble creating a initrd, how should I go about making one?
|
The486Nerd, according to the mkinitrd manpage, the initrd is a cpio+gz archive, so a caveman-like approach would be to use cpio and gzip. If I were you I'd just try to steal the initrd (and kernel) from DamnSmallLinux before even attempting to build my own from scratch. Kudos to you for a more direct approach. :)
The Linux From Scratch project has a page you might find useful: https://www.linuxfromscratch.org/blf...initramfs.html |
For your information old kernels did boot from floppy without bootloader, but this feature is long gone.
I just checked, in 6.4.7 sources one can enable compiler optimizations for 486SX or 486DX, which means they are supported. |
Quote:
|
There was tomsrtbt, which built a 2.0 kernel, busybox, and squeezed them onto a 1.44MB floppy which was formatted out to 1.82MB or so. There's a script in the archive which does that, but the site is down now. It mat be worth a web search, and you need a good floppy. This link might do it
https://archive.org/download/tucows_68437_tomsrtbt Get the tar.gz. It's libc5 stuff, so don't add a thing, just use it. It had ext2 and msdos modules. Some scsi, it knew about ISA, no pci/pcie/X. It can fix a bootloader, and fsck those disks. /dev/fd0 is the root drive. EDIT: Internet was a dialup modem via serial port and pppd :-). If you have a wired nic, you just might get that up, but don't expect firmware! One in an ISA slot would be best. It did have dhcp, iirc. |
I found a super old web page on making a initramfs with busybox. I got it working and now I have a shell and some basic commands.
|
What kernel version? Tomsrtbt's boast was that it was the most linux on a floppy. Oh, mark this thread solved.
|
I wasn't able to get the bzImage down enough with kernel 6.5 so I decided to go with putting it on a CD. One more question, how would I go about putting network card drivers in the CD? Is there a file I need to put in the initramfs or something?
|
You built the kernel, build all the needed drivers in, then there is no need for modules and/or initramfs.
|
Quote:
|
Quote:
What did you get the 6.5 kernel down to? 5MB? Go on - how near are you? In post #27 I linked the Tomsrtbt-2.0.103 archive which formats a floppy to 1.82MB and will dd a disk to it. Also instructive is to reverse engineer early distros which were put out on floppies. |
For the record, I have a 5.15.63 kernel source here. I ran the following
Code:
cd /usr/src/linux-5.15.63 Post #27? Or knock yourself out with a 2.2 kernel. |
Can't unneeded features and drivers be disabled (or stripped out) from the kernel to keep the image small?
|
Quote:
|
Was going to stay out of this
https://www.linuxquestions.org/quest...-1540-dm-1388/ https://www.linuxquestions.org/quest...q-1540dm-1393/ Since OP is trying to re write the wheel on old gear. So not sure if helpful not 8 bit gear is getting harder to deal with as time moves along. antiX was full install was a no go on that 8 bit machine, Probably a core iso like a Debian net install but I am not sure of OP linux skill set. Talking about a net install and build from scratch from there kind of skills. From a a guy who runs it Code:
$ inxi -b |
Well of course you'd do that. The whole point of compiling your own kernel is not to build the bits you don't want. But with a modern kernel, even the stripped down version won't fit on a floppy
|
Can I remind you guys that the OP has had the solution since post #27 and isn't currently contributing? Tom Oehser couldn't even squeeze the 2.2 kernel onto his 1.82MB (=1.44MB but more densely formatted) floppy without dropping something he considered more important.
|
Marking as solved
|
It's useful to others to mention how you fixed it. I guess you used Tomsrtbt?
|
All times are GMT -5. The time now is 11:20 AM. |