Building an (almost completely) non-debug OpenSolaris

Folks may like to think of this as an early Christmas present from me :)

I was mucking around with the idea of getting BrandZ running on my shiny new Ferrari 4005, after reading Adam's writeup on playing with DTrace and Linux in a BrandZ Zone

While I was downloading the bits to be able to do the build, I started thinking about how much work it would take me to sync up my non-debug opensolaris work to the current build. I was then struck with a simple hack that would let me do this without going to all that trouble.

In actuality, almost everything that you need to create a non-debug closed tarball already exists in a downloadable form.

  • A machine running Solaris Express Community Release contains pretty much all of the binaries that I need.
  • The debug closed binaries tarball contains a list of the files I need, and debug versions of any files that I can't get from SXCR.

The only real catch is that if I create a list of non-debug closed binaries based on SXCR, then that license forbids redistribution.

That's not really a problem as I've done up a small script to create that tarball based on a running SXCR and an extracted closed binaries.

To do this properly, you also need to make some minor modifications to two files.

  1. usr/src/lib/Makefile

    The line that says where to grab the closed libs from needs to be changed to use a different directory if RELEASE_BUILD is defined in the environment.

    It should read

       368                      (cd $$ON_CLOSED_BINS$${RELEASE_BUILD+-nd}/root_$$MACH; \\
       369				cpio -pdu $$ROOT); \\
  2. /opt/onbld/bin/makebfu

    This needs a similar modification so it knows where to pick up the non-debug closed binaries, thus

        99          encproto="$ON_CLOSED_BINS${RELEASE_BUILD+-nd}/root_$MACH"
  3. You'll also need to modify your environment file to enable non-debug builds. Look for the line that defines NIGHTLY_FLAGS and take out the F option.

    Now when you run, you'll produce bfu archives for both debug and non-debug. If you Don't want debug archives, also remove the D option.

    Now, to generating the closed-nd stuff.

    Run the following script (make-closed-nd) from the directory that contains your extracted debug closed binaries.

    # make-closed-nd
    # Generate closed-nd.tar.bz2 based on the currently running
    # OS (assumed to be a Solaris Express Community Release) and
    # an extracted debug version of the closed binaries tarball.
    # We expect to find "closed" in the current directory.
    export tmpdir=/tmp/mc$$
    # Clean up after ourselves
    trap "rm -rf $tmpdir" 0
    export arch=$(uname -p)
    export tmproot=${tmpdir}/closed-nd/root_${arch}
    if [ ! -d closed ]; then
            echo no closed directory >&2
            exit 1
    mkdir -p ${tmproot}
    # First get the list of what should be in the archive
    (cd closed/root_${arch}; find . ! -type d |sort > ${tmpdir}/list)
    # Now create a new tree using this list. We ignore any missing
    # files as we'll grab those from the debug tree.
    (cd / ; cpio -pdm ${tmproot} < ${tmpdir}/list) > /dev/null 2>&1
    # Now, what did we actually get?
    (cd ${tmproot}; find . ! -type d |sort > ${tmpdir}/list-nd)
    # Grab anything we didn't get from the debug hierarchy
    comm -23 ${tmpdir}/list ${tmpdir}/list-nd | \\
            (cd ${WS}/closed/root_${arch}; cpio -pdm ${tmproot})
    (cd ${tmpdir}; tar cf - closed-nd) | bzip2 > ${WS}/closed-nd.tar.bz2

    Please note that I'm offerring this script as-is, with no warranties implied.

    Play with it at your own peril :-).

    This will create closed-nd.tar.bz2 in the current directory. You'll need to extract this in order to use it.

    The last time I ran this I had to gather the following files from the debug hierarchy. A couple of these might actually exist, but as I ran the script as me rather than as root, I may not have had read access to them.


    Which is a pretty small list really. The include files are not going to change for debug/non-debug, and we have a few libraries, some kernel crypto, some user level crypto and a few other odds and ends.

    Anyway, the upshot of this is that I've now got an opensolaris build running on the notebook that returns the following for uname -a

    SunOS red 5.11 opensolaris-b28-brandx-nd i86pc i386 i86pc

    and the following under BrandZ

    Linux lx 2.4.21 BrandX fake linux i686 i686 i386 GNU/Linux


    I didn't actually make the modification to makebfu for the build I am running. I moved the closed dir sideways and made a symlink from closed-nd to it. The modification that I have listed here is much cleaner and will allow you to build both debug and non-debug in the same nightly.

    In my current build, pcic is not loading due to not finding a symbol. I've go to look in to this, but it's certainly not hampering me at the moment. I suspect it's something to do with some non-released software that was installed in the build environment that I created the base for the open solaris bfu in.

    I must also emphasise that the SXCR license does not allow for distribution of the closed-nd.tar.bz2 file that we generate. Please honor that.

    Have fun!

    Technorati Tags:


Post a Comment:
Comments are closed for this entry.

* - Solaris and Network Domain, Technical Support Centre

Alan is a kernel and performance engineer based in Australia who tends to have the nasty calls gravitate towards him


« June 2016

No bookmarks in folder

Sun Folk

No bookmarks in folder

Non-Sun Folk
Non-Sun Folks

No bookmarks in folder