Technical Notes

[]

Introduction

The X-Amiga system is intended to be minimal: a Linux kernel, a small set of packages, bound together with simple scripts. uClibc and BusyBox replace their mainstream counterparts glibc and coreutils. There are no runlevels. It boots quickly and takes little space.


Kernel

X-Amiga uses Linux kernel 2.6.22 with Gentoo patches (.config). The installer CD uses 2.6.21 (.config).


Packages

X-Amiga uses the following Gentoo packages (grouped here into categories):

Base:

Package Version Description
uclibc 0.9.28.3 C library for developing embedded Linux systems
busybox 1.5.1 Linux utilities for small systems
udev 104-r12 Ensures that /dev matches devices present on your system
sudo 1.6.8_p12-r1 Enables users to run commands as root
shadow 4.0.18.1-r1 Utilities to manage user accounts
e3 2.7.0 Micro text editor

Display:

Package Version Description
libXau 1.0.3 X authorization file management library
libXdmcp 1.0.2 X Display Manager Control Protocol Library
libICE 1.0.3 X Inter Client Exchange Library
libSM 1.0.2 X Session Management Library
libX11 1.1.1-r1 X Library
libxkbfile 1.0.4 xkbfile Library
libXext 1.0.3 Misc X Extension Library
libXt 1.0.5 X Toolkit Library
kdrive 4.3.0-r5 Tiny X server

Audio:

Package Version Description
alsa-lib 1.0.14a-r1 Advanced Linux Sound Architecture library for sound cards
alsa-utils 1.0.14 ALSA utilities (alsamixer, etc.)

Network:

Package Version Description
dhcpcd 3.0.16-r1 DHCP client
net-tools 1.60-r13 Standard Linux networking tools
wireless-tools 28 Tools to manipulate wireless network cards
ndiswrapper 1.44 Wrapper for Windows wireless network card drivers

Power:

Package Version Description
sysfsutils 1.3.0-r1 System utilities built upon sysfs
cpufrequtils 0.4 Tools to access Linux kernel cpufreq subsystem

Splash:

Package Version Description
jpeg 6b-r7 JPEG library
libpng 1.2.18 PNG library
splashutils 1.4.2 Framebuffer splash utilities

E-UAE:

Package Version Description
zlib 1.2.3-r1 Data compression library
cdrkit 1.1.6 Suite of CD/DVD utilities
e-uae 0.8.29_rc4-r1 Amiga emulator

Boot:

Package Version Description
grub 0.97-r3 GNU GRUB multiboot boot loader

System scripts

Of the following scripts, grub.conf, fstab, mtab and startxa are generated by the installer, based on options chosen by the user:

Script Location Description
grub.conf /boot/grub GRUB boot configuration
fstab /etc file system table: contains details of file systems to be mounted
mtab /etc mounted file system table: contains details of mounted file systems
inittab /etc initialization table
rcS /etc/init.d Main system init script: starts essential services
udev-start /etc/init.d udev startup: detects devices and ensures they are accessible through /dev
startxa /usr/bin Starts the X-window display and E-UAE

Notes

init

The main init script is /etc/init.d/rcS

udev

On a mainstream Gentoo system, udev is started by /lib/rcscripts/addons/udev-start.sh

A modified version of udev-start (now located in /etc/init.d) is called by rcS

Important: after udev is installed, the first line in /lib/udev/modprobe.sh must be changed to /bin/sh

kdrive

kdrive doesn't provide accelerated graphics, but has very little overhead compared to the standard xorg server. This example starts E-UAE:

/usr/X11R6/bin/Xvesa -screen 1024x768x32 & DISPLAY=:0 e-uae

Automatic login and startx

The system logs on automatically as user 'xamiga' when /etc/inittab calls /bin/autologin. (mingetty was an alternative, but the executable is slightly larger and it outputs a login message to stdout.)

Poweroff & reboot

The following lines in /etc/sudoers permit the 'xamiga' user to poweroff and reboot the computer:

xamiga ALL=(ALL) NOPASSWD: /sbin/poweroff
xamiga ALL=(ALL) NOPASSWD: /sbin/reboot

File system: ext2

Ext2 is a widely used, non-journalling filesystem. It's compatible between major platforms - drivers exist for Windows and OS X (although OS X drivers are unstable) - and suitable for use on solid-state devices, as well as normal hard disks.

alsa-lib

alsa-lib must be configured with option "--with-versioned=no" in order to compile properly on a uClibc system.

If using Gentoo, add above option to the alsa-lib ebuild, then rebuild the digest:

ebuild /usr/portage/media-libs/alsa-lib-[version] digest

cfdisk

cfdisk, along with fdisk and sfdisk, is part of the 'util-linux' package. Unlike fdisk, cfdisk can save the partition table as a file. A modified, cut down version is used by the console-based installer. All the write functionality is now removed, and the ptable file is now in a format that can be used as input to sfdisk (which writes the new partition table to the disk when the installation process begins).

USB automount

Automounting of USB storage devices is carried out by udev, using rules in /etc/udev/rules.d/sda.rules:

KERNEL=="sd[a-z]", NAME="%k", SYMLINK+="usb%m", GROUP="disk", OPTIONS="last_rule"
ACTION=="add", KERNEL=="sd[a-z][0-9]", SYMLINK+="usb%n", GROUP="disk", NAME="%k"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /mnt/usb%n"
ACTION=="add", KERNEL=="sd[a-z][0-9]", PROGRAM=="/lib/udev/vol_id -t %N", RESULT=="vfat", RUN+="/usr/bin/mount -t vfat -o rw,noauto,flush,quiet,nodev,nosuid,noexec,noatime,dmask=000,fmask=111 /dev/%k /mnt/usb%n", OPTIONS="last_rule"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/usr/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /mnt/usb%n", OPTIONS="last_rule"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/usr/bin/umount -l /mnt/usb%n"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rmdir /mnt/usb%n", OPTIONS="last_rule"

E-UAE auto-start & auto-shutdown

/etc/profile directs E-UAE to start automatically upon logging in, and to shut down the computer on exiting. There is a two second delay which can be interrupted by a key press. An E-UAE log file is saved to /home/xamiga/uae.log

/usr/bin/startxa >/home/xamiga/uae.log 2>&1

echo "Shutting down..."
stty -echo -icanon min 0 time 20 # 2 second delay
key=$(head -c1)
[ -z "$key" ] && sudo poweroff || echo "Shutdown aborted!" && stty echo

Directory tree

A tree showing each directory on the system

[To do]


References

Gentoo Cross Development Guide

TinyGentoo: HOWTO make a Tiny Gentoo using uClibc and busybox

Gentoo Embedded x86 Guide: Embedded Gentoo for the x86 architecture

uClibc: A C library for embedded Linux

BusyBox: The Swiss Army Knife of Embedded Linux

The KDrive Tiny X Server: An X server designed for low memory environments

spock's devsite: projects::fbsplash

udev documentation at ArchWiki: udev

Back