Gentoo Logo

Gentoo on the ARAnyM emulator


1.  Overview

ARAnyM is an m68k hardware emulator. Read more about it in its official webpage:

In this guide we'll explain how to run Gentoo/m68k on the ARAnyM software. It will be more easy to understand this guide if you're already a Gentoo user.

2.  Requirements

To be able to run Gentoo/m68k on ARAnyM, you'll need the following:

  • A Gentoo installation
  • 2GB of free space or more
  • A network connection

3.  Preparing to install your m68k emulated machine


For emulating a m68k system, we'll use ARAnyM. We'll have to create a filesystem for it and build a kernel.

Emerging needed tools

For building a kernel for m68k, we need a cross-compiler. For doing that we'll use sys-devel/crossdev.

  • sys-devel/crossdev - to create a crosscompiler
  • app-emulation/aranym - the emulator
  • net-firewall/iptables - for accessing the machine and sharing the networking with it

Code Listing 3.1: Emerge needed tools

# emerge sys-devel/crossdev app-emulation/aranym

Build a crosscompiler

Code Listing 3.2: Building a crosscompiler

# crossdev -S --g 4.6.3 m68k-unknown-linux-gnu

Obtaining/Building a kernel

For booting the machine we need a kernel. Download the latest stable kernel from In this guide I'm using kernel 3.10.5.

Code Listing 3.3: Obtaining the kernel

# wget

(Extract and change to the directory)
# tar xJpf linux-3.10.5.tar.xz && cd linux-3.10.5

We'll use the atari default kernel configuration, which also includes ARAnyM support.

Code Listing 3.4: Getting the defconfig

# make ARCH=m68k atari_defconfig

Also let's build the generic RTC driver as built-in.

Code Listing 3.5: Building the generic RTC driver as built-in


Now let's compile the kernel.

Code Listing 3.6: Cross-compiling the kernel

(Replace 4 with the number of cores you have on your computer)
# make -j4 ARCH=m68k CROSS_COMPILE=m68k-unknown-linux-gnu-

Once it gets built we'll have a kernel in the vmlinux.gz file.

ARAnyM configuration

For running ARAnyM we'll create a configuration file. Create a file called aranym.cfg with the following content.

Code Listing 3.7: aranym.cfg

FastRAM = 768  # This is the amount of RAM in MB you want the m68k machine to use
Floppy =
EmuTOS =
Bootstrap =
BootstrapArgs =
BootDrive =
GMTime = Yes
AutoGrabMouse = No

GrabMouse = No
Debugger = No

FullScreen = No
BootColorDepth = -1
VidelRefresh = 1

Type = bridge
Tunnel = tap4
MAC = 52:54:00:10:00:04

Kernel = vmlinuz
# these Args are for normal X operation
Args = root=/dev/nfhd0p1 console=tty video=atafb:vga16

Present = Yes
PartID = LNX
ByteSwap = Yes
Path = rootfs.img

The Args parameter in the LILO section, can be used to control the output of the console.

In the configuration example, the console will be the new X window ARAnyM will open when we execute it. If you don't have X or want to redirect the output of the console to stderr, you must replace the Args line with the following:

Code Listing 3.8: Args line for headless operation

Args = root=/dev/nfhd0p1 console=nfcon

Note: ARAnyM doesn't support console access in the headless mode, your only way to access the machine will be using SSH, but at least you will be able to see the machine booting.

4.  Creating and populating the filesystem


For ARAnyM we'll use a disk image. Read the ARAnyM documentation for more options.

Creating the filesystem

For the sake of simplicity we'll just use one partition for everything. Let's create a 8GB filesystem, because we want to have a portage tree. If you are going to have the emulated m68k machine access the portage tree using NFS, you won't need so much space, adjust it to your needs.

Code Listing 4.1: Creating a disk image

# dd if=/dev/zero of=rootfs.img bs=1M count=8096

Code Listing 4.2: Formatting the image

# mkfs.ext4 rootfs.img

5.  Installing Gentoo


The installation on this device is a bit different, and therefore easy, as we can't install Gentoo on it by booting an installation environment.

What we'll have to do to setup our installation is:

  1. Extract stage3
  2. Extract portage snapshot
  3. Setup fstab
  4. Setup root password
  5. Configure hostname and networking (optional, but recommended)
  6. Enable SSH access (optional, but recommended)
  7. Enable serial console access

Downloading a stage3 and portage snapshot

We need an m68k stage3, available under the experimental/m68k directory in your favorite mirror.

Important: There may be some mirrors that don't have populated the experimental/ directory, a sure option is the Gentoo mirror @ OSUOSL

Also download a portage snapshot, you can find them in the snapshots/ directory in the main directory of the mirror

Extracting a stage3

Mount the disk image and extract the stage3 you downloaded.

