Close

uClinux 4.4 Fully Working On 68008!

A project log for Mackerel-68k Linux SBCs

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

colin-mColin M 07/21/2024 at 01:592 Comments

It never fails that as soon as you show someone (or in this case, post about it on Hackaday) the problem you’ve been having for days , you immediately see the solution, a perfect example of rubber-duck debugging. Most of my recent issues with Mackerel have a lot to do with me forgetting what in the world I was doing two years ago when I started this project. Since picking it back up recently, I often take for granted that decisions or code changes I made in 2022 were actually correct. They were not.

Mackerel’s memory issues are solved. For whatever reason, I had XIP (execute in place) disabled for my kernel build. If you’re not familiar, normally when Linux runs an executable, it has to copy it into RAM first (usually from a drive of some kind). XIP allows programs located in ROM to skip this step and, you guessed it, execute in place. You can probably see where this is going. With XIP disabled, every program I would run had to be copied into Mackerel’s extremely limited RAM. The issue is exacerbated by the fact that no MMU means no shared libraries, so all the binaries are statically linked and quite large. With XIP back in place, Mackerel runs uClinux 4.4 beautifully with 3MB RAM (technically 3.5MB, but 512KB is used for the ROM filesystem and not available to the kernel).

I’m currently using busybox as both init and most of the userspace programs with the exception of expand and nwsh. I also included busybox’s hush shell for running bash-like scripts, but I prefer nwsh as the actual user shell. This config has been working well. When busybox as init starts, it mounts the RAM filesystem, sets up /proc, and starts a root nwsh shell. At this point, it operates like any other Linux machine.

RAM is still very much constrained, but no longer a deal-breaking issue. While running some simple shell programs, free memory floats around 800KB. There’s obviously no swap space, so there’s still a risk of OOMing with a huge program or some bad scripting, but it’s functional and stable.

So exciting to finally see this working after more than two years – a “modern” kernel running on a CPU manufactured in the early 90s and designed in the early 80s!

Here’s a quick demo of the boot process and some basic shell commands:

Discussions

Ken Yap wrote 07/22/2024 at 02:23 point

👍 Thanks for supplying the term Rubber Duck Debugging which I didn't know before. Also liked the Quack Overflow April Fools Joke by Stack Overflow. Must look into your design as I have a few 68008s.

  Are you sure? yes | no

Gravis wrote 07/22/2024 at 01:55 point

Nice!

  Are you sure? yes | no