Intro

March 10, 2021

It would be nice to run Linux on this 68k computer because there is a lot of software out there already supported by Linux. We don't have to re-write things like the networking stack, filesystem drivers, etc. It's painful though because Linux does not have good support for m68k (especially our board with no MMU). Also, Linux takes up a lot of memory, so we will need to add some RAM to the system to support it.

We will use a distribution called Accelerated Linux which is intended to support low-end embedded systems. Even so, there is still a lot of tweaking that needs to be done. Accelerated Linux is a tool that builds a complete system, including the kernel, libraries, and a root filesystem. It's similar to buildroot, but with support for super low-end CPUs.


Building a Cross Compiler

March 10, 2021

Unfortunately for us, the m68k cross compiler that ships with Ubuntu's pacakge manager does not support old school 68k CPUs like ours. It only generates code for newer 68k variants and ColdFire. Many of the instructions it emits are unsupported by our 68EC000, which causes programs to crash. To get around this problem, we will use x-tools to build an m68k compiler that generates code for our board.


Building Accelerated Linux

March 10, 2021

Choosing a Template Platform

We need to tell the build system about the details of our platform—start address and size of RAM, type of CPU, etc—in order to make the resulting binary runnable. There are a bunch of template platforms included with Accelerated Linux that have all these system details already defined. We will modify the template for the Atari platform to match our system.

The first thing that we need to do is modify the config file for the Atari platform located in vendors/Atari/Atari/config.arch. We will substitute the base config file for the platform to be the m68knommu, which will enable compiler flags for our platform.

include $(ROOTDIR)/vendors/config/m68knommu/config.arch

vendors/Atari/Atari/config.arch

We then need to modify the vendors/config/m68knommu/config.arch file to tell it what our compiler is called. By default, the m68knommu architecture expects the compiler to be called m68k-uclinux-gcc, but the compiler we built with x-tools is called m68k-unknown-elf-gcc.

ifneq ($(shell which m68k-uclinux-20060615-gcc),)

CROSS_COMPILE = m68k-uclinux-20060615-

else

CROSS_COMPILE = m68k-unknown-elf-

endif

CROSS = $(CROSS_COMPILE)

CONFIGURE_HOST = m68k-elf

CONFIGURE_TOOL ?= m68k-uclinux

vendors/config/m68knommu/config.arch

Tweaking uClibc

uClibc is a small-footprint C library for embedded systems. By default, it is configured with shared library support enabled. This is a problem because uClibc does not support shared libraries on systems with no MMU (like our 68k homebrew board). We need to explicitly disable shared library support in uClibc so it will compile.

$ cd uClibc

$ make menuconfig

Disable the following options in the menuconfig for uClibc:

Target Architecture Features and Options --->

  [ ] Target CPU has a memory management unit (MMU)

  [ ] Enable floating point number support