https://github.com/snacsnoc/fluxflop
floppy-sized Linux in the modern era
https://github.com/snacsnoc/fluxflop
floppy-linux i486 linux-distribution operating-system
Last synced: 7 months ago
JSON representation
floppy-sized Linux in the modern era
- Host: GitHub
- URL: https://github.com/snacsnoc/fluxflop
- Owner: snacsnoc
- Created: 2024-05-31T19:56:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-15T09:04:43.000Z (about 1 year ago)
- Last Synced: 2025-04-07T03:01:38.059Z (10 months ago)
- Topics: floppy-linux, i486, linux-distribution, operating-system
- Language: Shell
- Homepage:
- Size: 79.1 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fluxflop - floppy-sized Linux
It's ~~2024~~ 2025 and floppies are still cool. Maintain that coolness by building your own floppy-sized Linux distro like it's 1999.
This project is buildable by a gcc toolchain provided by your distribution or by building a [musl](https://www.musl-libc.org/) toolchain. For the smallest binaries sizes, musl is recommended.
## Quick Start
Two pre-built bootable floppy images are available in [Releases](https://github.com/snacsnoc/fluxflop/releases):
- **Linux 6.12.9**: Latest kernel build
```bash
qemu-system-i386 -fda fluxflop-linux-6.12.9-boot.img -boot a -m 32
```
- **Linux 4.20.17**: Optimized for real i486DX hardware
- Minimum requirements:
- i486DX CPU @ 25MHz+ (SX models not supported)
- 8MB RAM minimum (16MB recommended)
- Boots from:
- Real 1.44MB floppy disk
- 86Box/PCem with i486DX configuration
- QEMU with 5-32MB RAM setting
## Building pre-reqs
__gcc-i686 build:__
Packages:
```
apt-get install build-essential gcc-i686-linux-gnu g++-i686-linux-gnu
```
__i486/i686-musl build:__
```
# see README.md within musl-cross-make for all targets
git clone https://github.com/richfelker/musl-cross-make
cd musl-cross-make
make TARGET=i486-linux-musl
make install
```
__arm64-musl build:__
```
make TARGET=aarch64-linux-musl
make install
```
Add the musl toolchain to your path:
`export PATH=~/musl-cross-make/output/bin:$PATH`
__Building on Mac OS:__
Save yourself a headache and use a pre-built toolchain courtesy of [homebrew-macos-cross-toolchains](https://github.com/messense/homebrew-macos-cross-toolchains)
```
brew tap messense/macos-cross-toolchains
# valid targets are aarch64-unknown-linux-musl, arm-unknown-linux-musleabihf
# armv7-unknown-linux-musleabihf, i686-unknown-linux-musl, x86_64-unknown-linux-musl
brew install i686-unknown-linux-musl
```
Install the LLVM linker:
```
brew install lld
```
Install [lkmake](https://github.com/markbhasawut/mac-linux-kdk) to included needed headers files for a successful build:
```
brew tap markbhasawut/markbhasawut
brew -v install markbhasawut/markbhasawut/mac-linux-kdk
```
For the following directions, use `lkmake` in place of `make`
__Create a build dir:__
`mkdir build/`
__Prepare the kernel:__
```
cd build/
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.9.3.tar.xz
tar -xf linux-6.9.3.tar.xz
# see configs/linux for all configs available
# .config - default i686 config
# .config-x86-fb - i486 with framebuffer support
# .config-x86-serial - i486 with serial support
# .config-x86-vga - i486(DX) with VGA
cp ./configs/linux/6.x.x/.config- linux-6.9.3/.config
````
The smallest kernel produced is using `.config-x86-fb` (XZ compression) = 592KB
__Root filesystem layout:__
```
mkdir -p root/{bin,proc,dev,sys,usr}
# Create a simple init script
# or compile tools/init.c and place in root/
cat > root/init < initramfs.img
```
__Kernel image comparison with printk support__:
with:
```
stat -c %s arch/arm64/boot/Image
2809864
```
without:
```
stat -c %s arch/arm64/boot/Image
2283528
```
__-fomit-frame-pointer__:
```
easto@debian-build:~/testing-linux/linux-6.8.11$ ls -ls arch/x86/boot/bzImage
728 -rw-r--r-- 1 easto easto 741888 May 30 02:27 arch/x86/boot/bzImage
easto@debian2:/tmp/linux-6.9.3$ stat -c %s vmlinux
1919144
make KCFLAGS="-fomit-frame-pointer" ARCH=x86 CROSS_COMPILE=i686-linux-gnu- bzImage -j8
easto@debian-build:~/testing-linux/linux-6.8.11$ ls -ls arch/x86/boot/bzImage
716 -rw-r--r-- 1 easto easto 729600 May 30 02:30 arch/x86/boot/bzImage
easto@debian2:/tmp/linux-6.9.3$ stat -c %s vmlinux
1886332
```
__-fno-inline-small-functions__:
```
easto@debian2:/tmp/linux-6.9.3$ stat -c %s vmlinux
1919144
make KCFLAGS="-fno-inline-small-functions" ARCH=x86 CROSS_COMPILE=i486-linux-musl- -j8
easto@debian2:/tmp/linux-6.9.3$ stat -c %s vmlinux
1919528
````
find largest objects:
```
nm --size-sort --print-size vmlinux | tail -n 20
````
or
using [Bloaty](https://github.com/google/bloaty)
```
bloaty -d symbols -n 100 vmlinux
```
## Resources
https://landley.net/toybox/
https://justine.lol/sizetricks/
https://elinux.org/images/7/72/Linux_tiny.pdf
https://git.openembedded.org/meta-micro/tree/conf
https://elinux.org/Linux_Tiny
https://ops.tips/notes/booting-linux-on-qemu/
https://android.googlesource.com/platform/external/syzkaller/+/HEAD/docs/linux/setup_linux-host_qemu-vm_arm64-kernel.md
https://github.com/ahgamut/superconfigure/?tab=readme-ov-file
https://github.com/buildroot/buildroot/tree/master/board/qemu/aarch64-virt