MrRockchip

floppinux

Jan 29th, 2026 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.00 KB | None | 0 0
  1. # FLOPPINUX - An Embedded 🐧Linux on a Single 💾Floppy
  2. ## 2026 Edition (v0.3.1.x64mod)
  3.  
  4. - v0.3.1.x64mod - **January 29, 2026**
  5. - v0.3.1 - **December 21, 2025**
  6. - v0.3.0 - **October 19, 2025**
  7.  
  8. ---
  9.  
  10. > FLOPPINUX was released in 2021. After four years people find it helpful. Because of that I decided to revisit FLOPPINUX in 2025 and make updated tutorial. This brings bunch of updates like latest kernel and persistent storage.
  11.  
  12. ## Table of Contents
  13.  
  14. - [Main Project Goals](#main-project-goals)
  15. - [Linux Kernel](#linux-kernel)
  16. - [64-bit Base OS](#64-bit-base-os)
  17. - [Working Directory](#working-directory)
  18. - [System Requirements](#system-requirements)
  19. - [Kernel](#kernel)
  20. - [Toolset](#toolset)
  21. - [Filesystem](#filesystem)
  22. - [Boot Image](#boot-image)
  23. - [Floppy Disk](#floppy-disk)
  24. - [Summary](#summary)
  25. - [Download](#download)
  26.  
  27. ## Main Project Goals
  28.  
  29. Think of this as Linux From Scratch but for making single floppy distribution.
  30.  
  31. > It is meant to be a full workshop (tutorial) that you can follow easily and modify it to your needs. It is a learning exercise. Some base Linux knowledge is needed.
  32.  
  33. The final distribution is very simple and consists only of minimum of tools and hardware support. As a user you will be able to boot any PC with a floppy drive *(either physical or virtual, preferably 2.88MB one according to this instruction aimed for coreboot+SeaBIOS)* to a Linux terminal, edit files, and create simple scripts. There is ??? KB of space left for your newly created files.
  34.  
  35. ### Core features:
  36.  
  37. - Fully working distribution booting from the single floppy
  38. - Latest* Linux kernel
  39. - Supporting all 32-bit x86 CPUs since Intel 486DX - **HOWEVER, IT WAS LIKE THAT ONLY BEFORE I SWITCHED THIS INSTRUCTION TO X86_64**
  40. - Have a working text editor (Vi) and basic file manipulation commands (move, rename, delete, etc.)
  41. - Support for simple scripting
  42. - Persistent storage on the floppy to actualy save files (264KB)
  43. - Works on real hardware and emulation
  44.  
  45. ### Minimum Hardware Requirements:
  46.  
  47. - Intel 486DX 33MHz - **HOWEVER, IT WAS LIKE THAT ONLY BEFORE I SWITCHED THIS INSTRUCTION TO X86_64**
  48. - 20MB RAM
  49. - Internal floppy disk - **OR A VIRTUAL FLOPPY DISK IMAGE, THAT COULD BE AS LARGE AS 2.88 MB, TO USE IT AS A PART OF COREBOOT+SEABIOS ROM**
  50.  
  51. ## Linux Kernel
  52.  
  53. The Linux kernel drops i486 support in 6.15 (released May 2025), so **6.14.11** (released March 2025) is the latest version with full compatibility. **HOWEVER, SINCE I SWITCHED THIS INSTRUCTION TO X86_64, WE COULD TAKE THE LATEST STABLE 6.18.7**
  54.  
  55. ## 64-bit Base OS
  56.  
  57. This time I will do everything on **Artix** Linux (Arch without SystemD). It is 64-bit operating system based on Arch Linux. Instructions should work on all POSIX systems. Only difference is getting needed packages.
  58.  
  59. ## Working Directory
  60.  
  61. Create directory where you will keep all the files.
  62.  
  63. ```bash
  64. mkdir ~/my-floppy-distro/
  65. BASE=~/my-floppy-distro/
  66. cd $BASE
  67. ```
  68.  
  69. ## Host OS Requirements
  70.  
  71. > You need supporting software to build things. This exact list may vary depending on the system you have.
  72.  
  73. Install needed software/libs. On Artix:
  74.  
  75. ```bash
  76. sudo pacman -S ncurses bc flex bison syslinux cpio
  77. ```
  78.  
  79. Cross-compiler:
  80.  
  81. ```bash
  82. wget https://musl.cc/x86_64-linux-musl-cross.tgz
  83. tar -xvf ./x86_64-linux-musl-cross.tgz
  84. rm ./x86_64-linux-musl-cross.tgz
  85. ```
  86.  
  87. ### Emulation
  88.  
  89. > 86Box is also good but slower. Bochs is the best but for debugging, not needed here.
  90.  
  91. For emulation I will be using qemu.
  92.  
  93. ```bash
  94. sudo pacman -S qemu-full
  95. ```
  96.  
  97. **NOTE: keep in mind that the nested virtualization of x86_64 may not work, especially if you are trying to use QEMU under VirtualBox**
  98.  
  99. ## Kernel
  100.  
  101. Get the sources for the latest compatible **kernel 6.18.7**:
  102.  
  103. ```bash
  104. git clone --depth=1 --branch v6.18.7 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
  105. cd ./linux/
  106. ```
  107.  
  108. Now, that you have them in **linux/** directory lets configure and build our custom kernel. First create tiniest base configuration:
  109.  
  110. ```bash
  111. make ARCH=x86_64 tinyconfig
  112. ```
  113.  
  114. > This is a bootstrap with absolute minimum features. Just enough to boot the system. We want a little bit more.
  115.  
  116. Add additonal config settings on top of it:
  117.  
  118. ```bash
  119. make ARCH=x86_64 menuconfig
  120. ```
  121. Important: Do not uncheck anything in options unless specified so. Some of those options are important. You can uncheck but on your own risk.
  122.  
  123. From menus choose those options:
  124.  
  125. - General Setup
  126. - Configure standard kernel features (expert users)
  127. - Enable support for printk: CONFIG_PRINTK
  128. - Kernel compression mode: CONFIG_KERNEL_XZ -> CONFIG_KERNEL_LZMA
  129. **ACTUALLY NO, CONFIG_KERNEL_XZ IS SLIGHTLY BETTER: 2171904 vs 2274304 for the extended build**
  130. - Initial RAM filesystem and RAM disk (initramfs/initrd)
  131. - Support initial ramdisk/ramfs compressed using LZMA CONFIG_RD_LZMA and **uncheck everything else**
  132. - Enable the block layer: CONFIG_BLOCK
  133. - Executable file formats
  134. - Kernel support for ELF binaries: CONFIG_BINFMT_ELF
  135. - Kernel support for scripts starting with #!: CONFIG_BINFMT_SCRIPT
  136. - Bus options:
  137. - ISA-style DMA support: ISA_DMA_API (for ARCH_MAY_HAVE_PC_FDC for CONFIG_BLK_DEV_FD)
  138. - Device Drivers:
  139. - Block devices
  140. - Normal floppydisk support: CONFIG_BLK_DEV_FD (depends on ISA_DMA_API for ARCH_MAY_HAVE_PC_FDC)
  141. - RAM block device support: CONFIG_BLK_DEV_RAM
  142. - Default number of RAM disk: 1 (CONFIG_BLK_DEV_RAM_COUNT)
  143. - Character devices
  144. - Enable TTY: CONFIG_TTY
  145. - File systems
  146. - DOS/FAT/EXFAT/NT Filesystems
  147. - MSDOS fs support: CONFIG_MSDOS_FS
  148. - Pseudo filesystems
  149. - /proc file system support: CONFIG_PROC_FS
  150. - sysfs file system support: CONFIG_SYSFS
  151. - Native language support
  152. - Codepage 437: CONFIG_NLS_CODEPAGE_437
  153. - Library routines
  154. - LZMA decompression: CONFIG_DECOMPRESS_LZMA) (selected by RD_LZMA && BLK_DEV_INITRD)
  155.  
  156. Exit configuration (yes, save settings to .config).
  157.  
  158. Time for compiling!
  159.  
  160. ### Compile Kernel
  161.  
  162. ```bash
  163. make ARCH=x86_64 bzImage
  164. ```
  165.  
  166. This will take a while depending on the speed of your CPU. In the end the kernel will be created in **arch/x86/boot/** as **bzImage** file.
  167.  
  168. Copy kernel to our **main directory** and **go back to it**:
  169.  
  170. ```bash
  171. rm -f ./../bzImage
  172. cp ./arch/x86_64/boot/bzImage ./../
  173. cd ./../
  174. ```
  175.  
  176. ## Toolset
  177.  
  178. Without tools kernel will just boot and you will not be able to do anything. One of the most popular lightweight tools is BusyBox. It replaces the standard GNU utilities with way smaller but still functional alternatives, perfect for embedded needs.
  179.  
  180. Get the **1.37.0** version from busybox.net or Github mirror. Download the file, extract it, and change directory:
  181.  
  182. > Remember to be in the working directory.
  183.  
  184. ```bash
  185. git clone --branch 1_37_stable https://git.busybox.net/busybox.git
  186. cd ./busybox/
  187. ```
  188.  
  189. As with kernel you need to create starting configuration:
  190.  
  191. ```bash
  192. make ARCH=x86_64 allnoconfig
  193. ```
  194.  
  195. > You may skip this following fix if you are building on Debian/Fedora
  196.  
  197. Fix for **Arch Linux based distributions**:
  198.  
  199. ```bash
  200. sed -i 's/main() {}/int main() {}/' ./scripts/kconfig/lxdialog/check-lxdialog.sh
  201. ```
  202.  
  203. > Now the fun part. You need to **choose what tools you want**. Each menu entry will show how much more KB will be taken if you choose it. So choose it wisely :) For the first time use my selection.
  204.  
  205. Run the configurator:
  206.  
  207. ```bash
  208. make ARCH=x86_64 menuconfig
  209. ```
  210.  
  211. Choose the following options. Remember to **do not uncheck** anything if not stated here.
  212.  
  213. - Settings
  214. - Support files > 2 GB: CONFIG_LFS
  215. - Build static binary (no shared libs): CONFIG_STATIC
  216. - Coreutils
  217. - cat: CONFIG_CAT
  218. - cp: CONFIG_CP
  219. - df: CONFIG_DF
  220. - echo: CONFIG_ECHO
  221. - ln: CONFIG_LN
  222. - ls: CONFIG_LS
  223. - mkdir: CONFIG_MKDIR
  224. - mv: CONFIG_MV
  225. - rm: CONFIG_RM
  226. - sync: CONFIG_SYNC
  227. - test: CONFIG_TEST
  228. - test as [: CONFIG_TEST1
  229. - test as [[: CONFIG_TEST2
  230. - Console Utilities
  231. - clear: CONFIG_CLEAR
  232. - Editors
  233. - vi: CONFIG_VI
  234. - Init Utilities
  235. - init: CONFIG_INIT
  236. - **uncheck** everything else (inside init: keep [*] only on init in this page)
  237. - Linux System Utilities
  238. - mdev: CONFIG_MDEV
  239. - mount: CONFIG_MOUNT
  240. - Support lots of -o flags: CONFIG_FEATURE_MOUNT_FLAGS
  241. - **uncheck** everything else
  242. - setsid: CONFIG_SETSID
  243. - umount: CONFIG_UMOUNT
  244. - Miscellaneous Utilities
  245. - **uncheck** readahead: CONFIG_READAHEAD
  246. - Shells
  247. - Choose alias as (ash): CONFIG_SH_IS_ASH
  248. - ash: CONFIG_ASH
  249. - Optimize for size instead of speed: ASH_OPTIMIZE_FOR_SIZE
  250. - Alias support: ASH_ALIAS
  251. - cttyhack: CONFIG_CTTYHACK
  252. <!--- Help support-->
  253.  
  254. Now exit with save config.
  255.  
  256. ### Cross Compiler Setup
  257.  
  258. > Our target system needs to be 64-bit MUSL. To compile it on 64-bit no-MUSL system we need a cross compiler. You can setup this by hand in the menuconfig or just copy and paste those four lines.
  259.  
  260. Setup paths:
  261.  
  262. ```bash
  263. BASE=~/my-floppy-distro/
  264. sed -i "s|.*CONFIG_CROSS_COMPILER_PREFIX.*|CONFIG_CROSS_COMPILER_PREFIX=\"${BASE}/x86_64-linux-musl-cross/bin/x86_64-linux-musl-\"|" ./.config
  265.  
  266. sed -i "s|.*CONFIG_SYSROOT.*|CONFIG_SYSROOT=\"${BASE}/x86_64-linux-musl-cross\"|" ./.config
  267.  
  268. sed -i "s|.*CONFIG_EXTRA_CFLAGS.*|CONFIG_EXTRA_CFLAGS=\"-I$BASE/x86_64-linux-musl-cross/include\"|" ./.config
  269.  
  270. sed -i "s|.*CONFIG_EXTRA_LDFLAGS.*|CONFIG_EXTRA_LDFLAGS=\"-L$BASE/x86_64-linux-musl-cross/lib\"|" ./.config
  271. ```
  272.  
  273. ### Compile BusyBox
  274.  
  275. Build tools and create base filesystem ("install"). It will ask for options, just **press enter** for default for all of them.
  276.  
  277. ```bash
  278. BASE=~/my-floppy-distro/
  279. make ARCH=x86_64
  280. rm -rf ./_install/
  281. make ARCH=x86_64 install
  282. ```
  283.  
  284. This will create a filesystem with all the files at **_install/**. Move it to our main directory. I like to rename it to.
  285.  
  286. Lastly to to that new directory.
  287.  
  288. ```bash
  289. sudo rm -rf ./../filesystem
  290. cp -r ./_install/ ./../filesystem
  291. cd ./../filesystem
  292. ```
  293.  
  294. ## Filesystem
  295.  
  296. You got kernel and basic tools but the system still needs some additional directory structure.
  297.  
  298. > This created minimum viable directory structure for satisfying the basic requirements of a Linux system.
  299.  
  300. > Remember to be in the filesystem/ directory.
  301.  
  302. ```bash
  303. mkdir -pv {dev,proc,etc/init.d,sys,tmp,home}
  304. sudo mknod ./dev/console c 5 1
  305. sudo mknod ./dev/null c 1 3
  306. ```
  307.  
  308. Next step is to add minimum configuration files. First one is a welcome message that will be shown after booting.
  309.  
  310. > Here is the first real opportunity to go wild and make this your own signature.
  311.  
  312. ```bash
  313. cat >> ./welcome << EOF
  314. Your welcome message or ASCII art.
  315. EOF
  316. ```
  317.  
  318. Or download my welcome file.
  319.  
  320. ```bash
  321. wget https://krzysztofjankowski.com/floppinux/downloads/0.3.1/welcome
  322. ```
  323.  
  324. It looks like that:
  325.  
  326. ```
  327. $ cat ./welcome
  328.  
  329. _________________
  330. /_/ FLOPPINUX /_/;
  331. / ' boot disk ' //
  332. / '------------' //
  333. / .--------. //
  334. / / / //
  335. .___/_________/__// 2880KiB
  336. '===\_________\==' 3.5"
  337.  
  338. _______FLOPPINUX_V_0.3.1 __________________________________
  339. _______AN_EMBEDDED_SINGLE_FLOPPY_LINUX_DISTRIBUTION _______
  340. _______BY_KRZYSZTOF_KRYSTIAN_JANKOWSKI ____________________
  341. _______2026.01 ____________________________________________
  342. ```
  343.  
  344. > Back to serious stuff. Inittab tells the system what to do in critical states like starting, exiting and restarting. It points to the initialization script rc that is the first thing that our OS will run before dropping into the shell.
  345.  
  346. Create an inittab file:
  347.  
  348. ```bash
  349. cat >> ./etc/inittab << EOF
  350. ::sysinit:/etc/init.d/rc
  351. ::askfirst:/usr/bin/setsid /bin/cttyhack /bin/sh
  352. ::respawn:/usr/bin/setsid /bin/cttyhack /bin/sh
  353. ::restart:/sbin/init
  354. ::ctrlaltdel:/sbin/reboot
  355. ::shutdown:/bin/umount -a -r
  356. EOF
  357. ```
  358.  
  359. And the init rc script:
  360.  
  361. ```bash
  362. cat >> ./etc/init.d/rc << EOF
  363. #!/bin/sh
  364. mount -t proc none /proc
  365. mount -t sysfs none /sys
  366. mdev -s
  367. ln -s /proc/mounts /etc/mtab
  368. mkdir -p /mnt /home
  369. mount -t msdos -o rw /dev/fd0 /mnt
  370. mkdir -p /mnt/data
  371. mount --bind /mnt/data /home
  372. clear
  373. cat ./welcome
  374. cd /home/
  375. /usr/bin/setsid /bin/cttyhack /bin/sh
  376. EOF
  377. ```
  378.  
  379. Make the script executable and owner of all files to root:
  380.  
  381. ```bash
  382. chmod +x ./etc/init.d/rc
  383. sudo chown -R root:root ./
  384. ```
  385.  
  386. Compress this directory into one file. Then go back to working directory.
  387.  
  388. ```bash
  389. rm -f ./../rootfs.cpio.lzma
  390. find . | cpio -H newc -o | xz --format=lzma --check=crc32 --lzma1=dict=512KiB,preset=9e > ./../rootfs.cpio.lzma
  391. cd ./../
  392. ls -al ./rootfs.cpio.lzma
  393. ```
  394.  
  395. Create booting configuration.
  396.  
  397. > Another place to tweak parameters for your variant. Text after SAY is what will be displayed on the screen as first, usualy a name of the OS.
  398.  
  399. > The tsc=unstable is useful on some (real) computers to get rid of randomly shown warnings about Time Stamp Counter.
  400.  
  401. > Remember to be in the working directory.
  402.  
  403. ```bash
  404. rm -f ./syslinux.cfg
  405. cat >> ./syslinux.cfg << EOF
  406. DEFAULT floppinux
  407. LABEL floppinux
  408. SAY [ BOOTING FLOPPINUX VERSION 0.3.1 ]
  409. KERNEL bzImage
  410. INITRD rfscpiol.zma
  411. APPEND root=/dev/ram rdinit=/etc/init.d/rc console=tty0 tsc=unstable
  412. EOF
  413. ```
  414.  
  415. Make it executable:
  416.  
  417. ```bash
  418. chmod +x ./syslinux.cfg
  419. ```
  420.  
  421. Create sample file
  422.  
  423. > To make the system a little bit more user friendly I like to have a sample file that user will be able to read and edit. You can put anything you want in it. A simple help would be also a good idea to include.
  424.  
  425. ```bash
  426. rm -f ./hello.txt
  427. cat >> ./hello.txt << EOF
  428. Hello, FLOPPINUX user!
  429. EOF
  430. ```
  431.  
  432. Filesystem is ready. Final step is to **put this all on a floppy**!
  433.  
  434. ## Boot Image
  435.  
  436. First we need an empty file in exact size of a floppy disk. Then format and make it bootable.
  437.  
  438. Create empty floppy image:
  439.  
  440. ```bash
  441. rm -f ./floppinux.img
  442. dd if=/dev/zero of=./floppinux.img bs=1k count=2880
  443. ```
  444.  
  445. Format it and create bootloader:
  446.  
  447. ```bash
  448. mkdosfs -n FLOPPINUX ./floppinux.img
  449. syslinux --install ./floppinux.img
  450. ```
  451.  
  452. Mount it and copy syslinux, kernel, and filesystem onto it:
  453.  
  454. ```bash
  455. sudo mount -o loop ./floppinux.img /mnt
  456. sudo mkdir /mnt/data
  457. sudo cp ./hello.txt /mnt/data/
  458. sudo cp ./bzImage /mnt
  459. sudo cp ./rootfs.cpio.lzma /mnt/rfscpiol.zma
  460. sudo cp ./syslinux.cfg /mnt
  461. df -h
  462. sudo umount /mnt
  463. ```
  464.  
  465. Done!
  466.  
  467. ### Test in emulator
  468.  
  469. It's good to test before wasting time for the real floppy to burn.
  470.  
  471. Boot the new OS in qemu:
  472.  
  473. ```bash
  474. qemu-system-x86_64 -fda floppinux.img
  475. ```
  476.  
  477. If it worked that means You have successfully created your own distribution! Congratulations!
  478.  
  479. The **floppinux.img** image is ready to burn onto a floppy and boot on real hardware!
  480.  
  481. ## Floppy Disk
  482.  
  483. ### <!> Important <!>
  484.  
  485. Change XXX to floppy drive name in your system. In my case it is **sdb**. Choosing wrongly will **NUKE YOUR PARTITION** and **REMOVE** all of your files! Think twice. Or use some GUI application for that.
  486.  
  487. ```bash
  488. sudo dd if=./floppinux.img of=/dev/XXX bs=512 conv=notrunc,sync,fsync iflag=nocache oflag=direct status=progress
  489. ```
  490.  
  491. After 5 minutes I got freshly burned floppy.
  492.  
  493. ## Debugging
  494.  
  495. If you need more verbose logging use those syslinux.cfg settings.
  496.  
  497. ```
  498. rm -f ./syslinux.cfg
  499. cat >> ./syslinux.cfg << EOF
  500. DEFAULT floppinux
  501. LABEL floppinux
  502. SAY [ BOOTING FLOPPINUX VERSION 0.3.1 DEBUG ]
  503. KERNEL bzImage
  504. INITRD rfscpiol.zma
  505. APPEND root=/dev/ram rdinit=/etc/init.d/rc console=tty0 ignore_loglevel earlyprintk=tty0 loglevel=8 tsc=unstable
  506. EOF
  507. ```
  508.  
  509. ## Summary
  510.  
  511. - FLOPPINUX: **0.3.1.x64mod** (January 2026)
  512. - Linux Kernel: **6.18.7**
  513. - Busybox: **1.37.0**
  514. - Image size: 2880KiB / 2.88MiB
  515. - Kernel size: 1069KiB (bzImage) - minimal
  516. - Tools: 131KiB (rfscpiol.zma) - minimal
  517. - Free space left (df -h): **1486KiB**
  518.  
  519. ### System Tools
  520.  
  521. #### File & Directory Manipulation
  522. - ```cat``` - display file contents
  523. - ```cp``` - copy files and directories
  524. - ```mv``` - move/rename files and directories
  525. - ```rm``` - remove files and directories
  526. - ```ls``` - list directory contents
  527. - ```mkdir``` - creates directory
  528.  
  529. #### System Information & Management
  530. - ```df -h``` - display filesystem disk space usage
  531. - ```sync``` - force write of buffered data to disk - use this after any changes to the floppy filesystem
  532. - ```mount``` - mount filesystems
  533. - ```umount``` - unmount filesystems
  534.  
  535. #### Text Processing & Output
  536. - ```echo``` - display text output
  537. - ```more``` - page through text output
  538.  
  539. #### Utilities
  540. - ```clear``` - clear terminal screen
  541. - ```test``` - evaluate conditional expressions
  542.  
  543. ### Applications
  544.  
  545. - ```vi``` - text editor
  546.  
  547. ## Download
  548.  
  549. - [FLOPPINUX 0.3.1 Floppy Image 1.44MB](http://krzysztofjankowski.com/floppinux/downloads/0.3.1/floppinux.img)
  550.  
  551. ---
  552.  
  553. ```
  554. _________________
  555. /_/ FLOPPINUX /_/;
  556. / ' boot disk ' //
  557. / '------------' //
  558. / .--------. //
  559. / / / //
  560. .___/_________/__// 2880KiB
  561. '===\_________\==' 3.5"
  562.  
  563.  
  564. Now go and make something fun with it!
  565. ```
  566.  
  567. **FLOPPINUX - An Embedded Single Floppy Linux Distribution**
  568. **By Krzysztof Krystian Jankowski**
  569. **2026.01**
  570.  
Advertisement
Add Comment
Please, Sign In to add comment