NetBSD 0.9

Well by some strange google search I actually found a site in Russia that had NetBSD 0.9 for the i386! Wasting no time, I mirrored the site on my VPS, then spent some time late last night trying to figure out how to boot this thing, but to no avail. Qemu, Virtual BOX and Virtual PC, could not boot the disk images correctly, while BOCHS was running into all kinds of errors related to the 0.9 kernel’s floppy, and hard disk errors with 1.0’s handling of the hard disk.

So for the heck of it, I tried it on VMWare Fusion for OS X, and lo, it booted the NetBSD 0.9 kernel floppy! So I went ahead, and made all the diskettes for the release, and went ahead and installed it on VMWare. Now while VMWare may be able to install NetBSD, it doesn’t emulate peripherals like NE2000’s so networking would involve PPP or SLIP over the COM port, which sounds like a lot of work, looking back to my adventure with SLIP a while back, that I’m not looking to redo anytime soon.

So with my installed VMDK (the disk file VMWare uses), I used the qemu utility qemu-img to convert it to a compressed qcow2 image, then booted up Qemu with the image.

And it worked!

So with that in hand, I rebuilt Qemu to remove the NE2000 on 0x300/IRQ 9, and then rebuilt the NetBSD kernel to remove all the devices I don’t need/care about (SCSI,NFS,MATH EMULATION,etc..) and reconfigured the NE2000 to be on 0x320 IRQ 10, to match Qemu, and then ran the whole thing together, configured the network, and it seemed to be working fine.

From there it was a matter of transferring the disk image back to VMWare, I copied in the source code for lynx and ircII-4.4 then transfered it back to Qemu. And yes they worked as expected!

The only thing remaining in my flight of adventure was to build f2c, and see if it’d run Dungeon.

xx

Yes it runs Dungeon!

So with all of that out of the way, for anyone that wants to run it, I’ve uploaded my work on my sourceforge project page.

Now I just need to find myself a copy of NetBSD 0.8, and spend some more time with 386 BSD 0.0 & the hard disk parameters to see if I can get that to cleanly install.

In the meantime, feel free to load up NetBSD 0.9, fire up irc and say hi.

Qemu compression & encryption

Well after I gave up on one VPS I’ve had for a long time, I picked up a handful of $5 ones world wide… Some in nations I’ve been to, and others.. I’m not so sure I trust at all..

Which really calls into question just how much can you trust on the internet, esp when it’s data you can’t or seemingly don’t encrypt.. This is where Qemu’s qcow format can step in and provide either…

Or simply you are on a particular VPS, and you want to run something completely different, but you don’t want to be short of disk space.

From what I’ve found with qemu it’s quite easy, with only one snag for the whole thing. That being no matter if you decide to Compress or Encrypt, you can only CONVERT a disk into this schema, not create one.

So if you have an existing disk image, it’s a snap, otherwise, it’s a 2 step process that I’m sure is here for a good reason. Anyways the process for both goes like this:

qemu-img create -f qcow2 template.disk 2G
Formatting ‘template.disk’, fmt=qcow2 size=2147483648 encryption=off cluster_size=0

qemu-img convert template.disk -O qcow2 compressed.disk -c

qemu-img convert template.disk -O qcow2 encrypted.disk -e
Disk image ‘encrypted.disk’ is encrypted.
Password: password

Which naturally first creates a 2GB ‘template’ disk, which then we create a compressed disk, and an encrypted disk image. And it is here were the encryption will ask you for a password… Sadly it doesn’t verify your input, so make sure you type it in correctly. Thankfully the original isn’t destroyed so if you screw it up you can encrypt it again……

So now mounting the compressed disk is no different then before, however the encrypted will need a password, passed to the qemu monitor…

Now you may want to run this behind something like screen if you are on any *NIX or telnet into yourself if you are on windows to shove the service in the background to not rely on a console… So I’ve worked up this:

qemu -L pc-bios -hda encrypted.disk -monitor telnet:127.0.0.1:23,server

And for UNIX people who can run it interactivly because their stdio driver isn’t broken..

qemu -L pc-bios -hda encrypted.disk -monitor stdio

Now when you start either one, Qemu will start paused, and you must continue, then enter the disks password (if you have more then one disk, it’ll pause and ask for each disk!), then it’ll execute.

QEMU 0.11.1 monitor – type ‘help’ for more information
(qemu) c
ide0-hd0 (encrypted.disk) is encrypted.
Password: ********
(qemu)

