Skip to content

matteo-pacini/ZPLinux

Repository files navigation

ZPLinux

A tailored Linux release for my 486 FreeDOS machine.

(Toolchain and distro built with Nix)

(Yeah, that's cmatrix burning the 66Mhz CPU)

Comes in two lovely floppy diskettes.


Changelog

v0.1

  • Initial Release

v0.2

  • Added Real Time Clock support in the kernel.
  • Safer toolchain (without LDFLAGS="-s") / binaries and .so are now stripped via *strip --strip-unneeded at the end of toolchain build process.
  • Removed most of built static libraries - going fully dynamic whenever applicable.
  • Copied libc.so to the modules floppy - the script now creates the symlinks for the interpreter /lib/ld-musl-i386.so.1 and /bin/ldd.
  • Non-boot diskettes are now ext2 formatted.

v0.3

  • Ported toolchain and build system to Nix
  • Improved documentation (BusyBox applet list, Floppy B usage instructions)
  • Enabled additional BusyBox applets (grep, ps, top, kill, tab completion, command history)

Target Machine

  • Motherboard: Jetway-437 (VESA, PCI)
  • CPU: Intel 486 DX2 - 66Mhz
  • RAM: 4x4MB EDO RAM (16MB)
  • VGA: S3 Virge/DX 4MB
  • Sound: Creative SB16 Vibra PnP (ISA)
  • Network: RTL8029AS
  • HDD: Samsung WN312021A (1,2GB)
  • CD-ROM: LG GCR-8520b
  • Floppy: 3.5” 1.44MB
  • Keyboard: DYN5 UK Keyboard
  • Mouse: Microsoft Serial Mouse (2 buttons)


Screenshots & Videos

Boot time from when the floppy is triggered to usable shell (around 1m27s).

Full cold-boot video

IMG_1614.mov

More Screenshots (QEMU)


Kernel Configuration

Modules are a must - it's impossibile to fit everything into a floppy. The non-essential modules will be offloaded to the second floppy.

- Enable loadable module support
- Enable block layer
- General setup -> swap 
- General setup -> initramfs/initrd support (gzip only)

Some generic must-have features

- General setup -> Kernel Features (expert) -> printk
- General setup -> Kernel Features (expert) -> PC-Speaker
- Executable file formats -> ELF binaries
- Executable file formats -> Scripts starting with #!
- Device drivers -> Generic driver options -> devtmpfs

Processor configuration

- Processor -> Family -> 486DX
- Processor -> Load address -> 0x400000

The motherboard supports both ISA and PCI, so...

- Bus -> ISA support
- Device drivers -> PCI support

For the block devices, the machine uses SCSI/PATA.

- Device drivers -> Block devices -> Normal floppy support
- Device drivers -> SCSI -> SCSI device support
- Device drivers -> SCSI -> SCSI disk support
- Device drivers -> SCSI -> SCSI CDROM
- Device drivers -> SATA/PATA -> ATA SFF support
- Device drivers -> SATA/PATA -> Generic platform device PATA support
- Device drivers -> SATA/PATA -> Legacy ISA PATA support

For the VGA (module)

- Device drivers -> Graphics -> Framebuffer support -> S3 Trio/Virge 

Filesystems (ext2, fat, vfat and ISO9660)

- File systems -> EXT2                  
- File systems -> CDROM -> ISO9660                  
- File systems -> DOS/VFAT/etc -> MSDOS                  
- File systems -> DOS/VFAT/etc -> VFAT                  
- File systems -> Pseudo -> /proc                  
- File systems -> Pseudo -> sysfs                  
- File systems -> NLS -> Codepage 437                  
- File systems -> NLS -> ISO 8859-1  

Mouse (module) and keyboard

- Device drivers -> Input device support -> Keyboards -> AT
- Device drivers -> Input device support -> Mice -> Serial 

Sound card (Vibra16 - ISA PnP)

- Device drivers -> PNP support -> ISA PNP   
- Device drivers -> Sound card support -> ISA devices -> SB16 PnP    

Parallel port (module)

- Device drivers -> Parallel port support -> PC-Style hardware  

PC speaker (module)

- Device drivers -> Input device support -> Miscellaneous -> PC Speaker  

TTY

- Device drivers -> Character devices -> TTY
- Device drivers -> Character devices -> TTY / Output messages to printk

Busybox settings

BusyBox 1.35.0 is statically linked and optimized for size (-Os). Key applets enabled:

  • Shell: ASH with tab completion, command history, aliases
  • Editor: vi (with undo, search, yank/mark)
  • Core utilities: cat, cp, echo, ln, ls, mkdir, mv, rm, sleep, sync, uname
  • Finding utilities: find (extensive options), grep/egrep/fgrep
  • Process utilities: free, kill, killall, ps, top, uptime
  • Module utilities: depmod, insmod, lsmod, modinfo, modprobe, rmmod
  • Filesystem utilities: mount, umount, fsck, fdisk, mkfs.ext2, mkdosfs, mkswap, swapon/swapoff
  • Device utilities: mdev (device manager with hotplug support), lspci, lsscsi
  • Init utilities: poweroff, reboot
  • Misc: beep, clear, time

Running

nix run github:matteo-pacini/zplinux

Note: compilation of the cross-toolchain may take a while.

Using Floppy B

After booting, insert Floppy B (or it's already available in QEMU as the second floppy drive).

Mount and run the setup script:

mkdir -p /mnt/floppy-b
mount /dev/fd1 /mnt/floppy-b
sh /mnt/floppy-b/install.sh /mnt/floppy-b

This will:

  • Create symlinks for musl libc (/lib/libc.so, /lib/ld-musl-i386.so.1)
  • Set up /bin/ldd
  • Link terminfo for terminal support

Kernel modules are available at /mnt/floppy-b/lib/modules/5.15.189/.

Must Read

Articles that inspired my Linux quest:

About

Linux on a floppy for my 486 <3

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •