MrRockchip

megaflop

Feb 9th, 2026
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.88 KB | None | 0 0
  1. # FLOPPINUX - An Embedded 🐧Linux on a Single 💾Floppy
  2. ## 2026 Edition (v0.3.1-amd64net)
  3.  
  4. - v0.3.1-amd64net - **February 09, 2026**
  5. - v0.3.1 - **December 21, 2025**
  6. - v0.3.0 - **October 19, 2025**
  7.  
  8. ---
  9.  
  10. **This is a modified floppinux "amd64net" distribution. It is primarily aimed for embedding as a virtual floppy into the opensource coreboot BIOS of supported AMD PCs ( more information here - http://dangerousprototypes.com/docs/Lenovo_G505S_hacking ), however it may be used for other needs as well. Main features:
  11.  
  12. - Architecture changes
  13. - 2.88 MB floppy image for AMD PCs of x86_64 architecture (seems to work fine in VirtualBox too), with many AMD-specific features enabled
  14. - Intel CPU support is disabled to save space, however you may re-enable it at cost of something else and use this distro on your Intel
  15. - Microcode loading is disabled because thanks to opensource coreboot BIOS I don't need this space-taking feature at my operating system
  16. - Device support
  17. - Ethernet
  18. - Qualcomm/Atheros AR8161/AR8162/QCA8171/QCA8172 - found in coreboot-supported AMD Lenovo G505S laptop
  19. - Realtek RTL8111/RTL8168/RTL8169/RTL8101/RTL8125 - found in coreboot-supported ASUS A88XM-E & AM1I-A desktops and dirt cheap PCIe Ethernet cards
  20. - WiFi
  21. - Atheros ath9k family of PCIe WiFi adapters, such as AR9462 that works on 100% opensource without any firmware
  22. - Atheros ath9k_htc family of USB WiFi adapters, such as AR9271 that seems to need a firmware for unknown reasons
  23. - ACPI:
  24. - Had to enable it in order for AR9271 USB WiFi to work on coreboot-supported AMD Lenovo G505S laptop, at cost of disabling printk because this ACPI is way too fat
  25. - Software additions
  26. - wpa_supplicant and wpa_cli
  27. - This standalone software is essential for connecting to WiFi networks with the supported WiFi adapters
  28. - Dropbear ssh and scp
  29. - This standalone software is essential for connecting to other PCs over SSH protocol and therefore providing a "thin client" functionality
  30. - Kirc IRC client
  31. - This standalone software is essential for connecting to IRC servers and communicating with other people
  32.  
  33. Also, I have fixed many bugs like a frozen ping _(had to enable more timer-related features)_ and Ctrl+C/Ctrl+Z interrupts _(changes related to TTY and job control)_.
  34.  
  35. **The instructions below are originally provided by @w84death and have been heavily modded by me for this "amd64net" distribution.**
  36.  
  37. > 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.
  38.  
  39. ## Table of Contents
  40.  
  41. - [Main Project Goals](#main-project-goals)
  42. - [Core Features](#core-features)
  43. - [Linux Kernel](#linux-kernel)
  44. - [64-bit Base OS](#64-bit-base-os)
  45. - [Working Directory](#working-directory)
  46. - [Host OS Requirements](#host-os-requirements)
  47. - [System Requirements](#system-requirements)
  48. - [Emulation](#emulation)
  49. - [Compile Kernel](#compile-kernel)
  50. - [Toolset](#toolset)
  51. - [Filesystem](#filesystem)
  52. - [Boot Image](#boot-image)
  53. - [Floppy Disk](#floppy-disk)
  54. - [Summary](#summary)
  55. - [Download](#download)
  56.  
  57. ## Main Project Goals
  58.  
  59. Think of this as Linux From Scratch but for making single floppy distribution.
  60.  
  61. > 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.
  62.  
  63. 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 to a Linux terminal, edit files, and create simple scripts. There is 264KB of space left for your newly created files.
  64.  
  65. ## Core Features
  66.  
  67. - Fully working distribution booting from the single 2.88 MB floppy
  68. - Latest Linux kernel
  69. - Supporting AMD x86_64 CPUs
  70. - Have a working text editor (Vi) and basic file manipulation commands (move, rename, delete, etc.)
  71. - Have a basic Ethernet/WiFi networking
  72. - Support for simple scripting
  73. - Persistent storage on the floppy to actualy save files
  74. - Works on real hardware and emulation
  75.  
  76. ## Linux Kernel
  77.  
  78. **6.18.9** (released February 2026) is the latest version at the time of writing with full compatibility.
  79.  
  80. ## 64-bit Base OS
  81.  
  82. This time I will do everything on **Artix** Linux _(Arch without SystemD)_. It is 64-bit operating system based on Arch Linux with a true init freedom. Instructions should work on all POSIX systems. Only difference is getting needed packages.
  83.  
  84. ## Working Directory
  85.  
  86. **To avoid the possible issues with `~`, I will be using the absolute pathes for `artix` user. If you want these instructions to be copy-paste'able AS-IS, temporarily make a symbolic link:**
  87.  
  88. ```bash
  89. cd /home/
  90. sudo ln -s ./my_username/ ./artix
  91. cd ./artix/
  92. ```
  93.  
  94. Create directory where you will keep all the files.
  95.  
  96. ```bash
  97. mkdir /home/artix/my-floppy-distro/
  98. cd /home/artix/my-floppy-distro/
  99. ```
  100.  
  101. ## Host OS Requirements
  102.  
  103. > You need supporting software to build things. This exact list may vary depending on the system you have.
  104.  
  105. Install needed software/libs. On Artix:
  106.  
  107. ```bash
  108. sudo pacman -S bc bison cmocka coreutils cpio curl flex gcc m4 make mtools ncurses nss openssl p7zip patch pkgconf syslinux unzip wget xxd zlib git
  109. ```
  110.  
  111. You will also have to enable the Arch Linux "extra" repository in order to get the `sstrip` utility for reducing the ELF file sizes:
  112.  
  113. ```bash
  114. sudo pacman -S artix-archlinux-support
  115. sudo pacman-key --populate archlinux
  116. sudo nano /etc/pacman.conf
  117. ---
  118. ==> Add the arch repos in pacman.conf:
  119.  
  120. #[extra-testing]
  121. #Include = /etc/pacman.d/mirrorlist-arch
  122.  
  123.  
  124. [extra]
  125. Include = /etc/pacman.d/mirrorlist-arch
  126.  
  127.  
  128. #[multilib-testing]
  129. #Include = /etc/pacman.d/mirrorlist-arch
  130.  
  131.  
  132. #[multilib]
  133. #Include = /etc/pacman.d/mirrorlist-arch
  134. ---
  135. sudo pacman -Sy
  136. sudo pacman -S elfkickers
  137. ```
  138.  
  139. Cross-compiler:
  140.  
  141. ```bash
  142. wget https://musl.cc/x86_64-linux-musl-cross.tgz
  143. tar -xvf ./x86_64-linux-musl-cross.tgz
  144. ```
  145.  
  146. ## System Requirements
  147.  
  148. - AMD x86_64 CPU _(you could switch to Intel with a Linux kernel config change)_
  149. - 32MB RAM _(approximately, rounded up to a degree of 2, needs to be tested)_
  150. - 2.88MB ED Floppy disk , either virtual _(part of coreboot+SeaBIOS)_ or physical
  151.  
  152. ## Emulation
  153.  
  154. > 86Box is also good but slower. Bochs is the best but for debugging, not needed here.
  155.  
  156. For emulation you may use qemu.
  157.  
  158. ```bash
  159. sudo pacman -S qemu-full
  160. ```
  161.  
  162. Alternatively, VirtualBox may be used.
  163.  
  164. ```bash
  165. sudo pacman -S virtualbox
  166. ```
  167.  
  168. ## Kernel
  169.  
  170. Get the sources for the latest compatible **kernel 6.18.9**:
  171.  
  172. ```bash
  173. git clone --depth=1 --branch v6.18.9 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
  174.  
  175. ```
  176.  
  177. After switching to a `./linux/` directory, replace the non-0 optimization flags with -Oz for an aggressive size optimization:
  178.  
  179. ```bash
  180. cd ./linux/
  181. mv ./.git/ ./../temp.git/ # Temporarily move ./.git/ to avoid damaging its contents in the process
  182. find . -type f -print0 | xargs -0 sed -i -e "s/-O1/-Oz/g"
  183. find . -type f -print0 | xargs -0 sed -i -e "s/-O2/-Oz/g"
  184. find . -type f -print0 | xargs -0 sed -i -e "s/-O3/-Oz/g"
  185. find . -type f -print0 | xargs -0 sed -i -e "s/-Os/-Oz/g"
  186. mv ./../temp.git/ ./.git/
  187. ```
  188.  
  189. In order for your further changes to be easily noticeable, lets make a local commit of these "-Oz" changes. Check your `.gitconfig` contents:
  190. ```bash
  191. cat /home/artix/.gitconfig
  192. ```
  193.  
  194. If it is empty, do the following setup:
  195.  
  196. ```bash
  197. git config --global user.name "Your Name"
  198. git config --global user.email "[email protected]"
  199. ```
  200.  
  201. Now, lets commit the changes:
  202.  
  203. ```bash
  204. git add .
  205. git commit -m "Upgrade the sources to -Oz optimization"
  206. ```
  207.  
  208. Disable the microcode loading:
  209.  
  210. ```bash
  211. leafpad ./arch/x86/Kconfig
  212. # Scroll down to line 1320
  213. ---
  214. config MICROCODE
  215. - def_bool y
  216. + def_bool n
  217. depends on CPU_SUP_AMD || CPU_SUP_INTEL
  218. select CRYPTO_LIB_SHA256 if CPU_SUP_AMD
  219. ---
  220. ```
  221.  
  222. Also, disable the networking selftests:
  223.  
  224. ```bash
  225. leafpad ./net/Kconfig
  226. # Scroll down to line 480
  227. ---
  228. config NET_SELFTESTS
  229. - def_tristate PHYLIB
  230. - depends on PHYLIB && INET
  231. + bool
  232. + default n
  233. ---
  234. ```
  235.  
  236. Now, lets configure and build our custom kernel. First create tiniest base configuration:
  237.  
  238. ```bash
  239. make ARCH="x86_64" tinyconfig
  240. ```
  241.  
  242. > This is a bootstrap with absolute minimum features. Just enough to boot the system. We want a little bit more.
  243.  
  244. Add additonal config settings on top of it:
  245.  
  246. ```bash
  247. make ARCH="x86_64" menuconfig
  248. ```
  249. Important: Do not uncheck anything in options unless specified so. Some of those options are important. You can uncheck but on your own risk.
  250.  
  251. From menus choose those options:
  252.  
  253. - Power management and ACPI options
  254. - Device power management core functionality: CONFIG_PM
  255. - ACPI (Advanced Configuration and Power Interface) Support: CONFIG_ACPI
  256. - Disable "Allow upgrading ACPI tables via initrd": CONFIG_ACPI_TABLE_UPGRADE
  257. - Disable "Debug Statements": CONFIG_ACPI_DEBUG
  258. - CPU Frequency scaling
  259. - Disable "Intel P state control": CONFIG_X86_INTEL_PSTATE
  260. - Processor type and features
  261. - Symmetric multi-processing support: CONFIG_SMP
  262. - AMD ACPI2Platform devices support: CONFIG_X86_AMD_PLATFORM_DEVICE
  263. - Supported processor vendors: CONFIG_PROCESSOR_SELECT
  264. - Disable everything except "Support AMD processors": CONFIG_CPU_SUP_AMD
  265. - Performance monitoring
  266. - Disable "Intel/AMD rapl performance events": CONFIG_PERF_EVENTS_INTEL_RAPL
  267. - NUMA Memory Allocation and Scheduler Support: CONFIG_NUMA
  268. - General Setup
  269. - Kernel compression mode: CONFIG_KERNEL_XZ
  270. - Memory placement aware NUMA scheduler: CONFIG_NUMA_BALANCING
  271. - Initial RAM filesystem and RAM disk (initramfs/initrd)
  272. - Original instruction: Support initial ramdisk/ramfs compressed using XZ (CONFIG_RD_XZ) and **uncheck everything else**
  273. - My instruction: Support initial ramdisk/ramfs compressed using LZMA (CONFIG_RD_LZMA) and **uncheck everything else** (LZMA for rootfs gave me better results than XZ)
  274. - Configure standard kernel features (expert users)
  275. - Original instruction: Enable support for printk: CONFIG_PRINTK
  276. - My instruction: Do not enable support for printk (CONFIG_PRINTK) because it is way too fat
  277. - Posix Clocks & timers: CONFIG_POSIX_TIMERS
  278. - Enable futex support: CONFIG_FUTEX
  279. - Enable eventpoll support: CONFIG_EPOLL
  280. - Bus options
  281. - ISA-style DMA support: ISA_DMA_API (for ARCH_MAY_HAVE_PC_FDC for CONFIG_BLK_DEV_FD)
  282. - Enable the block layer: CONFIG_BLOCK
  283. - Executable file formats
  284. - Kernel support for ELF binaries: CONFIG_BINFMT_ELF
  285. - Kernel support for scripts starting with #!: CONFIG_BINFMT_SCRIPT
  286. - Memory Management options
  287. - Disable "Support for paging of anonymous memory (swap)": CONFIG_SWAP
  288. - Networking support: CONFIG_NET
  289. - Networking options
  290. - Packet socket: CONFIG_PACKET
  291. - Unix domain sockets: CONFIG_UNIX
  292. - TCP/IP networking: CONFIG_INET
  293. - Disable "INET: socket monitoring interface": CONFIG_INET_DIAG
  294. - Disable "The IPv6 protocol": CONFIG_IPV6
  295. - Disable "Receive packet steering": CONFIG_RPS
  296. - Wireless: CONFIG_WIRELESS
  297. - cfg80211 - wireless configuration API: CONFIG_CFG80211
  298. - Disable "Support CRDA": CONFIG_CFG80211_CRDA_SUPPORT
  299. - Generic IEEE 802.11 Networking Stack (mac80211): CONFIG_MAC80211
  300. - cfg80211 certification onus: CONFIG_CFG80211_CERTIFICATION_ONUS
  301. - Disable "require regdb signature": CONFIG_CFG80211_REQUIRE_SIGNED_REGDB
  302. - Disable "Netlink interface for ethtool": CONFIG_ETHTOOL_NETLINK
  303. - Device Drivers
  304. - PCI Support: CONFIG_PCI
  305. - Disable "VGA Arbitration": CONFIG_VGA_ARB
  306. - Generic Driver Options
  307. - Maintain a devtmpfs filesystem to mount at /dev: CONFIG_DEVTMPFS
  308. - Automount devtmpfs at /dev, after the kernel mounted the rootfs: CONFIG_DEVTMPFS_MOUNT
  309. - Block devices
  310. - Normal floppydisk support: CONFIG_BLK_DEV_FD (depends on ISA_DMA_API for ARCH_MAY_HAVE_PC_FDC)
  311. - RAM block device support: CONFIG_BLK_DEV_RAM
  312. - Default number of RAM disk: 1 (CONFIG_BLK_DEV_RAM_COUNT)
  313. - Misc devices
  314. - Disable "Intel Management Engine Interface": CONFIG_INTEL_MEI
  315. - USB support: CONFIG_USB_SUPPORT
  316. - Support for Host-side USB: CONFIG_USB
  317. - EHCI HCD (USB 2.0) support: CONFIG_USB_EHCI_HCD
  318. - OHCI HCD (USB 1.1) support: CONFIG_USB_OHCI_HCD
  319. - Network device support: CONFIG_NETDEVICES
  320. - Disable "Network core driver support": CONFIG_NET_CORE
  321. - Ethernet driver support: CONFIG_ETHERNET
  322. - **Uncheck everything there before proceeding**
  323. - AMD devices: CONFIG_NET_VENDOR_AMD
  324. - AMD PCnet32 PCI support: CONFIG_PCNET32 (for VirtualBox)
  325. - Atheros devices: CONFIG_NET_VENDOR_ATHEROS
  326. - Qualcomm Atheros AR816x/AR817x support: CONFIG_ALX
  327. - Realtek devices: CONFIG_NET_VENDOR_REALTEK
  328. - Realtek 8169/8168/8101/8125 ethernet support: CONFIG_R8169 (also supports 8111)
  329. - Wireless LAN: CONFIG_WLAN
  330. - **Uncheck everything there before proceeding**
  331. - Atheros/Qualcomm devices: CONFIG_WLAN_VENDOR_ATH
  332. - Atheros 802.11n wireless cards support: CONFIG_ATH9K
  333. - Disable "Atheros bluetooth coexistence support": CONFIG_ATH9K_BTCOEX_SUPPORT (we did not enable the Bluetooth of AR9462 card)
  334. - Atheros ath9k ACK timeout estimation algorithm: CONFIG_ATH9K_DYNACK
  335. - Atheros HTC based wireless cards support: CONFIG_ATH9K_HTC
  336. - Input device support
  337. - Generic input layer (needed for keyboard, mouse, ...): CONFIG_INPUT
  338. - Mice: CONFIG_INPUT_MOUSE
  339. - Elantech PS/2 protocol extension: CONFIG_MOUSE_PS2_ELANTECH (may be a part of AMD Lenovo G505S laptop)
  340. - Hardware I/O ports
  341. - Disable "Serial port line discipline": CONFIG_SERIO_SERPORT
  342. - Character devices
  343. - Enable TTY: CONFIG_TTY
  344. - Disable "Unix98 PTY support": CONFIG_UNIX98_PTYS
  345. - Disable "Legacy (BSD) PTY support": CONFIG_LEGACY_PTYS
  346. - Disable "PPS support": CONFIG_PPS
  347. - PTP clock support
  348. - Disable "PTP clock support": CONFIG_PTP_1588_CLOCK
  349. - Pin controllers: CONFIG_PINCTRL
  350. - AMD GPIO pin control: CONFIG_PINCTRL_AMD
  351. - GPIO support
  352. - Disable "Character device (/dev/gpiochipN) support": CONFIG_GPIO_CDEV
  353. - Thermal drivers
  354. - Disable "Thermal netlink management": CONFIG_THERMAL_NETLINK
  355. - Real Time Clock: CONFIG_RTC_CLASS
  356. - NVMEM Support:
  357. - Disable "/sys/bus/nvmem/devices/*/nvmem (sysfs interface)": CONFIG_NVMEM_SYSFS
  358. - File systems
  359. - DOS/FAT/EXFAT/NT Filesystems
  360. - MSDOS fs support: CONFIG_MSDOS_FS
  361. - Pseudo filesystems
  362. - /proc file system support: CONFIG_PROC_FS
  363. - sysfs file system support: CONFIG_SYSFS
  364. - Disable "Enable /proc page monitoring": CONFIG_PROC_PAGE_MONITOR
  365. - Disable "Network File Systems": CONFIG_NETWORK_FILESYSTEMS
  366. - Native language support
  367. - Codepage 437: CONFIG_NLS_CODEPAGE_437
  368. - Security options
  369. - Disable "Enable access key retention support": CONFIG_KEYS
  370. - Cryptographic API
  371. - Public-key cryptography
  372. - Disable "RSA (Rivest-Shamir-Adleman): CONFIG_CRYPTO_RSA
  373. - Hashes, digests, and MACs
  374. - Disable "SHA-224 and SHA-256": CONFIG_CRYPTO_SHA256
  375. - Disable "Hardware crypto devices": CONFIG_CRYPTO_HW
  376. - Disable "Asymmetric (public-key cryptographic) key type": CONFIG_ASYMMETRIC_KEY_TYPE
  377. - Library routines
  378. - Original instruction: XZ decompression: CONFIG_DECOMPRESS_XZ (selected by RD_XZ && BLK_DEV_INITRD)
  379. - My instruction: LZMA decompression: CONFIG_DECOMPRESS_LZMA (selected by RD_LZMA && BLK_DEV_INITRD)
  380.  
  381. Exit configuration (yes, save settings to .config).
  382.  
  383. Time for compiling!
  384.  
  385. ### Compile Kernel
  386.  
  387. ```bash
  388. make ARCH="x86_64" clean && make ARCH="x86_64" bzImage -j$(nproc) && ls -al ./arch/x86_64/boot/bzImage
  389. ```
  390.  
  391. 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.
  392.  
  393. Copy kernel to our **main directory** and **go back to it**:
  394.  
  395. ```bash
  396. cp ./arch/x86_64/boot/bzImage ./../
  397. cd ./../
  398. ```
  399.  
  400. ## Dropbear
  401.  
  402. ```bash
  403. git clone --depth=1 --branch DROPBEAR_2025.89 https://github.com/mkj/dropbear.git
  404. cd ./dropbear/
  405. make clean
  406. make distclean
  407. export CC="/home/artix/my-floppy-distro/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc"
  408. ./configure --host=x86_64-linux-musl --prefix=/usr --enable-static --disable-zlib --disable-syslog --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx --disable-shadow --enable-bundled-libtom CC='/home/artix/my-floppy-distro/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc' \
  409. CFLAGS='-static -Os -s -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -fomit-frame-pointer -fmerge-all-constants -fno-ident -fno-math-errno -fno-unroll-loops -ffast-math -fno-plt -fno-exceptions -march=x86-64 -mtune=generic -fno-align-functions -fno-align-jumps -fno-align-loops -fno-align-labels -I/home/artix/my-floppy-distro/x86_64-linux-musl-cross/include --sysroot=/home/artix/my-floppy-distro/x86_64-linux-musl-cross' \
  410. LDFLAGS='-L/home/artix/my-floppy-distro/x86_64-linux-musl-cross/lib -L/home/artix/my-floppy-distro/x86_64-linux-musl-cross/x86_64-linux-musl/lib -static -s -Wl,--gc-sections -Wl,--strip-all -Wl,--build-id=none -Wl,-z,norelro -Wl,--hash-style=sysv -Wl,--no-eh-frame-hdr -Wl,-z,noseparate-code -Wl,--no-undefined-version -Wl,--as-needed -Wl,--sort-common -Wl,--sort-section=alignment -Wl,--compress-debug-sections=none -Wl,--warn-common -Wl,--discard-all -Wl,--discard-locals -Wl,--no-ld-generated-unwind-info -Wl,--orphan-handling=place -no-pie -L/home/artix/my-floppy-distro/x86_64-linux-musl-cross/lib --sysroot=/home/artix/my-floppy-distro/x86_64-linux-musl-cross'
  411. unset CC
  412. make dbclient scp
  413. sstrip ./dbclient
  414. sstrip ./scp
  415. ls -al ./dbclient
  416. ls -al ./scp
  417. cd ./../
  418. ```
  419.  
  420. ## WPA Supplicant
  421.  
  422. libnl-tiny
  423.  
  424. ```bash
  425. git clone --depth=1 https://github.com/openwrt/libnl-tiny.git
  426. cd ./libnl-tiny/
  427. wget https://raw.githubusercontent.com/mikebdp2/floppinux-amd64net/refs/heads/main/libnl-tiny.patch
  428. patch -p1 < ./libnl-tiny.patch
  429. rm -rf ./build/
  430. mkdir ./build/
  431. cd ./build/
  432. cmake -DCMAKE_INSTALL_PREFIX=/home/artix/my-floppy-distro/x86_64-linux-musl-cross/usr/ ..
  433. make
  434. make install
  435. cd ./../
  436. rm -rf ./build-tc/
  437. mv ./build/ ./build-tc/
  438. mkdir ./build/
  439. cd ./build/
  440. cmake -DCMAKE_INSTALL_PREFIX=/usr/ ..
  441. make
  442. sudo make install
  443. cd ./../
  444. rm -rf ./build-rt/
  445. mv ./build/ ./build-rt/
  446. wget https://raw.githubusercontent.com/mikebdp2/floppinux-amd64net/refs/heads/main/libnl-tiny_ucred.patch
  447. cd ./../
  448. cd /usr/include/libnl-tiny/
  449. sudo patch -p1 < /home/artix/my-floppy-distro/libnl-tiny/libnl-tiny_ucred.patch
  450. cd /home/artix/my-floppy-distro/x86_64-linux-musl-cross/usr/include/libnl-tiny/
  451. patch -p1 < /home/artix/my-floppy-distro/libnl-tiny/libnl-tiny_ucred.patch
  452. cd /home/artix/my-floppy-distro/
  453. ```
  454.  
  455. wpa_supplicant
  456.  
  457. ```bash
  458. git clone --depth=1 --branch hostap_2_11 https://git.w1.fi/hostap.git
  459. cd ./hostap/
  460. wget --output-document=./wpa_libs.patch https://git.w1.fi/cgit/hostap/patch/?id=c13c7b6a1db3361dccc146719f0c676bc975af2e
  461. patch -p1 < ./wpa_libs.patch
  462. wget https://raw.githubusercontent.com/mikebdp2/floppinux-amd64net/refs/heads/main/wpa_makefile.patch
  463. patch -p1 < ./wpa_makefile.patch
  464. wget https://raw.githubusercontent.com/mikebdp2/floppinux-amd64net/refs/heads/main/wpa_supplicant.cfg
  465. mv ./wpa_supplicant.cfg ./wpa_supplicant/.config
  466. cd ./wpa_supplicant/
  467. export CC="/home/artix/my-floppy-distro/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc"
  468. make clean && make CC="$CC" wpa_supplicant wpa_cli
  469. unset CC
  470. sstrip ./wpa_supplicant
  471. sstrip ./wpa_cli
  472. ls -al ./wpa_supplicant
  473. ls -al ./wpa_cli
  474. cd ./../../
  475. ```
  476.  
  477. ## KIRC
  478.  
  479. ```bash
  480. git clone --depth=1 --branch 1.2.2 https://github.com/mcpcpc/kirc.git
  481. cd ./kirc/
  482. wget https://raw.githubusercontent.com/mikebdp2/floppinux-amd64net/refs/heads/main/kirc.patch
  483. patch -p1 < ./kirc.patch
  484. export CC="/home/artix/my-floppy-distro/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc"
  485. make clean && make CC="$CC"
  486. unset CC
  487. sstrip ./kirc
  488. ls -al ./kirc
  489. man ./kirc.1 > ./kirc.txt
  490. cd ./../
  491. ```
  492.  
  493. ## Linux-firmware
  494.  
  495. ```bash
  496. git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  497. ```
  498.  
  499. ## Toolset
  500.  
  501. 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.
  502.  
  503. Get the **1.37.0** version from busybox.net or Github mirror. Download the file, extract it, and change directory:
  504.  
  505. > Remember to be in the working directory.
  506.  
  507. ```bash
  508. git clone --depth=1 --branch 1_37_stable https://git.busybox.net/busybox.git
  509. ```
  510.  
  511. After switching to a `./busybox/` directory, replace the O2 optimization flags with -Os for a size optimization: _(musl.cc toolchain's GCC is too old for -Oz)_
  512.  
  513. ```bash
  514. cd ./busybox/
  515. mv ./.git/ ./../temp.git/ # Temporarily move ./.git/ to avoid damaging its contents in the process
  516. find . -type f -print0 | xargs -0 sed -i -e "s/-O2/-Os/g"
  517. mv ./../temp.git/ ./.git/
  518. ```
  519.  
  520. As with kernel you need to create starting configuration:
  521.  
  522. ```bash
  523. make ARCH="x86_64" allnoconfig
  524. ```
  525.  
  526. > You may skip this following fix if you are building on Debian/Fedora
  527.  
  528. Fix for **GCC 14+ Linux based distributions** like Arch:
  529.  
  530. ```bash
  531. sed -i "s/main() {}/int main() {}/" ./scripts/kconfig/lxdialog/check-lxdialog.sh
  532. ```
  533.  
  534. > 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.
  535.  
  536. Run the configurator:
  537.  
  538. ```bash
  539. make ARCH="x86_64" menuconfig
  540. ```
  541.  
  542. Choose the following options. Remember to **do not uncheck** anything if not stated here.
  543.  
  544. - Settings
  545. - Support --long-options: CONFIG_LONG_OPTS
  546. - Support files > 2 GB: CONFIG_LFS
  547. - Build static binary (no shared libs): CONFIG_STATIC
  548. - Use sendfile system call: CONFIG_FEATURE_USE_SENDFILE
  549. - Use clock_gettime(CLOCK_MONOTONIC) syscall: CONFIG_MONOTONIC_SYSCALL
  550. - Coreutils
  551. - cat: CONFIG_CAT
  552. - chmod: CONFIG_CHMOD
  553. - cp: CONFIG_CP
  554. - date: CONFIG_DATE
  555. - df: CONFIG_DF
  556. - echo: CONFIG_ECHO
  557. - ln: CONFIG_LN
  558. - ls: CONFIG_LS
  559. - mkdir: CONFIG_MKDIR
  560. - mv: CONFIG_MV
  561. - pwd: CONFIG_PWD
  562. - rm: CONFIG_RM
  563. - sleep: CONFIG_SLEEP
  564. - sync: CONFIG_SYNC
  565. - test: CONFIG_TEST
  566. - test as [: CONFIG_TEST1
  567. - test as [[: CONFIG_TEST2
  568. - timeout: CONFIG_TIMEOUT
  569. - Console Utilities
  570. - clear: CONFIG_CLEAR
  571. - Editors
  572. - vi: CONFIG_VI
  573. - Init Utilities
  574. - init: CONFIG_INIT
  575. - **uncheck** everything else (inside init: keep [*] only on init in this page)
  576. - Linux System Utilities
  577. - lsusb: CONFIG_LSUSB
  578. - lspci: CONFIG_LSPCI
  579. - mdev: CONFIG_MDEV
  580. - mount: CONFIG_MOUNT
  581. - Support lots of -o flags: CONFIG_FEATURE_MOUNT_FLAGS
  582. - **uncheck** everything else
  583. - setsid: CONFIG_SETSID
  584. - umount: CONFIG_UMOUNT
  585. - Miscellaneous Utilities
  586. - beep: CONFIG_BEEP
  587. - **uncheck** readahead: CONFIG_READAHEAD
  588. - Networking Utilities
  589. - hostname: CONFIG_HOSTNAME
  590. - ifconfig: CONFIG_IFCONFIG
  591. - ifplugd: CONFIG_IFPLUGD
  592. - nslookup: CONFIG_NSLOOKUP
  593. - ping: CONFIG_PING
  594. - route: CONFIG_ROUTE
  595. - wget: CONFIG_WGET
  596. - udhcpc: CONFIG_UDHCPC
  597. - Absolute path to config script (CONFIG_UDHCPC_DEFAULT_SCRIPT): /etc/udhcpc.sh
  598. - Process Utilities
  599. - free: CONFIG_FREE
  600. - kill: CONFIG_KILL
  601. - ps: CONFIG_PS
  602. - pstree: CONFIG_PSTREE
  603. - top: CONFIG_TOP
  604. - uptime: CONFIG_UPTIME
  605. - Shells
  606. - Choose alias as (ash): CONFIG_SH_IS_ASH
  607. - ash: CONFIG_ASH
  608. - Optimize for size instead of speed: CONFIG_ASH_OPTIMIZE_FOR_SIZE
  609. - Job control: CONFIG_ASH_JOB_CONTROL
  610. - Alias support: CONFIG_ASH_ALIAS
  611. - cttyhack: CONFIG_CTTYHACK
  612. <!--- Help support-->
  613.  
  614. Now exit with save config.
  615.  
  616. ### Cross Compiler Setup
  617.  
  618. > 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.
  619.  
  620. Setup paths:
  621.  
  622. ```bash
  623. sed -i "s|.*CONFIG_CROSS_COMPILER_PREFIX.*|CONFIG_CROSS_COMPILER_PREFIX=\"/home/artix/my-floppy-distro/x86_64-linux-musl-cross/bin/x86_64-linux-musl-\"|" ./.config
  624.  
  625. sed -i "s|.*CONFIG_SYSROOT.*|CONFIG_SYSROOT=\"/home/artix/my-floppy-distro/x86_64-linux-musl-cross\"|" ./.config
  626.  
  627. sed -i "s|.*CONFIG_EXTRA_CFLAGS.*|CONFIG_EXTRA_CFLAGS=\"-I/home/artix/my-floppy-distro/x86_64-linux-musl-cross/include -static -Os -s -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -fomit-frame-pointer -fmerge-all-constants -fno-ident -fno-math-errno -fno-unroll-loops -ffast-math -fno-plt -fvisibility=hidden -fno-exceptions -march=x86-64 -mtune=generic -fno-align-functions -fno-align-jumps -fno-align-loops -fno-align-labels\"|" ./.config
  628.  
  629. sed -i "s|.*CONFIG_EXTRA_LDFLAGS.*|CONFIG_EXTRA_LDFLAGS=\"-L/home/artix/my-floppy-distro/x86_64-linux-musl-cross/lib -static -s -Wl,--gc-sections -Wl,--strip-all -Wl,--build-id=none -Wl,-z,norelro -Wl,--hash-style=sysv -Wl,--no-eh-frame-hdr -Wl,-z,noseparate-code -Wl,--no-undefined-version -Wl,--as-needed -Wl,--sort-common -Wl,--sort-section=alignment -Wl,--compress-debug-sections=none -Wl,--warn-common -Wl,--fatal-warnings -Wl,--discard-all -Wl,--discard-locals -Wl,--no-ld-generated-unwind-info -Wl,--orphan-handling=place -no-pie\"|" ./.config
  630. ```
  631.  
  632. ### Compile BusyBox
  633.  
  634. Build tools and create base filesystem ("install"). It will ask for options, just **press enter** for default for all of them.
  635.  
  636. ```bash
  637. make ARCH="x86_64" clean && make ARCH="x86_64" -j$(nproc) && sstrip ./busybox && make ARCH="x86_64" install
  638. ```
  639.  
  640. This will create a filesystem with all the files at `./_install/`. Move it to our main directory with renaming and go to it.
  641.  
  642. ```bash
  643. mv ./_install/ ./../filesystem
  644. cd ./../filesystem/
  645. ```
  646.  
  647. ## Filesystem
  648.  
  649. You got kernel and basic tools but the system still needs some additional directory structure.
  650.  
  651. > This created minimum viable directory structure for satisfying the basic requirements of a Linux system.
  652.  
  653. > Remember to be in the ./filesystem/ directory.
  654.  
  655. ```bash
  656. mkdir -pv {dev,proc,etc/init.d,sys,tmp,home,var/run,lib/firmware/ath9k_htc,lib/firmware/rtl_nic}
  657. sudo mknod ./dev/console c 5 1
  658. sudo mknod ./dev/null c 1 3
  659. ```
  660.  
  661. Next step is to add minimum configuration files. First one is a welcome message that will be shown after booting.
  662.  
  663. > Here is the first real opportunity to go wild and make this your own signature.
  664.  
  665. ```bash
  666. cat >> ./welcome << EOF
  667. Your welome message or ASCII art.
  668. EOF
  669. ```
  670.  
  671. Or download my `welcome` file.
  672.  
  673. ```bash
  674. wget https://raw.githubusercontent.com/mikebdp2/floppinux-amd64net/refs/heads/main/welcome
  675. ```
  676.  
  677. It looks like that:
  678.  
  679. ```
  680. $ cat ./welcome
  681.  
  682. __________________
  683. /_/ FLOPPINUX /_/;
  684. / ' boot disk ' //
  685. / '-------------' //
  686. / .---------. //
  687. / / AMD64NET / //
  688. .___/__________/__// 2880KiB
  689. '===\__________\==' 3.5"
  690.  
  691. ______ FLOPPINUX_V_0.3.1-AMD64NET _________________________
  692. ______ AN_EMBEDDED_SINGLE_FLOPPY_LINUX_DISTRIBUTION _______
  693. ______ BY_KRZYSZTOF_KRYSTIAN_JANKOWSKI_AND_MIKE_BANON _____
  694. ______ 2026.02 ____________________________________________
  695. ```
  696.  
  697. > 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.
  698.  
  699. Create an inittab file:
  700.  
  701. ```bash
  702. cat >> ./etc/inittab << EOF
  703. ::sysinit:/etc/init.d/rc
  704. ::askfirst:/usr/bin/setsid /bin/cttyhack /bin/sh
  705. ::respawn:/usr/bin/setsid /bin/cttyhack /bin/sh
  706. ::restart:/sbin/init
  707. ::ctrlaltdel:/sbin/reboot
  708. ::shutdown:/bin/umount -a -r
  709. EOF
  710. ```
  711.  
  712. And the init rc script:
  713.  
  714. ```bash
  715. cat >> ./etc/init.d/rc << EOF
  716. #!/bin/sh
  717. mount -t proc none /proc
  718. mount -t sysfs none /sys
  719. mdev -s
  720. ln -s /proc/mounts /etc/mtab
  721. mkdir -p /mnt /home
  722. mount -t msdos -o rw /dev/fd0 /mnt
  723. mkdir -p /mnt/data
  724. mount --bind /mnt/data /home
  725. clear
  726. cat ./welcome
  727. cd /home/
  728. udhcpc -i eth0 -q &
  729. /usr/bin/setsid /bin/cttyhack /bin/sh
  730. EOF
  731. ```
  732.  
  733. And the udhcpc script:
  734.  
  735. ```bash
  736. cat >> ./etc/udhcpc.sh << EOF
  737. #!/bin/sh
  738. case "\$1" in
  739. bound|renew)
  740. # Apply the IP address and subnet mask
  741. ifconfig \$interface \$ip netmask \$subnet up
  742.  
  743. # Set default gateway if provided
  744. if [ -n "\$router" ]; then
  745. # Remove any existing default route
  746. route del default 2>/dev/null
  747. # Add new default route (use first router if multiple)
  748. for gw in \$router; do
  749. route add default gw \$gw dev \$interface
  750. break
  751. done
  752. fi
  753.  
  754. # Set DNS servers if provided
  755. if [ -n "\$dns" ]; then
  756. echo -n > /etc/resolv.conf
  757. for ns in \$dns; do
  758. echo "nameserver \$ns" >> /etc/resolv.conf
  759. done
  760. fi
  761. ;;
  762. deconfig)
  763. # Clear configuration when interface goes down
  764. ifconfig \$interface 0.0.0.0
  765. ;;
  766. esac
  767.  
  768. exit 0
  769. EOF
  770. ```
  771.  
  772. And the wpa_supplicant config:
  773.  
  774. ```bash
  775. cat >> ./etc/wpa_supplicant.conf << EOF
  776. ctrl_interface=/var/run/wpa_supplicant
  777. update_config=1
  778. EOF
  779. ```
  780.  
  781. Copy the files that will be created as a part of subsequent instructions:
  782.  
  783. ```bash
  784. cp ./../dropbear/dbclient ./usr/bin/dbclient
  785. cp ./../dropbear/scp ./usr/bin/scp
  786. cp ./../hostap/wpa_supplicant/wpa_supplicant ./usr/bin/wpa_supplicant
  787. cp ./../hostap/wpa_supplicant/wpa_cli ./usr/bin/wpa_cli
  788. cp ./../kirc/kirc /usr/bin/kirc
  789. cp ./../kirc/kirc.txt /home/kirc.txt
  790. cp ./../linux-firmware/ath9k_htc/htc_9271-1.4.0.fw ./lib/firmware/ath9k_htc/htc_9271-1.4.0.fw
  791. cp ./../linux-firmware/rtl_nic/rtl816* ./lib/firmware/rtl_nic/
  792. cd ./usr/bin/
  793. ln -s ./dbclient ./ssh
  794. cd ./../../
  795. ```
  796.  
  797. Make the scripts executable and give the ownership of all files to root:
  798.  
  799. ```bash
  800. chmod +x ./etc/init.d/rc
  801. chmod +x ./etc/udhcpc.sh
  802. sudo chown -R root:root ./
  803. ```
  804.  
  805. Compress this directory into one file. Then go back to working directory.
  806.  
  807. ```bash
  808. ### rm -f ./../rootfs.cpio.xz
  809. ### find . | cpio -H newc -o | xz --check=crc32 --lzma2=dict=512KiB -e > ./../rootfs.cpio.xz
  810. rm -f ./../rootfs.cpio.lzma
  811. find . | cpio -H newc -o | xz --format=lzma --check=crc32 --lzma1=dict=512KiB,preset=9e > ./../rootfs.cpio.lzma
  812. cd ./../
  813. ```
  814.  
  815. Create booting configuration.
  816.  
  817. > 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.
  818.  
  819. > The tsc=unstable is useful on some (real) computers to get rid of randomly shown warnings about Time Stamp Counter.
  820.  
  821. > Remember to be in the working directory.
  822.  
  823. ```bash
  824. cat >> ./syslinux.cfg << EOF
  825. DEFAULT floppinux
  826. LABEL floppinux
  827. SAY [ BOOTING FLOPPINUX VERSION 0.3.1-AMD64NET ]
  828. KERNEL bzImage
  829. INITRD rfscpiol.zma
  830. APPEND root=/dev/ram rdinit=/etc/init.d/rc console=tty0 tsc=unstable
  831. EOF
  832. ```
  833.  
  834. Make it executable:
  835.  
  836. ```bash
  837. chmod +x ./syslinux.cfg
  838. ```
  839.  
  840. Create sample file
  841.  
  842. > 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.
  843.  
  844. ```bash
  845. cat >> ./hello.txt << EOF
  846. Hello, FLOPPINUX user!
  847. EOF
  848. ```
  849.  
  850. Filesystem is ready. Final step is to **put this all on a floppy**!
  851.  
  852. ## Boot Image
  853.  
  854. First we need an empty file in exact size of a floppy disk. Then format and make it bootable.
  855.  
  856. Create empty floppy image:
  857.  
  858. ```bash
  859. rm -f ./floppinux.img
  860. dd if=/dev/zero of=./floppinux.img bs=1k count=2880
  861. ```
  862.  
  863. Format it and create bootloader:
  864.  
  865. ```bash
  866. mkdosfs -n FLOPPINUX ./floppinux.img
  867. syslinux --install ./floppinux.img
  868. ```
  869.  
  870. Mount it and copy syslinux, kernel, and filesystem onto it:
  871.  
  872. ```bash
  873. sudo mount -o loop ./floppinux.img /mnt
  874. sudo mkdir /mnt/data
  875. sudo cp ./hello.txt /mnt/data/
  876. rm -f ./bzImage
  877. cp ./linux/arch/x86_64/boot/bzImage ./bzImage
  878. sudo cp ./bzImage /mnt
  879. sudo cp ./rootfs.cpio.lzma /mnt/rfscpiol.zma
  880. sudo cp ./syslinux.cfg /mnt
  881. df -h
  882. sudo umount /mnt
  883. ```
  884.  
  885. Done!
  886.  
  887. ### Test in emulator
  888.  
  889. It's good to test before wasting time for the real floppy to burn.
  890.  
  891. Boot the new OS in qemu:
  892.  
  893. ```bash
  894. qemu-system-x86_64 -fda ./floppinux.img -m 32M
  895. ```
  896.  
  897. If it worked that means You have successfully created your own distribution! Congratulations!
  898.  
  899. The **floppinux.img** image is ready to burn onto a floppy and boot on real hardware!
  900.  
  901. ## Floppy Disk
  902.  
  903. ### <!> Important <!>
  904.  
  905. 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.
  906.  
  907. ```bash
  908. sudo dd if=./floppinux.img of=/dev/XXX bs=512 conv=notrunc,sync,fsync iflag=nocache oflag=direct status=progress
  909. ```
  910.  
  911. After 10 minutes I got a freshly burned floppy.
  912.  
  913. ## Debugging
  914.  
  915. If you need more verbose logging use those syslinux.cfg settings.
  916.  
  917. ```
  918. cat >> syslinux.cfg << EOF
  919. DEFAULT floppinux
  920. LABEL floppinux
  921. SAY [ BOOTING FLOPPINUX VERSION 0.3.1-AMD64NET DEBUG ]
  922. KERNEL bzImage
  923. INITRD rfscpiol.zma
  924. APPEND root=/dev/ram rdinit=/etc/init.d/rc console=tty0 ignore_loglevel earlyprintk=tty0 loglevel=8 tsc=unstable
  925. EOF
  926. ```
  927.  
  928. ## Summary
  929.  
  930. - FLOPPINUX: **0.3.1** (February 2026)
  931. - Linux Kernel: **6.18.9**
  932. - Busybox: **1.37.0**
  933. - Image size: 2880KiB / 2.88MiB
  934. - Kernel size: ???KiB (bzImage)
  935. - Tools: 137KiB (rfscpiol.zma)
  936. - Free space left (df -h): **???KiB**
  937.  
  938. ### System Tools
  939.  
  940. **TO BE EXPANDED**
  941.  
  942. #### File & Directory Manipulation
  943. - ```cat``` - display file contents
  944. - ```cp``` - copy files and directories
  945. - ```mv``` - move/rename files and directories
  946. - ```rm``` - remove files and directories
  947. - ```ls``` - list directory contents
  948. - ```mkdir``` - creates directory
  949.  
  950. #### System Information & Management
  951. - ```df -h``` - display filesystem disk space usage
  952. - ```sync``` - force write of buffered data to disk - use this after any changes to the floppy filesystem
  953. - ```mount``` - mount filesystems
  954. - ```umount``` - unmount filesystems
  955.  
  956. #### Text Processing & Output
  957. - ```echo``` - display text output
  958. - ```more``` - page through text output
  959.  
  960. #### Utilities
  961. - ```clear``` - clear terminal screen
  962. - ```test``` - evaluate conditional expressions
  963.  
  964. ### Applications
  965.  
  966. - ```vi``` - text editor
  967.  
  968. ## Download
  969.  
  970. - [ERROR - FLOPPINUX 0.3.1-AMD64NET Floppy Image 2.88MB](http://error.img)
  971.  
  972. ---
  973.  
  974. ```
  975. __________________
  976. /_/ FLOPPINUX /_/;
  977. / ' boot disk ' //
  978. / '-------------' //
  979. / .---------. //
  980. / / AMD64NET / //
  981. .___/__________/__// 2880KiB
  982. '===\__________\==' 3.5"
  983.  
  984.  
  985. Now go and make something fun with it!
  986. ```
  987.  
  988. **FLOPPINUX - An Embedded Single Floppy Linux Distribution**
  989. **By Krzysztof Krystian Jankowski and Mike Banon**
  990. **2026.02**
  991.  
Advertisement
Add Comment
Please, Sign In to add comment