xv6

While adding pages & stuff to http://gunkies.org/wiki/Unix_System_6 I came across this thing called xv6 at MIT.

http://pdos.csail.mit.edu/6.828/2006/index.html

What it is, is a port of Unix v6 to the x86 cpu. Before this, apparently they were using actual v6 on a PDP-11 emulator, however for their uses it would be easier to use something more i386 like. Now the cool part is that it’s SMALL. It harkens back to the day when people could actually read the code to their OS..

# cat *.c wc -l
6384
cat *.h wc -l
1019
cat *.S wc -l
311

Yes, that all there is to it! It litteraly takes 4.5 seconds to compile the whole thing, and setup a boot/root disk image on a 1.5 Ghz P4. The only ‘catch’ is that you need elf tools to build the thing.. Most Linux/NetBSD/OpenBSD folk ought to be in luck as they have been elf for quite some time now.. For windows people it’s just easier to install an OS into a VM that contains an ELF toolchain.. Don’t feel bad about compiling it in a VM as it will not be that big of an ordeal.

Download the inital source from here: http://pdos.csail.mit.edu/6.828/2006/src/xv6-rev0.tar.gz

If you feel brave go thru the labs.. They have stuff to add like virtual memory and whatnot, but they do walk you thru it, with guides and stuff… Remember this is out of a class, they don’t throw the kids to the wolves as it were.

Naturally since it’s v6, there is no TCP/IP, heck it doesn’t even have native tools… But it *can* run exe’s so it’s got enough to get your feet wet.. It’s dammed near tempting to complete the course work to flesh it out, grab 32v and start building a userland then bring it to 3BSD levels… But then I guess that is missing the point of a small readable Unix.

Anyways I found it interesting, no pictures on this one but either way its… different. Oh and the disk images run great under Qemu for what it’s worth.

MacMiNT

MacMint

MacMint

Recently I came across a Power Macintosh 5400/120 at a garage sale for the bargain price of $12! I couldn’t believe my luck, for under $20 I had a fully working computer!

Except that it won’t run OS X 1.0
And it only has 8Mb of ram.

Because of its memory restrictions it can only run Mac OS 7.6

What to do….

MacMINT!

MINT back in the day for AtariST’s was a UNIX like layer that ran on top of TOS (The Atari MS-DOS like OS) and provided basic Unix services. With the program aptly called JET (Just Enough TOS), the Macintosh 68000’s can setup a TOS compatible interrupt vector table, and run TOS procedure emulation to run the MINT binaries under MacOS!

So, it’s UNIX!

Sort of.

First you need to disable Virtual Memory… That’s bad.
Next it doesn’t support TCP/IP so it’s like being on Unix v6. But it’s fun at any rate.

You can find the binaries at my mirror of sra.co.jp here.

It includes gcc 2.5.8, and a somewhat basic environment. It does have lots of potential, but the biggest gripe is that 8Mb of ram just isn’t enough to do any serious compiling, and yes it will crash with virtual memory enabled. Also since it is 68000 programs it is running under emulation.. I have to admit that I am tempted to buy some kind of 68000 based Macintosh to run MacMiNT.

I know this may not be terribly useful to people, but then again someone has to do something fun/weird on a $12 machine. I fully expect to either get a ‘bigger’ 68000 box, or more ram and run something like simh on it. I can only wonder how usable the PDP11 or the Interdata32 are.

And for anyone, like me wants a ‘clear’ program, just because, here is a simple one, just remember to link with -ltermcap.

#include <stdio.h>
#include <stdlib.h>
#include <termcap.h>

void main()

{

char buf[1024];
char buf2[30];
char *ap;
char *clearstr;

ap=buf2;
tgetent(buf,getenv(“TERM”));
clearstr=tgetstr(“cl”,&ap);
fputs(clearstr,stdout);

}

Unix v7 for the x86!

Ok so this isn’t exactly emulation, since you can already run Unix v7 via simh’s PDP11 emulator, however you cannot overlook the coolness factor of this. They have ported v7 to the i486 cpu.

http://www.nordier.com/v7x86/index.html

In other news I’ve done a very preliminary port of the SLiRP stack from Qemu to SIMH. What is cool about this, is that it allows user mode networking so that you do not have to configure any drivers on the host. Currently I have 4.3BSD-Reno running under the MicroVAX II simulator. I’m going to add some extra utilities (gzip/gcc/gnumake/ircii-4/lynx?/wget?/apache?), convert the SMM into PDF’s, and make it into an install package, much like the 4.2BSD on sourceforge.

If anyone want’s to alpha test it, let me know, otherwise the next post will most likely be the release of 4.3BSD-RENO with NAT!

Happy Thanksgiving!

Running Xenix on qemu

Neither Bochs nor Qemu can boot the Xenix floppy diskettes all the way. Virtual PC & VMWare seemed to have no luck when the kernel transitions to protected mode. While on the way to work I had an idea. What if you had an old hard disk and a machine capapble of installing? Simply imaging the hard disk may be enough, since after that point you don’t need any floppy disks!

So this is what I have to show for the work today:

Freaking awesome, if I do say so myself.

OK, now how to do it? First you need an existing system running Xenix. If you have any plans on migrating an existing installation take note! This will preserve your install, just don’t format! On the Xenix boot screen take note of the geometry of the disk. We will need the geometry for later. Although I did a test boot without it, its a good thing to preserve it.

For virgin users, you will need a small disk to install on. I had a 2.5 GB disk that was too big, and 132MB disk that worked fine. I used a dell pc with 2 ide controllers for this. The longest task honestly was installing Xenix. I think that ran about 20 minutes. Once I was done, shutdown xenix, and put the disk in a machine running Windows (Linux fans can put it in their box, and just dd the Xenix disk into an image). Us poor Windows users don’t have dd. Anyways take not of what disk # it is, as Windows of course will not assign it a drive letter since it does not understand Xenix’s filesystem.

As you can see it’s disk #2 in this computer. Ok now we need to read the disk and write it into a disk image. I couldn’t find a util offhand to do it, so I wrote one real quick. Here is the source code, you’ll need a C compiler on your PC to compile it. I guess I could ‘neaten it up’ some, but for now here you go:

Source code

Executable

Yes I know its horrible, and blogger does a wonderfull job of formatting my program. Anyways compile it & run it. Now you’ll have a disk image of your hard disk!

Now for the fun part, running Xenix! We simply specifiy the hard disk geometry that we got earlier, and pass it the disk image that we created! I’m using an Quantum Pro drive ELS with the following geometry:

919 Cylinders
16 heads
17 bytes/sector

That translates into the following command:

qemu -M isapc -m 16 -hda xenix386-2.3.4.disk -hdachs 919,16,17 -L .

 

Let the good times roll!

–Update from 2011!

It is *NOW* possible to install Xenix in Qemu 0.14.0. You can read more about it here.