{"id":21358246,"url":"https://github.com/snacsnoc/fluxflop","last_synced_at":"2025-06-30T08:35:07.115Z","repository":{"id":242136104,"uuid":"808779928","full_name":"snacsnoc/fluxflop","owner":"snacsnoc","description":"floppy-sized Linux in the modern era","archived":false,"fork":false,"pushed_at":"2025-01-15T09:04:43.000Z","size":81,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T03:01:38.059Z","etag":null,"topics":["floppy-linux","i486","linux-distribution","operating-system"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snacsnoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-31T19:56:11.000Z","updated_at":"2025-02-06T09:51:23.000Z","dependencies_parsed_at":"2024-06-13T10:15:24.574Z","dependency_job_id":"d4dfd7c5-110d-4266-9d78-c08175eaba4f","html_url":"https://github.com/snacsnoc/fluxflop","commit_stats":null,"previous_names":["snacsnoc/fluxflop"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/snacsnoc/fluxflop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snacsnoc%2Ffluxflop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snacsnoc%2Ffluxflop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snacsnoc%2Ffluxflop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snacsnoc%2Ffluxflop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snacsnoc","download_url":"https://codeload.github.com/snacsnoc/fluxflop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snacsnoc%2Ffluxflop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262739609,"owners_count":23356753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["floppy-linux","i486","linux-distribution","operating-system"],"created_at":"2024-11-22T05:15:12.852Z","updated_at":"2025-06-30T08:35:07.105Z","avatar_url":"https://github.com/snacsnoc.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fluxflop - floppy-sized Linux\n\nIt's ~~2024~~ 2025 and floppies are still cool. Maintain that coolness by building your own floppy-sized Linux distro like it's 1999.\n\nThis 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.\n\n## Quick Start\nTwo pre-built bootable floppy images are available in [Releases](https://github.com/snacsnoc/fluxflop/releases):\n\n- **Linux 6.12.9**: Latest kernel build\n ```bash\n qemu-system-i386 -fda fluxflop-linux-6.12.9-boot.img -boot a -m 32\n```\n\n- **Linux 4.20.17**: Optimized for real i486DX hardware\n - Minimum requirements:\n   - i486DX CPU @ 25MHz+ (SX models not supported)\n   - 8MB RAM minimum (16MB recommended)\n - Boots from:\n   - Real 1.44MB floppy disk\n   - 86Box/PCem with i486DX configuration\n   - QEMU with 5-32MB RAM setting\n\n## Building pre-reqs\n\n__gcc-i686 build:__\n\nPackages:\n```\napt-get install build-essential gcc-i686-linux-gnu g++-i686-linux-gnu\n```\n\n__i486/i686-musl build:__\n```\n# see README.md within musl-cross-make for all targets\ngit clone https://github.com/richfelker/musl-cross-make\n\ncd musl-cross-make\nmake TARGET=i486-linux-musl\nmake install\n\n```\n__arm64-musl build:__\n```\nmake TARGET=aarch64-linux-musl\nmake install\n```\nAdd the musl toolchain to your path:\n`export PATH=~/musl-cross-make/output/bin:$PATH`\n\n__Building on Mac OS:__\n\nSave yourself a headache and use a pre-built toolchain courtesy of [homebrew-macos-cross-toolchains](https://github.com/messense/homebrew-macos-cross-toolchains)\n```\nbrew tap messense/macos-cross-toolchains\n# valid targets are aarch64-unknown-linux-musl, arm-unknown-linux-musleabihf\n# armv7-unknown-linux-musleabihf, i686-unknown-linux-musl, x86_64-unknown-linux-musl\nbrew install i686-unknown-linux-musl\n```\nInstall the LLVM linker:\n```\nbrew install lld\n```\nInstall [lkmake](https://github.com/markbhasawut/mac-linux-kdk) to included needed headers files for a successful build:\n```\nbrew tap markbhasawut/markbhasawut\nbrew -v install markbhasawut/markbhasawut/mac-linux-kdk\n```\nFor the following directions, use `lkmake` in place of `make`\n\n__Create a build dir:__\n`mkdir build/`\n\n__Prepare the kernel:__\n```\ncd build/\nwget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.9.3.tar.xz\ntar -xf linux-6.9.3.tar.xz\n\n# see configs/linux for all configs available\n# .config - default i686 config\n# .config-x86-fb - i486 with framebuffer support\n# .config-x86-serial - i486 with serial support\n# .config-x86-vga - i486(DX) with VGA\n\ncp ./configs/linux/6.x.x/.config-\u003cconfig-name\u003e linux-6.9.3/.config\n````\nThe smallest kernel produced is using `.config-x86-fb` (XZ compression) = 592KB\n\n\n__Root filesystem layout:__\n```\nmkdir -p root/{bin,proc,dev,sys,usr}\n\n\n\n# Create a simple init script\n# or compile tools/init.c and place in root/\ncat \u003e root/init \u003c\u003cEOF\n#!/bin/sh\n# Mount essential filesystems\nmount -t proc none /proc\nmount -t sysfs none /sys\nmount -t devtmpfs none /dev\n\n# Start a shell\nexec /bin/sh -i \n\n# Infinite loop to prevent the script from exiting\nwhile true; do\n    sleep 1\ndone\nEOF\n\nchmod a+x root/init\n\n# you will need root privileges to make these nodes\nmknod -m 660 ./root/dev/console c 5 1\nmknod -m 666 ./root/dev/ttyS0 c 4 64\nmknod -m 666 ./root/dev/tty c 5 0\n\n\n```\n\n__Output image directories:__\n```\nmkdir -p bootable_image/{boot,isolinux}\n```\n\n\n## Build\n__Linux:__\nNote: if you are including the initramfs in `.config` within the built image, build the rootfs first.\n```\ncd linux-6.9.3\nmake ARCH=x86 CROSS_COMPILE=i686-linux-gnu- -j8 #use bzImage for x86, Image.gz for arm64. adjust -gnu to -musl as needed\n```\n\n\n__Toybox:__\n```\nwget https://landley.net/toybox/bin/toybox-i486 -O ./root/bin/toybox-i486\n./scripts/toybox-symlinks.sh\n```\nToybox provides many common Linux utilities including a shell. For the sake of simplicity, the static builds provided by Toybox is used.\nYou can optionally compile Toybox yourself:\n```\ncd build/\nwget https://landley.net/toybox/downloads/toybox-0.8.11.tar.gz\ntar xvf toybox-0.8.11.tar.gz\n\ncp ../configs/toybox/.config toybox-0.8.11\ncd toybox-0.8.11\n\nmake CFLAGS=\"-march=i486 -mtune=i486\" LDFLAGS=\"-static -s\" ARCH=x86 CROSS_COMPILE=i486-linux-musl- -j8\nmake install\ncp -R install/* ./root\n```\n\n\n__Strip debug symbols in the root filesystem:__\n```\n./scripts/stripfs.sh\n```\n\n\n\n__Make the initramfs:__\n```\n./scripts/make-cpio.sh\n```\n\n__(Optional): Syslinux for ISOs:__\n```\nwget https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.gz\ntar xvf syslinux-6.03.tar.gz\ncd syslinux-6.03\n\ncp syslinux/bios/core/isolinux.bin bootable_image/isolinux\ncp syslinux/bios/com32/elflink/ldlinux/ldlinux.c32 bootable_image/isolinux\n\n# copy config\ncp configs/isolinux/isolinux.cfg bootable_image/isolinux\n```\n\n## Boot\n__Make a bootable ISO:__\n```\n./scripts/make-iso.sh\n```\nand boot with:\n```\nqemu-system-i386 -cdrom out.iso -m 32 -nographic \n```\n__Make a bootable floppy:__\nIf not already set, edit the Linux `.config` and set `CONFIG_INITRAMFS_SOURCE` to your rootfs cpio archive path.\n```\ncd build/\ngit clone https://github.com/oerg866/w98qi-tiny-floppy-bootloader\n\ncd w98qi-tiny-floppy-bootloader/\n\n# generate a bootable floppy\nbash build.sh ../linux-6.9.3/arch/x86/boot/bzImage disk.img\n\n```\nBoot with qemu:\n`qemu-system-i386 -fda disk.img`\n\n\n__Boot with kernel and initial ramdisk with qemu:__\n```\nqemu-system-i386 -kernel ./linux-6.8.11/arch/x86/boot/bzImage -initrd ./rootfs.cpio.gz -append \"init=/init rdinit=/init console=ttyS0,115200n8\" -m 32 -nographic\n```\n\nor, if you built with simple framebuffer:\n```\nqemu-system-i386 -kernel ./bzImage -initrd ./rootfs.cpio.gz -append \"init=/init rdinit=/init console=tty0\" -m 32\n```\n\n## Extra\nUse a simple C program to use as init:\n```\ngcc -static -o init tools/init.c\n```\nUse as the initramfs:\n```\necho init | cpio -ov --format=newc \u003e initramfs.img\n```\n\n__Kernel image comparison with printk support__:\n\nwith:\n```\nstat -c %s arch/arm64/boot/Image\n2809864\n```\n\nwithout:\n```\nstat -c %s arch/arm64/boot/Image\n2283528\n```\n\n__-fomit-frame-pointer__:\n```\neasto@debian-build:~/testing-linux/linux-6.8.11$ ls -ls arch/x86/boot/bzImage \n728 -rw-r--r-- 1 easto easto 741888 May 30 02:27 arch/x86/boot/bzImage\n\neasto@debian2:/tmp/linux-6.9.3$ stat -c %s vmlinux\n1919144\n\nmake KCFLAGS=\"-fomit-frame-pointer\" ARCH=x86 CROSS_COMPILE=i686-linux-gnu- bzImage -j8\n \neasto@debian-build:~/testing-linux/linux-6.8.11$ ls -ls arch/x86/boot/bzImage \n716 -rw-r--r-- 1 easto easto 729600 May 30 02:30 arch/x86/boot/bzImage\n\neasto@debian2:/tmp/linux-6.9.3$ stat -c %s vmlinux\n1886332\n```\n__-fno-inline-small-functions__:\n```\neasto@debian2:/tmp/linux-6.9.3$ stat -c %s vmlinux\n1919144\n\nmake KCFLAGS=\"-fno-inline-small-functions\" ARCH=x86 CROSS_COMPILE=i486-linux-musl- -j8\n\neasto@debian2:/tmp/linux-6.9.3$ stat -c %s vmlinux\n1919528\n   ````\n\n\n\nfind largest objects:\n```\nnm --size-sort --print-size vmlinux | tail -n 20\n````\nor\nusing [Bloaty](https://github.com/google/bloaty)\n```\nbloaty -d symbols -n 100 vmlinux\n\n```\n\n## Resources\nhttps://landley.net/toybox/\n\nhttps://justine.lol/sizetricks/\n\nhttps://elinux.org/images/7/72/Linux_tiny.pdf\n\nhttps://git.openembedded.org/meta-micro/tree/conf\n\nhttps://elinux.org/Linux_Tiny\n\nhttps://ops.tips/notes/booting-linux-on-qemu/\n\nhttps://android.googlesource.com/platform/external/syzkaller/+/HEAD/docs/linux/setup_linux-host_qemu-vm_arm64-kernel.md\n\nhttps://github.com/ahgamut/superconfigure/?tab=readme-ov-file\n\nhttps://github.com/buildroot/buildroot/tree/master/board/qemu/aarch64-virt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnacsnoc%2Ffluxflop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnacsnoc%2Ffluxflop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnacsnoc%2Ffluxflop/lists"}