Benjamin Schieder


Ok, for those people who really want to know how to build Nethack Linux (because you want to help me improve it, for example :) ), here is what I did. If, at some point, you don’t know what I’m talking about, do not ask me to explain it to you! I won’t do it.

Ok, here goes:
First, get the development version of the uclibc file system on its website.
Use either dd cat and resize2fs to increase its size, dd it to a spare partition and use resize2fs or loopmount it and copy its contents to a directory to chroot into it.
NOTE: If I say “compile” I imply linking it statically. Making the appropriate changes is left as an excercise for the reader.
Then extract nethack into the uclibcsystem and chroot into it. Yes, this requires root-privileges.
Patch, compile and install nethack as you usually would. I suggest using the DLB compiletime option since it makes the further steps much easier.
Next, install dietlibc.
Next, apply the patch to tar and compile it with “–disable-largefiles –disable-nls” and compile tar with dietlibc.
Next, compile bzip2 with dietlibc.
Next, download and compile linuxrc.c with dietlibc.
Next download the Linux kernel.
Extract it, apply the patch and configure your kernel to a real bare minimum. I’ve got an existing configuration that you can use.
Next, go to your uclibcsystem and create nethack.tar.bz2 which contains:


where: save is a symlink to /, logfile is a symlink to /logfile, record is a symlink to /record.
Next, get UPX Version 1.90 or newer and strip and compress the following files using upx:
bzImage, bzip2, tar, nethack, linuxrc
For best results invoke upx with the parameter –brute.
Copy the files nethack, nethack.tar.bz2, bzip2, tar and linuxrc to a floppy.
Next, create some directories on the floppy: boot, dev, etc and usr. Create a symlink from tmp to usr. Go to dev and create these device nodes:

crw-r–r– 1 root root 5, 1 Apr 28 11:29 console
brw-r–r– 1 root root 2, 0 Apr 28 10:54 fd0
crw-r–r– 1 root root 1, 3 Apr 28 12:00 null
crw-r–r– 1 root root 1, 8 Apr 28 12:00 random
crw-r–r– 1 root root 5, 0 Apr 28 15:16 tty
crw-r–r– 1 root root 4, 0 Apr 28 15:16 tty0
crw-r–r– 1 root root 4, 1 Apr 28 15:16 tty1
crw-r–r– 1 root root 4, 2 Apr 28 15:16 tty2
crw-r–r– 1 root root 4, 3 Apr 28 15:16 tty3
crw-r–r– 1 root root 4, 4 Apr 28 15:16 tty4
crw-r–r– 1 root root 4, 5 Apr 28 15:16 tty5
crw-r–r– 1 root root 1, 9 Apr 28 12:01 urandom
crw-r–r– 1 root root 1, 5 Apr 28 12:00 zero

Next, create the file etc/passwd with the following content:
Next, rename bzImage to vmlinuz.
Next, create the file lilo.conf with the following content:


append=”root=/dev/fd0 init=/linuxrc rw”

Next, create a symlink from .nethackrc to nethackrc
Next, install lilo on the floppy:
> lilo -r /mnt/floppy -C /lilo.conf
assuming you have your floppy mounted on /mnt/floppy.
Doing a ls -l on /mnt/floppy should now look like this:

drwxr-xr-x 2 root root 1024 May 17 12:25 boot
-rwxr-xr-x 1 root root 37629 May 17 12:23 bzip2
drwxr-xr-x 2 root root 1024 Apr 28 15:43 dev
drwxr-xr-x 2 root root 1024 May 17 13:59 etc
-rw-r–r– 1 root root 102 Apr 28 14:02 lilo.conf
-rwxr-xr-x 1 root root 13201 May 17 11:56 linuxrc
-rwxr-xr-x 1 root root 589736 May 17 12:29 nethack
-rw-r–r– 1 root root 179850 May 4 20:27 nethack.tar.bz2
-rw-r–r– 1 root root 1345 May 17 11:56 nethackrc
-rwxr-xr-x 1 root root 61739 May 17 12:23 tar
lrwxrwxrwx 1 root root 3 Apr 28 10:00 tmp -> usr
drwxr-xr-x 2 root root 1024 Apr 28 08:47 usr
-rw-r–r– 1 root root 290143 May 17 11:52 vmlinuz

Congratulations! You’ve just build your own Nethack Linux!
Don’t complain about these instructions being difficult. Noone said building a small-size livesystem was going to be easy.