Polish geek runs Linux on a floppy disk, using the latest kernel!
Fengse from Aofei Temple
Quantum Bit Report | Public Account QbitAI
Booting Linux with a floppy disk This used to be very common, but that was back in the 90s and 00s.
Older students may be familiar with it.
But now, even if you still have a working 3.5-inch floppy disk, the 1.44MB capacity is far from enough to hold a modern Linux kernel, let alone all the supporting software.
But a Polish game developer has a way to embed the modern Linux operating system using only a floppy disk !
There are still several hundred KiB of free space on the disk ! And all the latest "components" are used, including the 5.13.0-rc2 version of the Linux kernel, which was released on May 16 this year.
A modern Linux system on a floppy disk
The guy named this system Floppinux , and walked everyone through the entire process on its official website, including all the commands from pulling down , compiling the source code to creating the final disk image.
The reason why I did this was because I felt that I had been using Linux for many years and had used many Live-CDs (things that allow you to experience the Linux operating system without installing it on the hard disk) .
But he knew little about the basic principles behind it, so he decided to do some research.
My first goal is to run the Nomad Diskmag program.
Does anyone know about this ancient thing called Diskmag ?
Its full name is disk magazine, which is an electronic magazine published in the form of floppy disks in the 1980s and 1990s. After the 1990s, it was replaced by online publications.
The guy has already used bash script to finish the front-end interface, and the only thing missing is the cover, directory and cat the text of each file.
To run the scripts he wrote, he needed a working Linux distribution, that is, a system that could run from a floppy disk.
Get started!
Because compiling 32-bit code on a 64-bit system is a bit tricky. To make things easier, I'm doing this all on my old laptop with a 32-bit CPU.
You can use VirtualBox for 32-bit systems. If you want to use 64-bit, add the command "ARCH=x86", for example: make ARCH=x86 tinyconfig.
Here's the rough outline of how to fit a modern Linux operating system onto a 1.44MB floppy disk:
1. Create and enter the directory where you want to save the file
2. Configure and build a custom kernel
Using the latest Linux kernel
(version 5.13.0-rc2)
:
git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Make a minimal configuration: make tinyconfig
Add additional configuration: make menuconfig
Select the following options from the menu:
Save the settings and exit, wait for the compilation to complete, and finally the kernel will be built in arch/x86/boot/bzImage, move it to the home directory.
3. Add tools
Without the tool, the kernel will only boot and cannot perform any operations. I use BusyBox (one of the most popular lightweight tools) , download and unzip:
wget https://busybox.net/downloads/busybox-1.33.1.tar.bz2
Enter the directory and start the configuration: make allnoconfig
Then select the tools you want: make menuconfig
Each menu item shows how many KB each tool will take up, so choose wisely.
My brother’s choice:
Save the configuration and exit. After the compilation is complete, a file system containing all files will be created in the _install directory. Move it to the main directory.
4. Add directory structure
With the kernel and basic tools in place, some additional directory structure is still required:
cd ../filesystem
mkdir -pv {dev,proc,etc/init.d,sys,tmp}
sudo mknod dev/console c 5 1
sudo mknod dev/null c 1 3
Next, create a few configuration files and display a welcome message after startup:
cat >> welcome << EOF
Some welcome text...
EOF
Then configure the Inittab file that handles startup, exit, and restart & the actual initialization script , make the initialization script executable, and set the owner of all files to root. (The commands have been omitted due to space limitations, please refer to the link at the end of the article [1] for details)
Finally, compress this directory into a single file.
All of the above can be tested by running QEMU (a widely used emulated processor on GNU/Linux platforms) from your home directory .
5. Now it's time to put all this on a floppy disk.
Create a Syslinux boot file pointing to the kernel and file system :
cat >> syslinux.cfg << EOF
DEFAULT linux
LABEL linux
SAY [ BOOTING FLOPPINUX VERSION 0.1.0 ]
KERNEL bzImage
APPEND initrd=rootfs.cpio.gz
EOF
chmod +x syslinux.cfg
Create a blank floppy image:
dd if=/dev/zero of=floppinux.img bs=1k count=1440
mkdosfs floppinux.img
syslinux --install floppinux.img
Mount it ! and copy syslinux, the kernel and the filesystem to the floppy image:
sudo mount -o loop floppinux.img /mnt
sudo cp bzImage /mnt
sudo cp rootfs.cpio.gz /mnt
sudo cp syslinux.cfg /mnt
sudo umount /mnt
Finish!
Now you have your own distribution image floppinux.img that you can burn to a floppy disk and boot it on real hardware!
Startup takes more than 1 minute
It took the guy less than 3 minutes to successfully burn it, and then started the first boot:
Success! It took just over a minute.
Ah, from what I saw on the screen the guy doesn’t seem to be young, and his hair is so bald that it makes people cry.
My brother says that on this bare metal modern hardware the only thing that can hold back the boot speed is the actual speed of the floppy drive. They max out at 125KB/s raw. They may actually be slower.
Below is a summary of the space occupied by the floppy disk. You can see that there are 272KiB left.
Netizens hotly discussed: "In 1992, I needed two 5.25" floppy disks"
The hardware open source project website Hackaday reported on the young man’s creation and commented:
Of course, some concessions had to be made in order to build the latest Linux kernel and BusyBox into about 1MB of space, so Floppinux is certainly not what anyone would call a daily driver. Once the system is booted, there isn't much to do with it other than writing some shell scripts.
Even if you don't have a floppy disk, it's worth following his tutorial and booting the image in QEMU to see how to formally build a Linux system from scratch. Not only is this something for bragging rights, the knowledge of how all the components of such a minimal installation fit together is also useful for learning embedded Linux devices.
On the Hacker News forum, many people gave thumbs up to the guy, and one person said that what surprised him most was that he used the latest version of Linux kernel and BusyBox. And this is also useful for other embedded systems.
Someone said, back in 1992 I needed two 5.25-inch floppy disks to run Linux!
Developer Introduction
The protagonist of the article is called Krzysztof Jankowski, from Poland, born after 1985, and a professional game developer and digital artist.
I started programming with QBASIC 25 years ago. I like FOSS, pixel art , Raspberry Pi, game engines, etc.
Last year, he founded his own company, Cyfrowy Nomada, and signed a contract with beffio to develop a premium game engine. His dream of becoming a professional game developer became a reality.
I wonder if anyone has played the game “ Tanks of Freedom” developed by him and his partners ?
GitHub Portal: https://github.com/w84death/floppinux
Reference Links:
[1] https://bits.p1x.in/floppinux-an-embedded-linux-on-a-single-floppy/
[2] https://hackaday.com/2021/05/24/running-modern-linux-from-a-single-floppy-disk/
[3] https://news.ycombinator.com/item?id=27247612
[4] https://krzysztofjankowski.com/
-over-
This article is the original content of [Quantum位], a signed account of NetEase News•NetEase's special content incentive plan. Any unauthorized reproduction is prohibited without the account's authorization.
NVIDIA NLP Open Course | Free Registration
At 8pm on July 14, NVIDIA experts will share how to use NeMo to quickly implement information extraction tasks in NLP through theoretical explanations and code demonstrations. Come and scan the QR code to sign up~
click here
Featured Posts