I've had permission from Robert Swartz himself to distribute the first perfectly legal Coherent 4.2.10 QEMU image as long as you comply with the following conditions:
You may use the software on this image free of charge for personal, non-commercial use. You may NOT redistribute this image or the software it contains without written permission from the copyright holder. The software is provided on an "as is" basis without warranty of any kind.Getting started
Download and unpack the archive. Included are two images, coherent.public.img and fat16.dd. The first one contains the Coherent image, the second one an empty floppy. If you want to, you can start them right away:
qemu-system-i386 -hda coherent.public.img -fda fat16.dd -m 16First, don't try to crank up the amount of memory, Coherent won't use it - at least not this kernel. Second, you just have to be patient to attempt this, because it may take up to 10 minutes before Coherent is up and running. The good news is that you can monitor how far it is by pressing [CTRL]-[ALT]-2 in QEMU and typing:
info blockstatsIf rd_bytes reaches 600,000 you can probably login. There are two login entries, the obvious root with password rootroot and a normal user named habe with password habehabe. Pick any one.
When you've logged in you might want to try the usual stuff like ls -l or ps -eaf, maybe you're even so bold to start up vi or cc. In any case, you will find that everything is painfully slow. If you want to get out, you can do so, but you'll have to be root in order to do it properly. Just issue:
cd; /etc/shutdown halt 0Note it doesn't shutdown immediately! You'll have to wait until Coherent tells you it's safe to power down. Be patient! You can also exit QEMU without shutting down, but in that case you may have corrupted your image. And believe me, at these speeds you do not want to run fsck..
So that's it? Coherent runs, but it is completely unusable? No, not quite. Coherent does some disk caching, so after a while it becomes responsive. That is: until you reboot. But how can you avoid a reboot? Well, it's quite simple. QEMU allows you to make snapshots, so if you need Coherent you don't boot it, but simply load the snapshot.
QEMU only allows snapshots when you're using the so called "qcow2" image type, so we have to convert the files you just downloaded. That's not too hard, since QEMU comes with a handy utility for that. Just issue:
qemu-img convert -c -O qcow2 coherent.public.img Coherent.dskThe latter may give you a warning, but don't worry, we'll only use it as a placeholder. Ok, we're done, let's start it up again:
qemu-img convert -c -O qcow2 fat16.dd fat16.dsk
qemu-system-i386 -hda Coherent.dsk -fda fat16.dsk -m 16Agreed, you're in for the same wait. Sorry for that. But I promise you next time it'll be much faster. Just stay with me for a little while longer. When Coherent comes up, log in as usual. Then press [CTRL]-[ALT]-2 to enter the monitor. Now type:
savevm test0This will save the current state of Coherent in a QEMU snapshot, so you'll end up here next time you start it. Return to the emulation by pressing [CTRL]-[ALT]-1 fiddle around a little bit, start up your favorite commands a few times and then save a new snapshot:
savevm test1Shutdown Coherent properly and start it again, but this time with the command:
qemu-system-i386 -hda Coherent.dsk -fda fat16.dsk -m 16 -loadvm test1Ok, that's more like it, isn't it? Ok, shut it down again. This time you'll be able to start it up much faster. Let's try something fancy now and invoke QEMU with:
qemu-system-i386 -hda Coherent.dsk -fda fat16.dsk -m 16 -serial telnet:localhost:4444,server,nowait -loadvm test1Log in as root and type:
enable /dev/com1lNow start up a terminal session on your host and type:
telnet localhost 4444Yes, you can login to Coherent from your host Operating System. But that's about everything you can do as far as networking under Coherent is concerned.
There is a full TCP/IP stack available for Coherent, but you'll need a special kernel in order to make it work - which doesn't seem to be available. So I haven't succeeded to do much more in this area. If you have, please leave a comment.
Maybe you'll think this small system is so much fun that you want to give it a permanent place on your desktop. That is where the coherent.sh script comes in. It works with both KDE (KDialog) and Gnome (Zenity) and it makes it easier to launch the QEMU/Coherent combination. The only thing you have to do is to state where your disks are located:
COHAT0A=/opt/qemu/coherent.dskIf you want to exchange files between Coherent and your host, you'll have to change /etc/fstab as well:
/opt/qemu/fat16.dd /mnt/coherent msdos rw,user,noauto,loop 0 0Note this is the uncompressed, original file! You can mount the uncompressed Coherent image as well (as sysv), but you won't be able to write to it. I don't think I'll have to tell you how to mount a floppy image, do I? Once the VM is up and running you can exchange the virtual, empty floppy for the raw version by switching to the QEMU monitor and issuing:
change floppy0 fat16.ddHowever, while the raw floppy is online you can't make a snapshot. When you want to take a snapshot you simply return to the dummy floppy by issuing:
change floppy0 fat16.dskOk, now we've cleared that one we can concentrate on the real issue here: how do we get any files from the floppy? That's not as difficult as you think. You'll only need to edit one file, /etc/default/msdos. Make sure the appropriate section reads:
# This is for a system with a 3.5 inch A drive and a 5.25 inch B driveAnd you're ready to rock 'n roll. There is a whole slew of MS-DOS related commands at your disposal like:
doscp /etc/default/msdos a:And copying it back is done by:
doscp a:/msdos /etc/defaultWell, that ain't rocket science, is it? We can use it right away to fix some Y2K issues. Yes, this version of Coherent won't go past the 31st of December 1999, but it is easily fixed by ATclock and date. Copy them to the /bin directory and reboot. That'll fix it.
You may also be tempted to try another kernel. Several ones are available here. Just copy it to the root and hard-link it to autoboot, e.g.:
ln cohat0 autobootNote you can also select a kernel when starting up - just press [SPACE] immediately. Coherent will answer:
If installing COHERENT, please type "begin".But it is actually a prompt for the kernel name. Obviously, if you type autoboot it will boot the default kernel - just in case you don't know how to get out of there ;-)
- Although Coherent comes with a full fledged C compiler, it won't compile your ANSI-C sources, since it is strictly K&R C. However, GCC - and all the GNU stuff that comes along with it - is available. Still, I like the little beast, since it makes small and fast compilants.
- Coherent does have virtual consoles. Press [CTRL]-[NUM0], [CTRL]-[NUM1], etc.
- The archives of comp.os.coherent are compelling reading, featuring Linus Torvalds on who's got the best OS.
- Additional notes and links on the subject are appreciated. Just leave them in the comments.
Good sources for additional software are:
There have been consistent reports on Coherent being considerably faster on QEMU 1.7 and up. Well, I tested it and even if there may be some truth to it, it's not very significant nor consistent. If you can deal with it, convert your QCOW2 image to a raw one, because that will give you the required speedup.
But the biggest drawback is that your C compiler will go haywire, spitting out errors on perfectly fine include files. This behavior was still present on the QEMU 2.0.2 version, although slightly less prominent.
The last QEMU version known to work flawlessly is 1.4.
Coherent is Open Source now (thank you, Jason Stevens)!