Tuesday, October 06, 2015

Fun with SPARC emulators

While illumos supports both SPARC and x86 platforms, it would be a fair assessment that the SPARC support is a poor relation.

There are illumos distributions that run on SPARC - OpenSXCE has for a while, Tribblix and DilOS also have SPARC images available and both are actively maintained. The mainstream distributions are x86-only.

A large part of the lack of SPARC support is quite simple - the number of users with SPARC hardware is small; the number of developers with SPARC hardware is even smaller. And you can see that the SPARC support is largely in the hands of the hobbyist part of the community. (Which is to be expected - the commercial members of the community are obviously not going to spend money on supporting hardware they neither have nor use.)

Absent physical hardware, are there any alternatives?

Perhaps the most obvious candidate is qemu. However, the sparc64 implementation is fairly immature. In other words, it doesn't work. Tribblix will start to boot, and does get a little way into the kernel before qemu crashes. I think it's generally agreed that qemu isn't there yet.

The next thing I tried is legion, which is the T1/T2 simulator from the opensparc project. Having built this, attempting to boot an iso image immediately fails with:

FATAL: virtual_disk not supported on this platform

which makes it rather useless. (I haven't investigated to see if support can be enabled, but the build system explicitly disables it.) Legion hasn't been updated in a while, and I can't see that changing.

Then I came across the M5 simulator. This supports a number of systems, not just SPARC. But it's an active project, and claims to be able to emulate a full SPARC system. I can build it easily enough, running it needs the opensparc binary download from legion (note - you need the T1 download, version 1.5, not the newer T2 version of the download). The instructions here appear to be valid.

With M5, I can try booting Tribblix for SPARC. And it actually gets a lot further than I expected! Just not far enough:

cpu Probing I/O buses

Sun Fire T2000, No Keyboard
Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
OpenBoot 4.20.0, 256 MB memory available, Serial #1122867.
[mo23723 obp4.20.0 #0]
Ethernet address 0:80:3:de:ad:3, Host ID: 80112233.

ok boot
Boot device: vdisk  File and args:
Loading: /platform/sun4v/boot_archive
ramdisk-root ufs-file-system
Loading: /platform/sun4v/kernel/sparcv9/unix
panic[cpu0]/thread=180e000: lgrp_traverse: No memory blocks found

Still, that's illumos bailing, there aren't any errors from M5.

Overall, I think that M5 shows some promise as a SPARC emulator for illumos.


Unknown said...

I have a T2000, T5220 and V245 i could rig up for you if you need to use a real machine.

Peter Tribble said...

Oh, I have plenty of hardware (more than I can easily run at once, at any rate), and noise and power make using it routinely somewhat inconvenient. But even for me, it would be useful to be able to run easily inside an emulator (in the same way that I sanity check things in VirtualBox first, because it's so easy to do so).

atar said...

I have the same error with qemu and OpenSolaris image, so it's not a bug in M5, but in the firmware. The OpenSparc project supplies OpenSolaris (src/chip_dv/design/sys/edk/os/OpenSolaris/proto/ramdisk.snv-b77-nd.gz) and Ubuntu images which can be boot with the firmware from src/chip_dv/design/sys/edk/os/proms/ , but not with the firmware from src/arch_tools/S10image/ (which is only good for booting the supplied Solaris 10 image).

Unfortunately the two sets of firmware are packaged slightly different: in S10image/*bin it's split into {reset,hv,md,q,openboot}.bin and in os/proms/ it's a single file.

But I'm sure if you get M5 working with 1c1t_obp_prom.bin , it'll be able to boot Illumos.