Porting OpenSolaris Project Indiana to SPARC - Part 1

I am a summer intern here at Sun Microsystems and a senior at The Colorado School of Mines in the department of mathematical and computer sciences. I was lucky to get onto this project (see #2) for my summer field session (our senior 'capstone' project course) and be invited to continue on after the course ended. The goal of this project is to support SPARC in OpenSolaris Project Indiana.

First off let me give my sincerest thanks to the OpenSolaris install team here at Sun. Specifically, Sanjay Nadkarni and Clay Baenziger for putting up with my constant stream of questions (aka interruptions), Eric Ray for allowing me to continue on and finish this project, my classmates that were in my team for the first half of this project, the community in #install, and everyone else that lent me their time on each speedbump.

Step 1 - What do you need to boot a liveCD?

Well to boot up you need a microroot. A microroot is a ramdisk image that will be loaded into memory to provide a very limited, very small, functioning user-land. A kernel, filesystem access, a few essential binaries - that's it. What then? Now that you have this machine living entirely inside its ram,  it's time to load the rest of bells and whistles. The microroot is charged with the task of locating the nest from which it flew (the CD or usb it was booted from) and to loopback mount all the goodies there as /usr, /etc, /var, and /opt. After that, with any luck, you have X/gnome up and running and you're nursing your addiction to StumbleUpon in Firefox. :)

Step 2 - Which files and packages are needed for the microroot/liveCD ?

Thankfully, most of the work had already been done here. This task was done by comparing the already known list of packages needed for x86 OpenSolaris 2008.05 and then mapping them over to existing packages on the SPARC side. The source of our SPARC packages were pulled right off a SXCE (aka Project Nevada) DVD. This stage of the project was very critical to get correct; which caused interesting problems later on during boot. This was because there were many instances where the packages didn't have a 1:1 mapping across architectures.

Here's the best and my favorite example showing an important file missing from (un)lucky build number 13:

Sun Blade 2500, No Keyboard
Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
OpenBoot 4.9.5, 8192 MB memory installed, Serial #57202056.
Ethernet address 0:3:ba:68:d5:88, Host ID: 8368d588.

Boot device: /pci@1d,700000/scsi@4/disk@1,0  File and args: -kv -F /sparc13.microroot
krtld: error during initial load/link phase

krtld could neither locate nor resolve symbols for:
    /platform/sun4u/kernel/sparcv9/unix
in the boot archive. Please verify that this file
matches what is found in the boot archive.
You may need to boot using the Solaris failsafe to fix this.
panic - kernel: Unable to boot
Program terminated
{1} ok


Can't find unix? Pssh, who needs that!? Right? Less complaining more booting, silly computer! :) It turns out SUNWcakr - aka, Core Solaris Kernel Architecture - is a fairly important package to have

Needless to say, we came back to this stage of the project many times to examine and adjust our list of files packages.

Step 3 - Setting up our IPS repository

So in order to manufacture our microroots, we needed a way to provide packages to the Distribution Constructor (more on the DC later). Michal Pryc has a great resource aimed at aiding the weary in setting up and populating their very own IPS repo. Here is another valuable resource we found, further aiding us in creation of our repos.

We cut some corners here in the creation of the repo. We made it the quick and dirty way without actually creating the dependencies between packages. Here's a basic rundown

# /usr/lib/pkg.depotd -d /repo-pool/repo-88/ -p 10000
<open a new terminal, pkg.depotd stdout is handy to check but it is too chatty to share a terminal with>
# cd 88/Solaris_11/Product/
# pkgsend send \*


This took all the packages from the SXCE (Nevada) DVD in sysV format and uploaded them into our localhost repo on listening on port 10000. I agree with Michal Pryc - this isn't the best way to go about creating your repo. This choice came back to bite us a little bit back in Step 2 due to the lack of dependencies. e.g., We install pkg B, but it needed pkg A to run - so pkg B blows upon boot because pkg A wasn't pulled down from IPS upon installation of pkg B. In the end though I think the added heat of manually finding these dependences has lead to a more complete package list for liveCD construction.

One gotcha to look out for when doing this is that on a SXCE DVD there are a few instances where there are two versions of the same package. One for sun4u arch and one for sun4v arch. This complicates things when running just `pkgsend send \*` because as we found out IPS will ignore anything that comes after a period and will just treat it like a new version of the same package! So our pkgsend uploaded SUNWcakr.u, which IPS populated on its side as SUNWcakr. Then, v being after u, pkgsend uploaded SUNWcakr.v and IPS - happily ignoring anything after the period - obsoleted the previously uploaded version it had stored and replaced it with this newer version. \*facepalm\*

# ls 88/Solaris_11/Product/ | grep "cakr\\."
SUNWcakr.u
SUNWcakr.v


Future work will involve the creation of a similar repo based off of SXCE build 93 (instead of 88) and built using the solaris.py script (instead of pkgsend send \*). This will address the problem of dependencies, and the two types of packages - though the problem I describe below must still be done by hand. See Michal Pryc's guides for more info on solaris.py

Another task involved in constructing an IPS repo was the translation of the sysV free-form postinstall shell scripts from the DVD onto the IPS repo. These scripts are very important to driver packages for example; they populate /etc/name_to_major, /etc/driver_aliases, and /etc/driver_classes for our system. Without them the kernel has no way of referencing or using say.... a scsi device! :)

SunOS Release 5.11 Version snv_88 64-bit
Copyright 1983-2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
WARNING: No major number for driver glm in class scsi
Ethernet address = 0:3:ba:68:d5:88
Using default device instance data
scsi: no major number
Cannot load drivers for /pci@1d,700000/scsi@4/disk@1,0:a
Can't load the root filesystem
Type  'go' to resume
{1} ok

This error popping up was just a symptom of another larger missing piece to the puzzle we discovered later on. (more on that later too...)

Post-translation, these driver population actions in their IPS form look like this:

# cat /repo-pool/repo-88/pkg/SUNWpd/0%2C5.11-1%3A20080626T133956Z
[...]
driver name=glm perms="\* 0755 root sys" clone_perms="0755 root sys" class=scsi alias=pci1000,f alias=pci1000,1 alias=pci1000,b alias=pci1000,c alias=pci1000,20 alias=pci1000,21

More to come tomorrow,
Chris

P.S. From the console snippets you can tell I do everything as a root user. Some say this is stupid, asking for trouble, blah blah blah. I agree... bad things can happen. I do it anyway because I advocate thinking before pressing enter! Friends don't let friends press enter before thinking!

I liken this approach to refusing to keep all the miscellaneous menucia of your life in a blackberry/palm pilot; you keep your mind and memory from turning all soggy.
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Christopher Walsh

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today