This past Halloween, Alan Cox announced Fuzix OS, a project for building a UNIX-like operating system for 8 bit computers, based on UZI sources. This OS targets a number of physical machines, both old and homebrew computers, and some emulators too.
The easiest and more approachable way for trying Fuzix OS is running it on
cpmsim, which comes bundled inside the Z80pack package. If want to give it a try the easy way, just continue reading.
Getting and building SDCC and Z80pack
SDCC (Small Device C Compiler) is an specialized C compiler for microcontrollers. For building SDCC, we’re going to need some other software packages on our distro:
* GCC (I'm not sure if an specific version is need. As refernce, I've used 4.8) * GCC C++ * bison * flex * boost-devel
We’re also going to check out an specific revision from SVN, as the latest tarball lacks some features required by Fuzix. Once checked out, the usual configure & make recipe will do the trick:
[shell] svn checkout http://svn.code.sf.net/p/sdcc/code/trunk sdcc-code -r9145 cd sdcc-code/sdcc ./configure –prefix=/usr –disable-pic14-port –disable-pic16-port make sudo make install [/shell]
As for Z80pack, the procedure is pretty similar, but this time the latest tarball is enough:
[shell] wget http://www.autometer.de/unix4fun/z80pack/ftp/z80pack-1.24.tgz tar xzvf z80pack-1.24.tgz cd z80pack-1.24/cpmsim/srcsim make -f Makefile.linuxc cd ../srctools make [/shell] Creating Fuzix OS disk images
Now it’s time to get our hands dirty with the code we’re really interested in. The build process is still a bit crude, but improving day by day. Let’s see:
[shell] git clone https://github.com/EtchedPixels/FUZIX.git cd FUZIX/Standalone make cd ../Kernel sed ’s/TARGET=.*/TARGET=z80pack/’ Makefile > Makefile.tmp && mv Makefile.tmp Makefile make [/shell]
At the moment (probably, this is going to be fixed in a near future), we need to manually copy the userspace library to an specific location (
[shell] cd ../Library make cd libs make cd .. sudo mkdir -p /opt/fcc/lib /opt/fcc/include /opt/fcc/bin sudo cp -a libs/crt0.rel libs/c.lib libs/syslib.lib /opt/fcc/lib sudo cp -a include/* /opt/fcc/include sudo cp -a tools/fcc tools/binman tools/syscall /opt/fcc/bin [/shell]
Now we can continue building the userspace utils and putting everything together inside two disk images:
[shell] cd ../Applications/util make cd ../../Kernel/platform-z80pack ./createdrives [/shell]
At this point, you should have two new files named
drivea.cpm (a floppy disk with the kernel and a small number of binaries) and
drivei.cpm (a hard disk for mounting on
/usr with the binaries that doesn’t fit on the floppy) inside
Running Fuzix OS!
Now we just need to copy both disk images to
$Z80PACK_PATH/cpmsim/disks and start the simulator. In my case, as I’ve put the sources for Z80pack on
$HOME/sources/z80pack-1.24, I just need to do this:
[shell] rm $HOME/sources/z80pack-1.24/cpmsim/disks/drive* cp drivea.cpm drivei.cpm $HOME/sources/z80pack-1.24/cpmsim/disks cd $HOME/sources/z80pack-1.24/cpmsim ./cpmsim [/shell]
You should be greeted by Fuzix, asking you for a boot device:
[generic] slp@linux-zz59:~/sources/z80pack-1.24/cpmsim> ./cpmsim
####### ##### ### ##### ### # #
####### ##### ### ##### ### # #
Release 1.24, Copyright © 1987-2014 by Udo Munk
CPU speed is unlimited
- FUZIX version 0.1 Copyright © 1988-2002 by H.F.Bower, D.Braun, S.Nitschke, H.Peraza Copyright © 1997-2001 by Arcady Schekochikhin, Adriano C. R. da Cunha Copyright © 2013-2015 Will Sowerbutts email@example.com Copyright © 2014 Alan Cox firstname.lastname@example.org Devboot 480kB total RAM, 416kB available to processes (15 processes max) Enabling interrupts … ok. bootdev: [/generic]
0 as boot device, log in with as
root, and mount the hard disk on
[generic] bootdev: 0 Mounting root fs (root_dev=0): OK Starting /init init version 0.8.1ac 06login: root
ssh# mount /dev/hda /usr 05ssh# id 05uid=0(root) gid=0(root) 05ssh# banner FUZIX FFFFFFF U U ZZZZZZZ I I X X F U U Z I X X F U U Z I X X FFFFF U U Z I X F U U Z I X X F U U Z I X X F UUUUU ZZZZZZZ III X X ssh# [/generic]
That’s it. Now you can start playing around, getting familiar with Fuzix at its code. If you like the feeling, the beauty of the 8 bit simplicity, then perhaps you’ll consider running it on a physical machine, like one of the N8VEM boards, or Will Sowerbutts’ FPGA based socz80 (if you have a DE0-nano board, you can try my port to this hardware).
Happy (8 bit) hacking!