A fitfully maintained guide to Linux Game Development

Today we're going to be using Crux Linux in our introduction to Linux Game Development. There are loads of great technical reasons to be using Crux. We won't be listing them here because we have no idea what they are. The choice of Crux Linux for us is a purely personal aesthetic.

We like it's succinct cleanliness and it's advanced user leanings. The base install is clean, quick and stays out of your way. Plus we use it as our Linux Game Development platform.

Installing CRUX

Download Crux 2.8 iso image from a Mirror.

Insert CRUX 2.8 ISO in ROM drive and boot. Choose Install CRUX at Menu.

It automatically logs in as "root"

Prepare Drive

$ fdisk /dev/sda (sata)

Formula for computing split

$ mkfs.ext4 /dev/sda1
$ mkswap /dev/sda2
$ mount /dev/sda1 /mnt

Activate Swap Partition

$ swapon /dev/sda2
$ setup

Choose to Install CRUX

Choose mountpoint /mnt as install point

Choose core and xorg package collections to install. Don't bother (unless you really want) to install packages individually)

If dependencies from opt are needed (you will be asked), just install them.

Wait for the installer to finish

Review the installed packages and hit ok when done.

Now on to complete the installation. We mount the freshly installed disk as if it were the root disk to complete the installation

$ mount --bind /dev /mnt/dev
$ mount --bind /tmp /mnt/tmp
$ mount -t proc proc /mnt/proc
$ mount -t sysfs none /mnt/sys
$ chroot /mnt /bin/bash

Set the root password

$ passwd

Edit /etc/fstab

Edit /etc/rc.conf to configure font, keyboard, timezone, hostname and services
Edit /etc/rc.d/net, /etc/hosts and /etc/resolv.conf

You can use DHCP by setting up the ethernet section with 

for start
/sbin/dhcpcd -t 10 -h $HOSTNAME eth0

for stop
/sbin/dhcpcd -k eth0

If using DHCP you will not need to configure /etc/hosts and /etc/resolv.conf

Next we build the Kernel 

Specific things we need to make sure we have: 
udev filesystem

$ cd /usr/src/linux-3.6.x
$ make menuconfig
$ make all 
$ make modules_install
$ cp arch/x86/boot/bzImage /boot/vmlinuz
$ cp System.map /boot

Edit /etc/lilo.conf to boot the kernel (e.g.)

lba32
install=text
boot=/dev/sda
image=/boot/vmlinuz
  label=CRUX
  root=/dev/sda!
  read-only
  append="quiet"

$ lilo

reboot and remove ISO or DVD from drive

Create and Update Ports Tree as a precurser to updating your system

$ ports -u 

...

Once the ports tree has been fetched you can Update your system to the 
latest packages.

$ prt-get sysup

Fetch the CRUX MATE ports. First get the httpup file

$ curl http://crux-mate.googlecode.com/svn/trunk/mate.httpup -o /etc/ports/mate.httpup

Enable the contrib ports also (in /etc/ports) 

$ mv contrib.rsync.inactive control.rsync

Edit the the file /etc/prt-get.conf and enable the contrib collection; then put prtdir /usr/ports/mate 
before any of the other prt configurations.

Then issue 

$ ports -u 

At this point only udev will be installed already. We need to update udev and force the additional 
dependencies the MATE version of udev requires; to be installed. 

$ prt-get depends udev | xargs -I % sh -c `prt-get depinst % --install-scripts; 
  prt-get update % --install-scripts`


Now we can run the install command line for MATE. Note that the packate "mate" is a meta-package 
referring to all of MATE as needed to run a basic environment.

prt-get depinst mate --install-scripts

Now configure your .xinitrc in $HOME 

It will contain the following

xscreensaver -nosplash &
exec /usr/bin/start-mate

Fetch the Kruger Heavy Industries gamedev port repository

curl http://downloads.krugerheavyindustries.com/linux/crux/2.7/kernel/config.gz | gzip -d > /usr/src/linux/.config