Minix in Hatari

In einem Post bei atari-forum.com bin ich auf einen Post gestoßen der mein Interesse geweckt hat. Minx, ein Unixartiges Betriebssystem das von Andrew S. Tanenbaum als Lehrsystem entwickelt wurde. Minix läuft auch auf dem Atari Emulator „Hatari“. Das wollte ich mir mal genauer ansehen und habe es testweise mal „installiert“. Wow! Das ist fix! Und interessant in die Historie von Unix einzutauchen. Um euch auch daran teilhaben zu lassen habe ich diesen „mirror“ hier erstellt. Die Datei dazu könnt Ihr euch hier runterladen: MinixHD.tar.xz


MinixHD.bin is a raw 1GB HD image which can be used as ASCI image for Hatari. The first partition, drive C:, boots via AHDI 6 into the well known desktop. Among others you will find three files to boot Minix:

  • MINIX.PRG: will load a Minix boot disk from a file named „minix.img“ and execute it.
  • MINIX202.IMG is a Minix 2.0.2 boot disk which expects the root file system on the third partition of the hard disk.
  • MINIX204.IMG is a Minix 2.0.4 boot disk which expects the root file system on the fourth partition. Just rename one of the .IMG files to „MINIX.IMG“ and run MINIX.PRG to get into Minix.

By default there are three console windows. To switch between them inside Hatari use , the original Atari key is . There are two root logins, root with shell /bin/sh and toor with /usr/bin/ash, which is much more comfortable. Password for both is „Geheim“. To log in as ordinary user use „minix“ with password „Geheim“.

The console driver supports three character sizes: 25 lines (default), 33 and 50 lines. To switch to another size use setvt <# of lines>. There are suitable termcap entries „mx33“ and „mx50“.

Network is started at boot to give an example how to run it. Of course you have to edit /etc/hosts, /etc/netstart, /etc/resolv.conf to fit into your network environment. Connection is realised via SLIP over RS232 with 19200 baud. On a NetBSD counterpart I run the following script to connect:

if ! /sbin/ifconfig sl0 >/dev/null 2>&1 ; then
/sbin/ifconfig sl0 create
fi
/sbin/slattach -l -s 19200 /dev/ttyb
/sbin/ifconfig sl0

Hard disk driver:
The hard disk driver uses 16 minor devices per drive: minor 0 is the whole disk, minor 1 to 12 are partitions according to the drive descriptor, minor 13 is the device descriptor itself, 14 isn’t used and 15 is used to ship the drive. The names of the devices are hdN[a-p], so drive C: of the image is  /dev/hd0b and the third partition holding the Minix 2.0.2 root file system is /dev/hd0d.

The layout of the disk image:

  • /dev/hd0b: TOS boot partition
  • /dev/hd0c: Unused
  • /dev/hd0d: Minix 2.0.2 root file system.
  • /dev/hd0e: Minix 2.0.4 root file system.
  • /dev/hd0f: Minix 2.0.2 /usr.
  • /dev/hd0g: Minix 2.0.4 /usr.
  • /dev/hd0h: stuff on Minix FS
  • /dev/hd0i: TOS, empty.
  • /dev/hd0j: TOS, empty.

Floppy disk driver:
The floppy disk driver is able to use „autoconfig“ (guess disk format) and floppy disks with a different number of sectors. For normal double density disks the are three possible sector counts: 9, 10 and 11. The driver is also capable to partition a disk like Intel Minix though this isn’t very useful on such small devices. The naming of the devices:

  • fd0: autoconfig first drive.
  • fd1: autoconfig second drvie.
  • fd0[a-d]: partitions on first drive
  • fd1[a-d]: partitions on second drive
  • dd0s9: first drive, 9 sectors per track (standard, 720k)
  • dd0s10: first drive, 10 sectors per track (800k)
  • dd0s11: first drive, 11 sectors per track (880k)
  • dd1s9: second drive, 9 sectors per track (standard, 720k)
  • dd1s10: second drive, 10 sectors per track (800k)
  • dd1s11: second drive, 11 sectors per track (880k)

To format floppy disks you can’t use the standard format utility, you must use xformat.

Compiler:
There is no „standard“ or „original“ Ansi C-Compiler for Minix/ST. Minix 1.5 came with an K&R style compiler which could not be used for Minix 2. There are four C-Compilers:

  • Sozobon-C: The Sozobon-C is my first choice for Minix. It runs faster than all the others and produces the fastest code. It’s disadvantage are a not good error handling and often useless error messages, so if you are really searching for a mistake, this compiler leaves you alone. Source code of Sozobon compiler (hcc), Optimizer (top), Assembler (jas) and compiler driver (minixcc) is included. It is called acc.
  • C68: C68 runs medium fast, produces good code and gives a lot of useful messages. Unfortunately it sometimes fails (produces wrong code), e.g. it fails to compile the floppy disk driver. It’s driver is /usr/local/bin/cc68.
  • GNU-C: You know this one – but not this version. It was the recent one, when I started the port, so don’t laugh. It’s GCC version 1.42. gcc is a really big program, runs fairly fast, produces good and reliable code and provides good diagnostics. The first version of my port used the GNU object format, the current one switched to the ACK format, that’s why the name: gcc-ack.
  • ACK-5.5: The old „Amsterdamer Compiler Kit“ Version 5.5. The code was released when my Minix-St 2.0.x was almost ready, but it was fun to let my old SUN-3 build it. And as a side effect, there are Modula-II and Pascal for Minix-St! It runs relativly slow, is good in diagnostics and has some restrictions, for example 16-bit integers in switch selectors, which prevent it from compiling the new regex() function. It’s called cc.

All compilers except the ACK have the option to choose between 16 oder 32 bit integers. 32 bit integers are a good choice to port bigger software. GNU-C and CVS are two examples, GNU-C only runs if it was compiled with 32 bit integers. Sozobon and C68 use libraries from /usr/lib, GNU-C from /usr/local/gnu/liba and the ACK searches /usr/lib/m68000.

On my approach to port Minix to the Atari I wanted to change the source code as less as possible. One decision was to use my own makefiles and that’s why it is almost always necessary to call make with „-f “ to build parts of Minix-ST 2.0.x:

src/sttools:
src/kernel:
src/mm:
src/fs:
src/inet: Use „makeack.soz“ for Sozobon or „makeack.c68“ for C68.

To build a new kernel edit and /usr/src/kernel/stmain.c to fit your needs, cd to /usr/src/sttools and run „make -f makeack.soz floppy“.

src/lib: Edit „makeconfig“, set cfg to your choice and then call make -f makefile.all. This will build the whole library under the directory libs. For ACK you can use the original Makefile, just call make.

src/commands: „make -f makeack.soz all“ for Sozobon, „make -f makeack.c68“ for C68 and „make“ for ACK.

On /dev/hd0h you find the source of programs which are not part of Minix.

For Minix 2.0.4 I implemented the idea of a „shared library“: The standard C library is running as a paused process which can be used by any other process. You find it under /usr/local/src/libshared on the Minix 2.0.4 usr partition. Under /usr/src/commands there is a Makefile called „makeacks.soz“ which will compile all Minix commands using the shared library – but be shure the process „shlib“ is started before you run any program linked against this lib. As a backup there is a copy of normally linked executables under /usr/bin-static.

Enjoy!

Volker

P.S.: I would appreciate your comments, please sent an email to: post68er at gmx dot de