And away you go… From what I understand qemu uses zlib for the compression, and AES for the encryption… Which for free is snazzy, so enjoy!

Qemu & the PC98

I have only seen one NEC PC-98 in my life, and naturally it was in Japan.. Wiki has a great article, (naturally), basically it was an intel powered IBM incompatible system, that ran an adapted version of MS-DOS localized to Japanese. It wasn’t until the introduction of Windows 95, did these machines die out, as 95 could be localized pretty well..

Anyways, after googling around to see who linked my builds of Qemu, I found this site, by Takeda Toshiya that includes patches and binaries for PC-98 emulation via Qemu!

I understand the PC-98 had quite a following for all kinds of games as people shifted away from the Sharp X68000.. Who also announced last week that they would exit the PC market all together.

091025-1

Qemu 0.13.0 for Win32

Another thing to ‘fix’ in addition to the 0.13.0rc1 is this..

qemu-char.c:2092: undefined reference to `qemu_chr_open_fd’

I just commented out line 2092. I’m not sure what the deal is, as the sparc boots up solaris 2.6 just as it always has (with the same syslog/vold issues… )

Anyways, as always the i386/x64 ONLY binaries are here:

And the whole package is here, which includes the i386/x64 support.

Let me stress for those of you clicking like wild that if you are just emulating a typical pc you only need the much smaller download… As for the rest, well you know the deal.

I’ve also built this out on my mac, but it’s x86_64, so you 32bit people would be out of luck.. I’m not sure if I could do a multiple arch build in one shot, or use lipo to just glue them together???

I donno.

Qemu-0.13.0 MIPS - NT 4

Anyways, I’ve tested Solaris 2.6 (SPARC) and NT 4.0 (MIPS) so I imagine everything else is ok….

Qemu version 0.13.0 rc1

Qemu version 0.13rc1 has now been released!

I’ve found two issues so far when building on Windows… In the file vnc-enc-tight.c I’ve had to add the following line to the top:

typedef unsigned int uint;

And the next being in the file ui/sdl.c

The MinGW environment doesn’t seem to allow the setenv call, so I just remove the lines…

if (!full_screen) {
setenv(“SDL_VIDEO_ALLOW_SCREENSAVER”, “1”, 0);
}

One other thing I’ve done is modified the hw/pc.c and removed the 0x300/irq 9 NE2000 NIC, as there is some IRQ conflict on number 9…

At any rate, I’ll provide binaries for Windows users, a x86 only package is here, while the larger ‘full’ package is here.

Formatting disks for Solaris

This applies to Qemu and real SPARC’s… Anyways, every disk that Solaris uses has to be tagged with a special ‘format’ and disk label for use. When you buy disks from SUN they did this at the factory. However if you go ahead with a 3rd party disk, you’ll have to do this yourself.

Luckily it’s not all that hard.

So in this quick example we’ll add a 36GB disk to Qemu for use with Solaris 2.6

Now I’ve had issues with Solaris 2.6’s format program so I also use a Solaris 8 CD for that portion. I’m going to assume you’ve got all the bits to make Solaris on Qemu work.

The first step is to create the hard disk.

$ ./qemu-img create -f qcow2 36GB.disk 36GB
Formatting ’36GB.disk’, fmt=qcow2 size=38654705664 encryption=off cluster_size=0

I’m running this on OS X, however the steps are all the same for Linux & Windows users.

Now the next step is to fire up Qemu with the Solaris 8 CDROM.

$ ./qemu-system-sparc -bios ss5.bin -nographic -L . -hda 36GB.disk -m 256 -M SS-5 -cdrom sol-8-u7-install-sparc.iso

Then the ROM will initialize:

Power-ON Reset

$$$$$ WARNING: No Keyboard Detected! $$$$$
MMU Context Table Reg Test
MMU Context Register Test
MMU TLB Replace Ctrl Reg Tst
MMU Sync Fault Stat Reg Test
MMU Sync Fault Addr Reg Test
MMU TLB RAM NTA Pattern Test
ERROR : Address= 000000fc, exp= 07ffffdc, obs= 00000000, xor= 07ffffdc
initializing TLB
initializing cache

Allocating SRMMU Context Table
Setting SRMMU Context Register
Setting SRMMU Context Table Pointer Register
Allocating SRMMU Level 1 Table
Mapping RAM
Mapping ROM

ttya initialized
Probing Memory Bank #0 32 Megabytes
Probing Memory Bank #1 32 Megabytes
Probing Memory Bank #2 32 Megabytes
Probing Memory Bank #3 32 Megabytes
Probing Memory Bank #4 32 Megabytes
Probing Memory Bank #5 32 Megabytes
Probing Memory Bank #6 32 Megabytes
Probing Memory Bank #7 32 Megabytes
Incorrect configuration checksum;
Setting NVRAM parameters to default values.
Setting diag-switch? NVRAM parameter to true
Probing CPU FMI,MB86904
Probing /iommu@0,10000000/sbus@0,10001000 at 5,0 espdma esp sd st SUNW,bpp ledma le
Probing /iommu@0,10000000/sbus@0,10001000 at 4,0 SUNW,CS4231 power-management
Probing /iommu@0,10000000/sbus@0,10001000 at 1,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 2,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 3,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 0,0 Nothing there
screen not found.
Can’t open input device.
Keyboard not present. Using tty for input and output.
Probing Memory Bank #0 32 Megabytes
Probing Memory Bank #1 32 Megabytes
Probing Memory Bank #2 32 Megabytes
Probing Memory Bank #3 32 Megabytes
Probing Memory Bank #4 32 Megabytes
Probing Memory Bank #5 32 Megabytes
Probing Memory Bank #6 32 Megabytes
Probing Memory Bank #7 32 Megabytes
Incorrect configuration checksum;
Setting NVRAM parameters to default values.
Setting diag-switch? NVRAM parameter to true
Probing CPU FMI,MB86904
Probing /iommu@0,10000000/sbus@0,10001000 at 5,0 espdma esp sd st SUNW,bpp ledma le
Probing /iommu@0,10000000/sbus@0,10001000 at 4,0 SUNW,CS4231 power-management
Probing /iommu@0,10000000/sbus@0,10001000 at 1,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 2,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 3,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 0,0 Nothing there

SPARCstation 5, No Keyboard
ROM Rev. 2.15, 256 MB memory installed, Serial #0.
Ethernet address 52:54:0:12:34:56, Host ID: 80000000.

Boot device: /iommu/sbus/ledma@5,8400010/le@5,8c00000 File and args:
Internal loopback test — Wrong packet length; expected 36, observed 64

Can’t open boot device

Type help for more information
ok

Now we boot off the CD-ROM, but into single user mode, with the verbose flag…

ok boot disk2:d -vs

Now the kernel will boot up, and dump us into single user mode. Take note about the disk having a “corrupt label – wrong magic number’ error.

Boot device: /iommu/sbus/espdma@5,8400000/esp@5,8800000/sd@2,0:d File and args: -vs
Size: 259712+54162+47510 Bytes
SunOS Release 5.8 Version Generic_108528-13 32-bit
Copyright 1983-2001 Sun Microsystems, Inc. All rights reserved.
Ethernet address = 52:54:0:12:34:56
Using default device instance data
vac: enabled in write through mode
mem = 262144K (0x10000000)
avail mem = 258383872
root nexus = SUNW,SPARCstation-5
iommu0 at root: obio 0x10000000
sbus0 at iommu0: obio 0x10001000
dma0 at sbus0: SBus slot 5 0x8400000
dma0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000
/iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000 (esp0):
esp-options=0x46
esp0 at dma0: SBus slot 5 0x8800000 sparc ipl 4
esp0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000
sd0 at esp0: target 0 lun 0
sd0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0
WARNING: /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0 (sd0):
corrupt label – wrong magic number

Vendor ‘QEMU’, product ‘QEMU’, 75497472 512 byte blocks
sd2 at esp0: target 2 lun 0
sd2 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@2,0
root on /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@2,0:b fstype ufs
obio0 at root
obio0 at obio0: obio 0x100000, sparc ipl 12
zs0 is /obio/zs@0,100000
obio1 at obio0: obio 0x0, sparc ipl 12
zs1 is /obio/zs@0,0
cpu0: FMI,MB86904 (mid 0 impl 0x0 ver 0x4 clock 1200 MHz)
Configuring /dev and /devices
pseudo-device: devinfo0
devinfo0 is /pseudo/devinfo@0
ledma0 at sbus0: SBus slot 5 0x8400010
le0 at ledma0: SBus slot 5 0x8c00000 sparc ipl 6
le0 is /iommu@0,10000000/sbus@0,10001000/ledma@5,8400010/le@5,8c00000
pseudo-device: fssnap0
fssnap0 is /pseudo/fssnap@0
sbusmem0 at sbus0: SBus slot 0 0x0
sbusmem0 is /iommu@0,10000000/sbus@0,10001000/sbusmem@0,0
sbusmem1 at sbus0: SBus slot 1 0x0
sbusmem1 is /iommu@0,10000000/sbus@0,10001000/sbusmem@1,0
sbusmem2 at sbus0: SBus slot 2 0x0
sbusmem2 is /iommu@0,10000000/sbus@0,10001000/sbusmem@2,0
sbusmem3 at sbus0: SBus slot 3 0x0
sbusmem3 is /iommu@0,10000000/sbus@0,10001000/sbusmem@3,0
sbusmem4 at sbus0: SBus slot 4 0x0
sbusmem4 is /iommu@0,10000000/sbus@0,10001000/sbusmem@4,0
sbusmem5 at sbus0: SBus slot 5 0x0
sbusmem5 is /iommu@0,10000000/sbus@0,10001000/sbusmem@5,0
NOTICE: SBus clock frequency out of range.
pseudo-device: winlock0
winlock0 is /pseudo/winlock@0
pseudo-device: lockstat0
lockstat0 is /pseudo/lockstat@0
pseudo-device: llc10
llc10 is /pseudo/llc1@0
NOTICE: audiocs0:Couldn’t set value (../../sun/io/audio/sada/drv/audiocs/audio_4231.c, Line #1738 0x00 0x88)
audiocs0:audio may not work correctly until it is stopped and restarted
audiocs0 at sbus0: SBus slot 4 0xc000000 SBus level 5 sparc ipl 9
audiocs0 is /iommu@0,10000000/sbus@0,10001000/SUNW,CS4231@4,c000000
pseudo-device: lofi0
lofi0 is /pseudo/lofi@0
pseudo-device: fcp0
fcp0 is /pseudo/fcp@0
Using RPC Bootparams for network configuration information.
/sbin/rcS: manual_find_and_mount_cdrom: not found

INIT: SINGLE USER MODE
#

I now issue the drvconfig/disks commands. This is more useful for adding disks to a live system..

# drvconfig
NOTICE: SBus clock frequency out of range.
inst_sync failed for /etc/path_to_inst.66: Read-only file system
drvconfig: WARNING: failed to update /etc/path_to_inst
# disks
disks: mkdir failed for /dev 0x1ed: Read-only file system

Now for the fun part of ‘formatting’ the disk. Looking at this page, they give the geometry of a SCSI disk with a capacity of 36 GB as:

24,622 cylinders
27 heads
107 sectors

As a note the format program likes to reserve the last 2 cylinders, so you must answer this appropriately.

So using the above information, I run the format command like this:

# format
Searching for disks…WARNING: /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0 (sd0):
corrupt label – wrong magic number

Vendor ‘QEMU’, product ‘QEMU’, 75497472 512 byte blocks
done

AVAILABLE DISK SELECTIONS:
0. c0t0d0
/iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0
Specify disk (enter its number): 0

AVAILABLE DRIVE TYPES:
0. Auto configure
1. Quantum ProDrive 80S
2. Quantum ProDrive 105S
3. CDC Wren IV 94171-344
4. SUN0104
5. SUN0207
6. SUN0327
7. SUN0340
8. SUN0424
9. SUN0535
10. SUN0669
11. SUN1.0G
12. SUN1.05
13. SUN1.3G
14. SUN2.1G
15. SUN2.9G
16. Zip 100
17. Zip 250
18. other
Specify disk type (enter its number): 18
Enter number of data cylinders: 24620
Enter number of alternate cylinders[2]:
Enter number of physical cylinders[24622]:
Enter number of heads: 27
Enter physical number of heads[default]:
Enter number of data sectors/track: 107
Enter number of physical sectors/track[default]:
Enter rpm of drive[3600]:
Enter format time[default]:
Enter cylinder skew[default]:
Enter track skew[default]:
Enter tracks per zone[default]:
Enter alternate tracks[default]:
Enter alternate sectors[default]:
Enter cache control[default]:
Enter prefetch threshold[default]:
Enter minimum prefetch[default]:
Enter maximum prefetch[default]:
Enter disk type name (remember quotes): Qemu36GB
selecting c0t0d0
[disk formatted]

FORMAT MENU:
disk – select a disk
type – select (define) a disk type
partition – select (define) a partition table
current – describe the current disk
format – format and analyze the disk
repair – repair a defective sector
label – write label to the disk
analyze – surface analysis
defect – defect list management
backup – search for backup labels
verify – read and display labels
save – save new disk/partition definitions
inquiry – show vendor, product and revision
volname – set 8-character volume name
! – execute , then return
quit
format>

Finally we just slap down a label and we should be good to go. I run the command twice to make sure that it took, as it should only mention the corrupt number one more time, then it’ll be ok.

format> label
Ready to label disk, continue? y

WARNING: /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0 (sd0):
corrupt label – wrong magic number

Vendor ‘QEMU’, product ‘QEMU’, 75497472 512 byte blocks

format> l
Ready to label disk, continue? y

format>

Now we can quit, and reboot the VM.

format> q
# reboot
syncing file systems… done
rebooting…
Resetting …

And that’s it!

I’ve since then booted it up under Solaris 2.6, and now in the bootup it shows up like this:

sd0 at esp0: target 0 lun 0
sd0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0

And even in the Solaris 2.6 install…

Disk Device (Size) Available Space
=============================================
[X] c0t0d0 (34730 MB) 34730 MB (F4 to edit)

Total Selected: 34730 MB
Suggested Minimum: 487 MB

And that’s about it.

Win32 to be dropped from Qemu?

From an anonymous posting on here, I heard about this:

http://lists.gnu.org/archive/html/qemu-devel/2010-08/msg00537.html

since several months, QEMU for Windows (and mingw32 cross builds)
no longer builds without error.

I suspect that the same is true for QEMU on Darwin (lots of errors like
darwin-user/qemu.h:149: error: cast to pointer from integer of different size),
but I’m not sure here because I have no valid Darwin test environment.
Maybe someone can test this.

What about these environments? They have no maintainers.
Should they be marked as unsupported? Are they still used?
Or should they be removed?

Man, I sure hope it’s not the end of the road for Windows hosts running Qemu….

Linux 0.00 & 0.11 on Qemu!

While checking out oldlinux.org, I came across two things that are somewhat exciting.

The first, is Linux 0.00 The first ever known version of Linux. It’s only two assembly files, an 8086 booter, and the 80386 kernel that sets up protected mode, and two hard coded tasks, then runs the two tasks. It’s very exciting. There is even some commented source available on the oldlinux forum here.

For those who want to check it out, I’ve padded it out onto a diskette image on sourceforge here.

Don’t expect too much, it just prints “AAAA” and “BBBB” over and over, but it’s the first booting version of Linux.

The next thing I found was a BOCHS archive with Linux 0.11 installed, along with GCC 1.40 and a few other programs. This image can even build Linux 0.00 and a slightly modified version of 0.11 that can run bash. I’ve found BOCHS somewhat difficult to configure, and since Qemu is faster, I’ve converted the disk image into a ‘qcow2’, then got it running on Qemu 0.12.5. Just unzip the archive here, and you can be running some really ancient Linux.

Linux 0.00 in action.

Linux 0.00 in action.

Remember that Linux 0.11 is OLD. At this point it didn’t support multiple users, nor did it even have a shutdown or reboot command. Instead we all ran ‘sync’ a dozen times, then pulled the plug. Also it was VERY unstable, and quite prone to panics and crashes.. Although I think a majority of them back then were due to file system corruption from pulling the plug at the wrong time… 🙂

Linux 0.11 on Qemu 0.12.5

Linux also had no support for things like TCP/IP, UUCP, shared libraries, etc… although I’m pretty sure it had working serial port support.. In many ways it feels like 32v, although more primitive. This disk image also has the ability to re-build the patched kernel, and even Linux-0.00. What is also cool is the ‘shoelace’ loader which can boot the Linux kernel, so you don’t have to suffer the boot/root disks of the time, and the fun of hex editing stuff.

For people that love ancient stuff from 1991 this will be great fun indeed!

***UPDATE

For people who are interested in ancient Linux on Windows, I did get the toolchain to build with MinGW, and it seems to work ok!  I have a post about it here.  I have also been able to get the 32bit portion of the Linux kernel to cross compile on Windows as well!  That adventure is here.