Gentoo on the ARAnyM emulator
ARAnyM is an m68k hardware emulator. Read more about it in its official
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.
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
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 www.kernel.org. In this guide
I'm using kernel 3.10.5.
Code Listing 3.3: Obtaining the kernel
# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.5.tar.xz
# tar xJpf linux-3.10.5.tar.xz && cd linux-3.10.5
We'll use the atari default kernel configuration, which also includes
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
# sed -i -e 's/CONFIG_RTC_DRV_GENERIC=m/CONFIG_RTC_DRV_GENERIC=y/g' .config
Now let's compile the kernel.
Code Listing 3.6: Cross-compiling the kernel
# make -j4 ARCH=m68k CROSS_COMPILE=m68k-unknown-linux-gnu-
Once it gets built we'll have a kernel in the vmlinux.gz file.
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
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
IsCDROM = No
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.
Creating and populating the filesystem
For ARAnyM we'll use a disk image. Read the ARAnyM documentation for more
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
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:
- Extract stage3
- Extract portage snapshot
- Setup fstab
- Setup root password
- Configure hostname and networking (optional, but recommended)
- Enable SSH access (optional, but recommended)
- 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
# mkdir /mnt/p1
# mount rootfs.img /mnt/p1
# tar xjpf stage3-m68k-20130509.tar.bz2 -C /mnt/p1
Extracting a portage snapshot
Code Listing 5.2: Extracting the snapshot
# tar xjpf portage-latest.tar.bz2 -C /mnt/p1/usr
Edit the /mnt/p1/etc/fstab file to look like this:
Code Listing 5.3: /mnt/p1/etc/fstab
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/nfhd0p1 / ext4 noatime 0 1
/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
# openssl passwd -1
# nano -w /mnt/p1/etc/shadow
Setup hostname and networking
For configuring the hostname, simply edit the /mnt/p1/etc/conf.d/hostname
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="192.168.0.201 netmask 255.255.255.0 brd 192.168.0.255"
routes_eth0="default via 192.168.0.200"
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
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
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.
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!
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 192.168.0.200 pointopoint 192.168.0.201 netmask 255.255.255.255
Code Listing 6.4: Configure iptables
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -s 192.168.0.201 -j MASQUERADE
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.
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-2.5 license. The Gentoo Name and Logo Usage Guidelines apply.