2026-04-12

Loreley : A minimal 68030 SBC running Linux

Loreley debug setup

Summary

A minimal 68030 single-board computer running Linux.

Background Story

The 68030 board was built in 2019. At the time, Beagle Bone Black and Raspberry Pi single-board computers were already widely available. But could we have a more “basic” SBC to boot Linux? Yes!

What does a Linux need, actually?

Specification

Alright, let’s build it:

Block diagram of Loreley: MC68030, CPLD glue logic, SRAM, flash ROM, UART, clock, and reset

Block diagram. Address, data, and control buses between the MC68030, the XC95144XL glue logic, SRAM, flash, and the SC28L92.

From Reset to a Linux Shell

Loreley starts with code in its flash ROM. That initial software prepares the machine to run a Linux kernel adapted to this board. The kernel then takes over the system, including the memory management unit and the serial interface used for the console.

The software is based on Linux 5.6.0, with changes for the Loreley machine type and its hardware. The board-specific work includes initialization of the SC28L92 serial interface and timer. The configuration uses an initramfs, keeping the system independent of a disk controller.

The result is a Linux shell on a computer assembled from a handful of relatively conventional chips. No HDMI output or elaborate peripheral set is required: the serial terminal does the job.

Linux kernel source: The adapted source tree is not yet publicly available. I plan to publish it.

The Cache Bug That Was Actually a Bus Interface Bug

Getting Linux to boot was not simply a matter of connecting a CPU to RAM. One of the most interesting problems showed up when Linux initialized the MC68030 caches.

Why the cache initialization looked suspicious

The relevant initialization is in the Linux/m68k startup code, arch/m68k/kernel/head.S. It builds a value for the Cache Control Register (CACR) and writes it with movec:

L(cache68030):
    .chip 68030
    movel #CC3_ENABLE_DB+CC3_CLR_D+CC3_ENABLE_D+CC3_ENABLE_IB+CC3_CLR_I+CC3_ENABLE_I,%d0
    movec %d0,%cacr

This enables the instruction and data caches, as well as the instruction- and data-burst enable bits. When execution fails around that point, the obvious suspect is the cache, or perhaps burst transfers.

But the problem was neither a defective cache nor a successful burst transfer gone wrong. It was the byte-select logic on the SRAM interface.

A byte read can fill a whole 32-bit cache entry

The MC68030 has a 32-bit data bus and supports single-entry cache fills. When it performs a cacheable read through a 32-bit memory port, it can take a complete 32-bit longword into the cache even if the instruction asked for only a byte or word.

That distinction matters because the original CPLD logic selected SRAM byte lanes using the CPU’s address bits (A1, A0) and size signals (SIZ1, SIZ0). For a normal byte write, enabling only the addressed byte lane is exactly what you want. But for a cacheable read, all four byte lanes must supply valid data for the longword being cached.

The initial implementation could leave some of those byte lanes deselected. The CPU would then receive an incomplete longword during a cache fill.

The instruction’s operand size and the amount of data required by a cache fill are not necessarily the same.

The fix was in the CPLD, not Linux

The solution was to treat reads and writes differently. For every SRAM read, the CPLD now activates all four active-low byte-lane chip selects. For writes, it keeps the normal address- and size-dependent selection.

The essential part of the VHDL change in m68k30_cslogic.vhd is:

if (cpu_input.r_wn = '1') then
    -- READ: make the entire 32-bit longword available.
    cs_ram_00_n <= '0';
    cs_ram_01_n <= '0';
    cs_ram_10_n <= '0';
    cs_ram_11_n <= '0';
else
    -- WRITE: select only the addressed byte lanes,
    -- using A1/A0 and SIZ1/SIZ0.
    -- (Existing byte-select decoder retained here.)
end if;

The signals ending in _n are active-low, so '0' means that a byte lane is enabled.

It was a small change, but it made the single-entry cache refill work. The lesson: a memory interface that handles ordinary operand reads and writes is not necessarily correct for a processor’s cache-fill behavior.

Cache fills work; burst transfers do not

There is one important distinction:

Operation Data transferred Loreley
Ordinary byte/word/longword access Requested operand Supported
Single-entry cache fill One 32-bit longword (4 bytes) Supported
Full burst cache-line fill Four longwords (16 bytes) Not supported

Loreley’s memory interface does not implement the MC68030’s full burst-transfer protocol. The burst-enable bits in the Linux CACR initialization do not, by themselves, make the external SRAM interface perform bursts. The processor can still use single-entry cache fills.

The MC68030 data cache is write-through; this was not a problem with “burst writebacks.” It was a problem with the data presented during cacheable reads.

Motorola documents the distinction between operand size and cache-fill data in the MC68030 User’s Manual, particularly in its descriptions of single-entry cache fills and byte-select logic for cacheable accesses.

See It Boot

Here is a short tour of the chips followed by Linux booting on the real board:

At futuRETRO

I presented this board at futuRETRO 2026 on 1 August, at the Faculty of Computer Science of the Technical University of Applied Sciences Augsburg. MIGs Yesterchips recorded the talk, SBC 68030 running Linux:

Notes from the weekend: Vampire Bytes @ FutoRetro.

The Name

While building and debugging the board, I listened to a lot of Lord of the Lost. One song in particular stuck with the project: Loreley.


Want to explore the hardware? The Loreley KiCad project contains the schematics and PCB layout.