Close

Linux In A Half Meg Of ROM

A project log for Mackerel-68k Linux SBCs

A series of m68k-based single-board computers built to run Linux

colin-mColin M 07/14/2024 at 01:020 Comments

My port of the uClinux 2.0 kernel is now bootable from a single 512KB ROM. For active development, it's still easier to use the serial loader to get Linux into memory, but having the kernel and filesystem in ROM makes for a nice self-contained demo. It's also "instant"-on, or at least it's one command to boot Linux now instead of the back and forth of the bootloader and serial transfer program.

Although, the kernel fits in ROM, there's very little room to spare. There are 524288 total bytes in the EEPROM and the allocation looks like this:

Bootloader: 8192
Linux text: 256176
Linux data: 27696
ROM fs:     231424
Total:      523488 

524288 - 523488 = 800 bytes to spare

To be fair, this does include Colossal Cave Adventure which feels like a necessary component to me.

Because I'm using the 52-pin variant of the 68008, I have 4 MB of address space to play with. There's nothing stopping me from adding more ROM, but that approach will only go so far. Linux at idle is only using about 200k of the 2MB of RAM currently installed, but that number is sure to go way up with more applications or a newer kernel. At some point I'll need to maximize the amount of RAM available and load Linux from external storage anyway, but I'm very happy that Mackerel is now self-contained. Connect power and serial and it's a Linux machine.

uClinux/MC68000
Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne
KERNEL -> TEXT=0x302000-0x33b3b8 DATA=0x000400-0x007030 BSS=0x007030-0x01543b
KERNEL -> ROMFS=0x3474e0-0x37f920 MEM=0x015440-0x1fc000 STACK=0x1fc000-0x200000

Mackerel 68k support (C) 2024, Colin Maykish
Calibrating delay loop.. ok - 1.27 BogoMIPS
Memory available: 1908k/2031k RAM, 0k/0k ROM (2804k kernel code, 124k data)
Swansea University Computer Society NET3.035 for Linux 2.0
NET3: Unix domain sockets 0.13 for Linux NET3.035.
uClinux version 2.0.39.uc2 (colin@crm-x1-g6) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) 15 Sat Jul 13 07:27:58 PM EDT 2024
XR68C681 driver version 0.1 by Colin Maykish
ttyS0 at 0x00000000 (irq = 1) is a XR68C681
Ramdisk driver initialized : 16 ramdisks of 4096K size
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: 3474E0-37FCDF (RO)
VFS: Mounted root (romfs filesystem) readonly.
Shell invoked to run file: /etc/rc
Command: hostname mackerel-68k
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: cat /etc/motd
  __  __            _                 _       __   ___  _    
 |  \/  |          | |               | |     / /  / _ \| |   
 | \  / | __ _  ___| | _____ _ __ ___| |    / /_ | (_) | | __
 | |\/| |/ _` |/ __| |/ / _ \ '__/ _ \ |   | '_ \ > _ <| |/ /
 | |  | | (_| | (__|   <  __/ | |  __/ |   | (_) | (_) |   < 
 |_|  |_|\__,_|\___|_|\_\___|_|  \___|_|    \___/ \___/|_|\_\

Execution Finished, Exiting

Sash command shell (version 1.1.1)
/> free
        total:    used:    free:  shared: buffers:  cached:
Mem:   1953792   208896  1744896        0    77824        0
Swap:        0        0        0
/>



I'm part way through a PCB design for this system and I've been debating how complicated I want to get with it. The feature-creep is real, but I think I will keep the SBC to a fairly modest configuration - 1MB of ROM, 2MB of RAM, and the 68C681 DUART. As cool as it is to run Linux in any form on this thing, the ancient 2.0 kernel and similarly-aged applications are fairly limited in what they can actually do.

Once the PCB goes off to manufacturing, I'd like to pick up my work on uClinux 4.4. I'm hopeful that a much newer kernel and userspace will result in a Linux experience more similar to a modern PC, but I don't know that it will function within the 4 MB address space limits of the 68008. Maybe the 68EC000 or 68SEC000 in 8-bit mode would be close to a drop-in upgrade boosting the address space to 16 MB.

Either way, if all goes well, my next update will be bringing up the first PCBs for Mackerel-08 and closing the first major chapter of this project.

Github project links:
Mackerel-68k Main Project: https://github.com/crmaykish/mackerel-68k
uClinux port: https://github.com/crmaykish/mackerel-uclinux-20040218

Discussions