X-Amiga 'How-To'A minimal Linux for E-UAEIntroductionThis is a step-by-step guide to setting up a minimal version of Linux which can run E-UAE.
What makes this better than other emulation options? Well, this one is light, fast and streamlined - more optimized than anything else out there. The Linux part of the installation takes just 16MB of hard drive space. Bootup times can be as fast as 15s - almost as fast as a real Amiga. The underlying Linux is very simple to understand and work with; in fact, the directory structure turns out to have more similarities with the Amiga than one might expect. E-UAE also gains the wide hardware support of Linux.
Unfortunately, the process isn't as simple as installing from a CD or setup-file. This method involves some effort because the packages have to be compiled specifically for your computer. Although this guide appears verbose and ponderous, I'm just trying to cover all the details; it's really
not too difficult!
This guide parallels the usual installation procedure for an embedded Linux system; the following references may be useful:
TinyGentooGentoo Embedded x86 GuideBTW, why 'X-Amiga'? Well, Apple appended X to their Unix-based OS, and this is a Linux-based Amiga emulation, so...
Technical details at a glance * Based on Gentoo Linux
* Uses the framebuffer for graphics display - up to 1600x1200x32 using DirectFB and SDL
* Full system - with graphics, networking & sound - consists of just 15 packages (depending on hardware support)
CaveatsOnly one problem at present: the keyboard isn't 100% working (only lower case letters and numbers work). This is an E-UAE issue which could be fixed at any time.
Other things to be aware of:DirectFB (used by SDL for display on the framebuffer) may have limited support for some graphics cards. More information at:
www.directfb.orgIf there's no driver for your card, you can use the generic VESA driver - but it won't have any hardware acceleration.
I haven't tested everything yet (such as sound). But I can verify that my laptop boots into Workbench (RTG, 1024x768x16bit) with wireless networking, and so far all applications have worked without problems! (Note: DirectFB supports up to 32bit colour resolution.)
OverviewLinux actually refers to the
kernel. To make a computer usable, extra packages have to be installed to work alongside the kernel. A Linux distribution such as Ubuntu or Knoppix consists of many software packages which work together to give a complete desktop environment. However, in this case, we need only a very simple system - enough to kick-start the Amiga emulation.
You'll first need to set up Gentoo Linux on your computer. Gentoo is the most convenient distribution for this task, since the packages are easy to install and customize.
Part of the Gentoo installation process involves configuring the kernel specifically for your computer. You'll need to find out all the details of your computer's hardware beforehand, either from the technical specifications, the manufacturer's website, or by physical inspection. Kernel configuration may take a while, but it's relatively straightforward.
Once your computer is working properly, you'll use it as a
host to set up a minimal Linux/Amiga system in a
target directory, which will finally be copied to another partition or drive.
The process is very similar to setting up embedded Linux on a small system. We're using BusyBox, a package which combines the essential Linux commands into a single executable (imagine having the contents of the Amiga c directory all in a single file). However, whereas most embedded systems use uclibc (a very small C library), we're sticking to the standard glibc for maximum compatibility.
There are two ways to have a graphical display in Linux. One is to use X windows, which is rather complicated, and avoided here. The simplest is to use the framebuffer - this uses the kernel to access the graphics hardware directly. It's like having graphics in AmigaDOS without having to start Workbench.
This is a list of Gentoo packages to be installed:
Base System:[color=800000][b]Package[/b] [b]Description[/b][/color]
[color=404040]sys-apps/baselayout-lite Baselayout for embedded systems
sys-apps/busybox Linux utilities for small systems
sys-apps/hotplug Monitors plugging in or removal of devices, configuring them for immediate use
sys-apps/hotplug-base Base hotplug framework
sys-fs/udev Works with hotplug to ensure that /dev matches devices present on your system
sys-libs/glibc GNU C library
[/color]
E-UAE:[color=800000][b]Package[/b] [b]Description[/b][/color]
[color=404040]dev-libs/DirectFB Provides graphics & input device handling on top of the Linux framebuffer
media-libs/audiofile Provides access to variety of audio file formats
media-libs/libsdl Simple DirectMedia Layer multimedia library
media-libs/alsa-lib Advanced Linux Sound Architecture library for sound cards
media-sound/alsa-utils ALSA utilities (alsamixer, etc.)
sys-libs/zlib Data compression library
app-emulation/e-uae Amiga emulator
[/color]
Extras:[color=800000][b]Package[/b] [b]Description[/b][/color]
[color=404040]net-wireless/wireless-tools Tools to configure wireless LAN cards
net-misc/dhcpcd DHCP client
[/color]
Requirements * A computer running Gentoo Linux. Visit
www.gentoo.org and follow the detailed installation instructions! If you encounter any problems, the
Gentoo forums are an invaluable source of information and help.
* A fast internet connection!
* A spare partition or second hard drive, since the intention is to be able to boot into the new Linux/Amiga build. (Keep this in mind before installing Gentoo.)
Process1. Create a directory for the installationThis is going to be the target directory for the Linux/Amiga installation.
[color=800000]
Listing 1: Create target directory[/color]
[color=404040]
> mkdir /target
[/color]
2. Modify /etc/make.confThis specifies hardware for DirectFB and ALSA, and cuts out unnecessary items when installing packages (such as manuals, documentation, etc.) It might be a good idea to first back up the previous make.conf...
Note: there's no need to change the previous values for CFLAGS and CHOST. However, note the new USE flags: everything is disabled by '-*' except for the essentials: alsa, directfb, sdl, fbcon (for sound and framebuffer); nptl, nptlonly, userlocales (for glibc).
Also note that I've replaced various entries with '...', indicating that there should already be something typed there, or that you need to enter something of your own. Don't type just those dots!
Make sure you select the appropriate INPUT_DEVICES and VIDEO_CARDS from the list, and delete the rest. You'll probably need only one video card ;-) Sensible input devices are "keyboard ps2mouse linuxinput"...
For the ALSA_CARDS flag, select the driver for your card from the list of ALSA cards at the alsa web site:
www.alsa-project.org/alsa-doc/[color=800000]
Listing 2: Modify /etc/make.conf[/color]
[color=404040]
> nano /etc/make.conf
CFLAGS="..."
CHOST="..."
CXXFLAGS="${CFLAGS}"
USE="-* make-symlinks alsa directfb fbcon sdl nptl nptlonly userlocales"
USE="mmx sse"
INPUT_DEVICES="dbox2remote elo-input gunze h3600_ts joystick keyboard dreamboxremote linuxinput
lirc mutouch none permount ps2mouse serialmouse sonypijogdial wm97xx"
VIDEO_CARDS="ati128 cle266 cyber5k i810 i830 mach64 matrox neomagic nsc nvidia radeon savage
sis315 tdfx unichrome"
ALSA_CARDS="..."
FEATURES="ccache nodoc noinfo noman"
[/color]
3. Emerge packages into /targetIn this step we'll install ('emerge', in Gentoo terminology) all the major packages. First the base system, all in a single step. Of course, you're free to emerge each package one at a time. Wait a few hours while it all compiles...;-)
(Note the first line: baselayout-lite is still not finalized as a Gentoo package, so it's necessary to enable it in package.keywords)
[color=800000]
Listing 3a: Emerge the base system[/color]
[color=404040]
> echo "sys-apps/baselayout-lite -*" >> /etc/portage/package.keywords
> ROOT=/target emerge -O baselayout-lite busybox hotplug hotplug-base udev glibc
[/color]
Now install E-UAE packages...
[color=800000]
Listing 3b: Emerge E-UAE packages[/color]
[color=404040]
> ROOT=/target emerge -O directfb audiofile libsdl alsa-lib alsa-utils zlib e-uae
[/color]
4. Chroot into /target and set passwordsNow that it's set up, we need to enter the target system to configure it. Since Linux is a multiuser OS, each user needs to have a password. The 'root' user is the top-level user (i.e. administrator), so it's important to at least set the root password.
Note: 'chroot' = 'change root'.
[color=800000]
Listing 4a: Set root password[/color]
[color=404040]
> chroot /target /bin/ash
> passwd
[/color]
We also should add a regular user. Without this step you wouldn't be able to log in as anything other than root. Substitute your preferred username for 'username' below.
[color=800000]
Listing 4b: Add user[/color]
[color=404040]
> addgroup -g 100 users username
> adduser -h /home/username -s /bin/ash -G users username
[/color]
Finally, exit the target environment.
[color=800000]
Listing 4c: Exit chroot[/color]
[color=404040]
> exit
[/color]
5. Tidy up base systemSome files
may need to be added manually. Make sure the following directories are present in /target/dev (if not, copy these over from your host):
/dev/fb (needed for DirectFB)
/dev/input (needed for mouse)
/dev/sound
/dev/snd (both needed for ALSA)
Create /proc and /sys directories in /target (needed by udev, and for poweroff & reboot):
[color=800000]
Listing 5a: Create /proc and /sys[/color]
[color=404040]
> mkdir /target/proc
> mkdir /target/sys
[/color]
To make the system as small as possible, several directories can be safely deleted from /target.
[color=800000]
Listing 5b: Remove redundant directories[/color]
[color=404040]
> rm -rf /target/var/cache /target/var/db /target/var/lib
> rm -rf /target/usr/include /target/usr/lib/pkgconfig /target/usr/share/aclocal
[/color]
6. udev and hotplugYou'll need to download the udev startup script 'init-udev' for BusyBox and make sure it's present in /target/etc/init.d
Note: wget works at the moment, but the file name or location may change. If you need to use a browser, you can find the link to 'init-udev' at
busybox.net/cgi-bin/viewcvs.cgi/trunk/buildroot/package/udev/?rev=10953[color=800000]
Listing 6a: Download init-udev[/color]
[color=404040]
> cd /target/etc/init.d
> wget http://busybox.net/cgi-bin/viewcvs.cgi/*checkout*/trunk/buildroot/package/udev/init-udev?rev=10487
[/color]
/dev is populated with device nodes on bootup, but udevstart is needed to detect new devices. Edit init-udev and uncomment the line 'echo $UDEV_BIN > /proc/sys/kernel/hotplug':
[color=800000]
Listing 6b: Edit init-udev[/color]
[color=404040]
> nano /target/etc/init.d/init-udev
# heck, go whole-hog: use only new style hotplug
echo $UDEV_BIN > /proc/sys/kernel/hotplug
[/color]
7. SoundFirst make sure sound is working properly on your Gentoo host computer! Use alsamixer to unmute the channels, and set the levels as you wish. The following step will ensure there's sound in the Linux/Amiga system.
[color=800000]
Listing 7: Copy alsa configuration to /target[/color]
[color=404040]
> alsactl store
> cp /etc/asound.state /target/etc
[/color]
8. Edit the startup scriptThe Amiga uses a startup script, and so does Linux! Here it's located in /target/etc/init.d, and we're going to add some lines to the end of it to make sure everything starts properly. (Remember not to type those dots! They only indicate that there's some configuration stuff preceding this.)
[color=800000]
Listing 8: Edit /etc/init.d/rcS[/color]
[color=404040]
> nano /target/etc/init.d/rcS
...
# udev startup
/etc/init.d/init-udev start
# Reset sound levels
alsactl -f /etc/asound.state restore
[/color]
9. Copy /boot to /targetYou configured the kernel when you first installed Gentoo, so there's no need to redo it. This step only copies /boot to the /target directory to make it bootable. /target will eventually end up on its own partition.
[color=800000]
Listing 9: Copy /boot to /target[/color]
[color=404040]
> cp -a /boot /target
[/color]
10. Amiga thingsNow let's create a directory for the Amiga installation, and make sure that .uaerc points to it correctly.
Note the upper case 'A' in 'Amiga' - Linux is case sensitive, so if you use 'Amiga' here, stick to it.
[color=800000]
Listing 10a: Create Amiga directory[/color]
[color=404040]
> mkdir /target/Amiga
[/color]
Note that this next portion of text has been extracted from the .uaerc file; it's only here to illustrate how to point to the correct directories. (As usual, ignore the '...' entries.)
[color=800000]
Listing 10b: Edit .uaerc[/color]
[color=404040]
> nano /target/root/.uaerc
...
kickstart_rom_file=/Amiga/amiga-os-310.rom
kickstart_key_file=/Amiga/rom.key
filesystem2=rw,DH0:System:/Amiga/System,1
filesystem2=rw,DH1:Programs:/Amiga/Programs,0
...
[/color]
11. Create a separate partition for the installationIn order to boot into it, the custom Linux/Amiga should be set up in a separate partition or even another drive. My primary partition (/dev/hda1) contained the main Gentoo installation, so I prepared my second partition (/dev/hda2) for the Linux/Amiga installation.
I used ext2 as the filesystem because it's not journalled, and I wanted to avoid excessive disk activity. However, you're not limited to using ext2 - Linux gives you plenty of choices.
[color=800000]
Listing 11: Format and mount /dev/hda2[/color]
[color=404040]
> mke2fs /dev/hda2
> mkdir /mnt/hda2
> mount /dev/hda2 /mnt/hda2
[/color]
12. Modify fstab/target/etc/fstab needs to be modified... In this guide, we'll be booting into /dev/hda2, so fstab must reflect this.
[color=800000]
Listing 12: Modify fstab[/color]
[color=404040]
> nano /target/etc/fstab
# (fs) (mountpoint) (type) (opts)
/dev/hda2 / ext2 noatime
proc /proc proc defaults
shm /dev/shm tmpfs nodev,nosuid,noexec
tmp /tmp tmpfs noatime,defaults
[/color]
13. Copy /target to the new partition (or drive)Now that it's all set up, time to copy the contents of /target to the new partition or hard drive.
[color=800000]
Listing 13: Copy /target to new partition[/color]
[color=404040]
> cp -a /target/* /mnt/hda2
[/color]
14. Modify grub.confIf the installation is on another partition, there's no need to re-install grub; you only need to modify grub.conf. However, if you're using a second hard drive, grub
will need to be installed (not covered here).
[color=800000]
Listing 14: Modify grub.conf[/color]
[color=404040]
> nano /boot/grub/grub.conf
default 0
timeout 5
title=Gentoo Linux
root (hd0,0)
kernel /boot/kernel-2.6 root=/dev/hda1
title=Amiga
root (hd0,1)
kernel /boot/kernel-2.6 root=/dev/hda2
[/color]
15. Finished!Reboot the computer, select the new 'Amiga' option in grub, and hopefully after a few seconds you'll see the login prompt...
(Just remember, the /Amiga directory is empty - you'll need to fill it with a Kickstart ROM, and a proper Amiga OS installation!)
To start E-UAE, type 'e-uae' at the command prompt.
Note that BusyBox doesn't have a 'halt' command; when you finish your session you need to use 'poweroff'.
NotesIf E-UAE on the framebuffer just isn't working for you, you could always install xorg-x11 - the full X windows environment. This'll take up about 60MB (and a few more hours of compilation). Then you need to configure it... ;-)
Compile the kernel without modules (for simplicity, it's usually better to build everything into the kernel)
An alternative to emerging all the packages into one /target directory is to emerge each package into its own individual directory. First create each directory, then use 'ROOT=
emerge -O '. Lastly, manually copy the files into the correct locations. Why? You'll see exactly which files are installed where. Some of them may not be strictly necessary. For instance, it seems that not everything in the glibc package is needed, only the items in /lib. If this is the case, it's possible to save space. My final E-UAE Linux installation is ~16MB!
In case it's useful, here's the directory structure of my own installation:
bin
boot
dev
etc
|--conf.d
|--dev.d
||--default
|`--net
|--env.d
|--hotplug
|--hotplug.d
|`--default
|--init.d
|--modules.d
`--udev
|--rules.d
`--scripts
home
`--user
lib
|--firmware
|--rcscripts
|`--addons
`--udev
proc
sbin
usr
|--bin
|--lib
||--alsa-lib
||`--smixer
||--directfb-0.9.25
|||--gfxdrivers
|||--inputdrivers
|||--interfaces
||||--IDirectFBFont
||||--IDirectFBImageProvider
|||`--IDirectFBVideoProvider
|||--systems
||`--wm
||--hotplug
||`--firmware
|--sbin
`--share
|--alsa
||--cards
||--pcm
|`--speaker-test
|--directfb-0.9.25
`--sounds
`--alsa
var
|--log
|--run
||--usb
`--tmp
BTW, I made myself the root user. This is strongly NOT recommended for all sorts of reasons, but it's my computer and I don't care. I edited /etc/passwd, changed my user id to 0 (root) and got rid of root, then deleted /root. More information at: www-128.ibm.com/developerworks/library/l-roadmap4/
I also mentioned in Step 11 that my preference was to avoid excessive disk activity. Accordingly, I turned off system logging by commenting out some lines in /etc/inittab
Still to do (if there's any interest): a nice Amiga-themed startup logo to go with the login prompt, using either /etc/issue, Linux_Logo (text based 'ASCII art' login) or Qingy (framebuffer based graphical login); perhaps instructions on how to start E-UAE automatically on log-in, and shut down when logging out...
I think it may be possible to automate the whole process, from beginning to end, and make it more of a standard 'installation' procedure - select a few options, then go off while the computer does all the boring stuff...
Comments? Mistakes? Abstruseness? My amiga.org handle is "Fraccy".
(c) 2007 Amir Ansari (Fractallyte)