Code Listing 5.1: Mounting the partition and extracting the stage3

(Make sure you're root)
# mkdir /mnt/p1
# mount rootfs.img /mnt/p1

(Adjust the tarball name accordingly)
(Extract the stage3, it may take a while)
# tar xjpf stage3-m68k-20130509.tar.bz2 -C /mnt/p1

Extracting a portage snapshot

Code Listing 5.2: Extracting the snapshot

(Extract the snapshot, it may take a while)
# tar xjpf portage-latest.tar.bz2 -C /mnt/p1/usr

Setup fstab

Edit the /mnt/p1/etc/fstab file to look like this:

Code Listing 5.3: /mnt/p1/etc/fstab

(This is the important part)
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/nfhd0p1		/		ext4		noatime		0 1

(Remove the following lines as we don't have SWAP, cdrom, or floppy)
/dev/SWAP		none		swap		sw		0 0
/dev/cdrom		/mnt/cdrom	auto		noauto,ro	0 0
#/dev/fd0		/mnt/floppy	auto		noauto		0 0

Setting the default root password

This is the most important part of the installation. As without the root password we won't be able to login!

For setting the password, we need to be able to run passwd. However that's not possible since our PC can't run m68k binaries. Therefore we need to modify the file that contains the passwords (/etc/shadow) inside the chroot, so we can set a default root password.

Code Listing 5.4: Change the default root password

(Generate a password)
# openssl passwd -1

# nano -w /mnt/p1/etc/shadow

(Replace the first line with the following line)
(Replace s3cr3t with the output the openssl command gave you)

(For example, this line makes the password be gentoo)

Setup hostname and networking

For configuring the hostname, simply edit the /mnt/p1/etc/conf.d/hostname file accordingly.

In this guide, ARAnyM uses a virtual network. You have to configure your m68k system to use a new network separate from your actual network.

Let's configure the eth0 interface, edit /mnt/p1/etc/conf.d/net with the following contents.

Code Listing 5.5: /etc/conf.d/net contents

config_eth0=" netmask brd"
routes_eth0="default via"

And now make the eth0 network interface start at boot.

Code Listing 5.6: Making the eth0 network interface start at boot

# ln -sf /etc/init.d/net.lo /mnt/p1/etc/init.d/net.eth0
# ln -sf /etc/init.d/net.eth0 /mnt/p1/etc/runlevels/default

Remember to modify /mnt/p1/etc/resolv.conf if you want to use a DNS server.

Enabling SSH access (optional, unless you want a headless machine)

Important: This is mandatory if you want a headless machine, otherwise you won't be able to access the machine

We can add sshd to the startup of our system so we can access our m68k system using ssh.

Code Listing 5.7: Adding sshd to the startup

# ln -sf /etc/init.d/sshd /mnt/p1/etc/runlevels/default

Finishing the installation

Let's unmount the disk image

Code Listing 5.8: Unmounting the disk image

# umount /mnt/p1

This is pretty much all of the installation. I'd highly recommend that you read all the recommendations of the handbook.

6.  Booting up our new system

We now have our m68k system ready. You can execute ARAnyM as follows:

Code Listing 6.1: Running ARAnyM

# aranym -l -c aranym.cfg

This will create a new X window where you should see the machine booting and you will be presented with a login screen once everything went fine.

Important: By default, if you use ARAnyM window, your keyboard and mouse will be grabbed. To ungrab, the default hotkeys are: Left Shift + Left Ctrl + Left Alt + ESC

In case you want ARAnyM to run headless, you need to execute it this way:

Code Listing 6.2: Running ARAnyM headless mode

# SDL_AUDIODRIVER=dummy SDL_VIDEODRIVER=dummy aranym -l -c aranym.cfg

Note: Make sure you've enabled SSH if you're running ARAnyM this way!

Networking setup

When ARAnyM boots, it will setup a virtual network interface called tap4 (unless you changed the name in aranym.cfg).

Now you need to configure this network interface and use iptables to be able to forward traffic from and to ARANyM. We'll use a static network configuration.

Code Listing 6.3: Configure the network interface

# ifconfig tap4 pointopoint netmask

Code Listing 6.4: Configure iptables

(Enable IP forwarding)
# echo 1 > /proc/sys/net/ipv4/ip_forward

(Enable NAT for everything coming from
# iptables -t nat -A POSTROUTING -s -j MASQUERADE

7.  References

You may find more documentation about the emulator itself and Linux-related at the following links:



I'd like to thank the Debian project and their m68k developers, since this guide and the stages are done thanks to their work.


Page updated August 7, 2013

Summary: This guide shows you how to install Gentoo on the ARAnyM emulator.

Raúl Porcel

Donate to support our development efforts.

Copyright 2001-2015 Gentoo Foundation, Inc. Questions, Comments? Contact us.