Cover V14, i08

Article
Figure 1

aug2005.tar

Running any x86 Operating System in a SolarisTM 10 Zone

Tim McMurphy

In the spring of 2004, when the Solaris 10 beta with zones first shipped, my local Sun representative said you couldn't run any operating system except Solaris 10. That was like waving a red flag in front of a bull to me, and I just had to prove him wrong. After quite a few failures, I abandoned the idea of running other operating systems by installing an OS and trying to talk to the global zone like a hardware emulator, and I looked for other approaches.

The method that finally worked for me is very simple, but it does have a few gotchas. I've included the whole process here, because it is very straightforward and doesn't rely on any bugs that will be fixed in future releases. In fact, during one of the online expert exchange sessions, one of the Sun experts said that this approach was valid. So, it won't go away with later releases.

I set up this system on a Sun Ultra 60 with two 300-MHz processors and 2 GB of RAM. The performance with this setup isn't great, but as processors get faster, this could be a viable solution. These are the steps I went through.

1. Because I was using some packages from Sunfreeware, which install in /usr/local, I added a link in the global zone to enable all the zones to install Sunfreeware's packages. In the global zone:

# mkdir /opt/local/
# ln -s  /opt/local  /usr/local
# ls -l /usr/local
lrwxrwxrwx  1 root  root  10 Dec 17 14:13 /usr/local -> /opt/local
2. Set up Solaris 10 zones with the basics. I did nothing fancy here, just the minimum install. A great explanation of this process can be found at:

http://www.blastwave.org/docs/Solaris-10-b51/DMC-0002/dmc-0002.html
3. Get the following packages from the Sunfreeware Web site (http://www.sunfreeware.com/). Put them in a temporary location and unzip them:

libiconv-1.8-sol10-sparc-local.gz
gcc-3.3.2-sol10-sparc-local.gz
4. Get the following packages from Sourceforge (http://bochs.sourceforge.net/). Put them in a temporary location and unzip them:

bochs-2.1.1.tar.gz
freedos-img.tar.gz
5. Install these in the virtual zone, not the global, in the order given. A few workarounds must be addressed here.

5a. The first two packages need to be converted from datastream to directory format for build 72. This is a known bug that will be fixed in a later release:

# cd /var/tmp/packages          (or wherever you put the packages)
# pkgtrans  lib*  .
# pkgtrans  gcc*  .
Now you can do the pkgadd command, and it will work.

5b. Follow the instructions from Sunfreeware on the post-install setup of GCC 3.3.2. This version of gcc was created on build 60 of Solaris 10. If you are using a higher version, you will need to redo some of the header files. This is done with the following steps:

# cd /usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/install-tools/
Put the line SHELL=/bin/sh on the first line of the mkheaders.conf file. Then run:

# ./mkheaders
This will correct some files and make the build 60 gcc usable on higher builds. I have tested this on build 72, and it works fine.

5c. Add the following links to the global zone so the bochs app in zone1 will find them:

# cd /usr/lib
# ln -s /usr/local/lib/libstdc++.so.5.0.5 ./libstdc++.so.5
# ln -s /usr/local/lib/libgcc_s.so.1 ./libgcc_s.so.1
The libs get installed in /usr/local/lib, but then the program wants to find them in /usr/lib. This may be fixed in another release of these tools and apps.

6. Install bochs 2.1.1. This went very well once the links mentioned previously were in place. If you follow their installation instructions, it is really straightforward:

# PATH=$PATH:/usr/ccs/bin; export PATH
# cd /var/tmp/bochs-2.1.1
# ./configure
# ./make
# ./make install
At first, I recommend just accepting all the defaults and getting this running in one zone. Later, you can play with it other zones and compare the results. I used the make that came with Solaris 10 (/usr/ccs/bin/make); you can put that in your path or use whichever make you prefer.

7. Run it. Make sure bochs is in your path:

# echo $PATH
/usr/sbin:/usr/bin:/opt/local/bochs/bin
Make sure you are running X on your workstation and that you have a valid DISPLAY variable in the zone:

# echo $DISPLAY
localhost:10.0

# cd /var/tmp/freedos-img
# ls
4meg.img      a.img         b.img         bochsout.txt  c.img
# bochs -q &
See Figure 1 for the output on the workstation.

Conclusion

Again, this runs really slowly on my setup. But, keep in mind that it is translating from x86 to Sparc code for an entire system emulation, video and all. That is why I ran FreeDOS and not the MS-Windows image.

It would be interesting to try this setup on a Solaris 10 x86 system and see how much the speed is affected. One would think that doing native instructions rather than translating would be much faster.

Tim McMurphy is an Electronics Engineering graduate from SAIT (Southern Alberta Institute of Technology), 1985. He has been a systems administrator for most of the past 19 years, focusing on Unix and Solaris for the past 6 years.