[SOLVED] How to compile Linux Kernel and write it to a 1.44M floppy disk?
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
I shouldn't have to install grub on a floppy, should I?
Wrong. You do need an external loader. I used to use the original grub (not the current one), but I only used it to boot my on-disk system so I didn't have to worry about having a kernel on the floppy itself.
It is possible to configure the linux kernel to boot itself (no external loader) but not on the hardware you are talking about.
I shouldn't have to install grub on a floppy, should I?
Legacy GRUB 0.97 fits just fine on a 1.44M floppy as I remember. Alternatives (that I haven't personally tried yet) are LILO and SYSLINUX (maybe version 4.07).
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.
Anyway don't give up on trying to fit it on a floppy.
I've got the bzImage down to around 6mb, I'll see how low I can get it .
Quote:
Originally Posted by Projectile
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.
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.
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.
For your information old kernels did boot from floppy without bootloader, but this feature is long gone.
My first Linux ran like that. The hard drive booted Windows98, but I had a partition with Red Hat 6 on it and a self-booting kernel on a floppy. I can't remember the version but I suppose it could be checked. I did notice at some later point that booting from a kernel no longer worked, but I assumed it was the BIOSes that had been updated so that they no longer recognised the Linux kernel as a valid bootloader.
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.
Last edited by business_kid; 08-30-2023 at 02:50 PM.
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.