OpenSolaris ON Build Cheatsheet

From Genunix

Contents

OpenSolaris ON Build Cheatsheet

Version 0.7

This document describes the basic steps to create an OpenSolaris OS and Networking (ON) build and test environment. In-depth instructions are available at:

http://opensolaris.org/os/community/tools/building_opensolaris/

Conventions used throughout this document:

Name of build system: zorack
Name of target test system tralfaz
OpenSolaris ON build 85
Build and target system architecture x86/x64
Build user jweeks
Mercurial project myprj

Download Solaris Express Community Edition and burn on a DVD

  • Download the Solaris Express Community Edition (CE) DVD ISO image from the OpenSolaris download page
   You need to use an interactive browser rather than wget because
   of the interactive nature of the download site's web pages.
  • Burn the image onto a DVD
    1. % cdrw -i sol-nv-b85-x86-dvd.iso

Install the Solaris Express CE DVD or CDs on the Build System (zorack)

  1. In the GRUB menu, select Solaris Express (Console install is OK, but do NOT select Developer Edition)
  2. Select Solaris Interactive (default)
  3. Do the normal install stuff...
  4. Select Custom Install
  5. Select Entire Group Plus OEM - Default Packages
  6. Lay out the disk partitions/slices
    1. Note the disk name for later: c2d0s7
    2. For file system layout, make swap a minimum of 2* physical memory
    3. Allocate a slice for your /builds file system
Lay Out File System -> modify
Slice File System Size (MB)
0 / 100,000
1 swap 8,192
2
3
4
5
6
7 200,000
We have allocated 200GB to slice 7, which will be used later to create a ZFS pool. A minimum of 10GB per ON repository/build is recommended. Note we do NOT put /builds down for the filesystem mount point because we want to create a ZFS pool there by hand in the next step and don't want the installer to make a UFS filesystem there first.
  1. After the system is installed, as root, create a ZFS pool and /builds filesystem:
    1. % su root
    2. # cd /
    3. # zpool create -f vault c2d0s7
    4. # zfs create vault/builds
    5. # zfs create vault/builds/jweeks
    6. # zfs set mountpoint=/builds vault/builds
    7. # cd /builds
    8. # chown -R jweeks:staff jweeks
    9. # cd /
    10. // Make the file system accessable via NFS
      # zfs set sharenfs=on vault/builds/jweeks
If you do not wish to use ZFS for your builds, then create a UFS filesystem on slice 7 (newfs), mount it (/etc/vfstab & mount(1M)) and create a subdir to do your work (mkdir /builds/jweeks) and export it via NFS (/etc/dfs/dfstab).

Install OpenSolaris ON Source on Build System (zorack)

(ON does not need to be built as root. In this example jweeks is the username of the person doing the build) As jweeks:
    1. $ cd /builds/jweeks

[TAR BALL method] (Grab a copy of a specific version, b85 in this example)

hg clone ssh://anon@hg.opensolaris.org/hg/onnv/onnv-gate myprj

cd myprj

Sync the source with the version you want to start with, or omit this step if you want to build from tip

hg update -r onnv_85

[DO THINGS AS ROOT then user]

Install the Closed Source on the build system (zorack)

Download debug & non-debug for from:

http://dlc.sun.com/osol/on/downloads/b85

(assuming the closed source tar files were saved in /usr/tmp)

cd /usr/tmp

bunzip2 on-closed-bins.i386.tar.bz2 bunzip2 on-closed-bins-nd.i386.tar.bz2

(now switch to the user that will be doing the builds)

cd /builds/jweeks/myprj

tar xvf /usr/tmp/on-closed-bins.i386.tar tar xvf /usr/tmp/on-closed-bins-nd.i386.tar

Install Sun Studio 11 Compilers on Build System (zorack)

Download a copy of the prepatched Studio Compilers compilers (August 2007 or later) from:

http://opensolaris.org/os/community/tools/sun_studio_tools/

(assuming the compilers tar file was saved in /usr/tmp)

cd /usr/tmp

bunzip2 sunstudio11-ii-20070828-sol-x86.tar.bz2

As root:

cd /opt

tar xvf /usr/tmp/sunstudio11-ii-20070828-sol-x86.tar

Install the ON Specific Build Tools on Build System (zorack)

Download from:

http://dlc.sun.com/osol/on/downloads/b85/

(assuming the Tools tar file was saved in /usr/tmp)

cd /usr/tmp

bunzip SUNWonbld.i386.tar.bz2

tar xvf SUNWonbld.i386.tar

As root:

pkgadd -d onbld SUNWonbld

Update Environment Script (zorack)

As jweeks:

cd /builds/jweeks/myprj

cp usr/src/tools/env/opensolaris.sh .

vi opensolaris.sh

Change Gate to: GATE=myprj;

Change CODEMGR_WS to: CODEMGR_WS=/builds/jweeks/$GATE;

Change Staffer to: STAFFER=jweeks;

Set shell search path as follows:

/opt/SUNWspro/bin /usr/ccs/bin /opt/onbld/bin /bin /usr/bin /usr/sbin /etc /usr/openwin/bin /usr/dt/bin /usr/sfw/bin

The search path order above is a good starting point for a usable environment. If you login shell is not bash, you might consider creating a .bashrc file in your home directory that sets PATH to the list above, then use bash as the shell for building.

Run the nightly script (as jweeks) to build archives:

nightly ./opensolaris.sh &

If you would like to monitor the progress of the nightly scrips, cd to myprj/log and tail -f nightly.log.

Installing the build on target system (tralfaz) using BFU

First, install the same Solaris Express CE version that matches the ON source (b85) on the target system that will be used for debugging.

Just to be safe, reboot the system one time to make sure the boot archives are updated before proceeding.

After the target is up and running, install the onbld tools using the same procedure that was used for the build system.

At this point you can either copy the BFU archives over to the target system, or just use NFS.

As root on the target system (tralfaz):

  1. You might want to do this from a console line login

cd /

/opt/onbld/bin/bldenv /net/zorack/builds/jweeks/myprj/opensolaris.sh

bfu /net/zorack/builds/jweeks/myprj/archives/i386/nightly

BFU will leave you in a post-bfu protected environment shell. At this point you can run the automatic conflict resolution tool acr:

     acr

Then reboot the system:

reboot

Installing an updated kernel using Install

TBW

Other Useful Links

Currently Known Issues:

http://opensolaris.org/os/community/on/known_issues/

Updating to a Newer Source Base

TBW

General Mercurical Items

To clone the current version of the OpenSolaris ON source:

hg clone ssh://anon@hg.opensolaris.org/hg/onnv/onnv-gate myprj

To clone from a specific tag:

hg clone -r onnv_85 ssh://anon@hg.opensolaris.org/hg/onnv/onnv-gate myprj

To update from a specific source version:

hg update -r onnv_86

To create new files:

touch foo.c (or create it with an editor) hg add foo.c

To see changes:

hg status

To see all valid tags:

hg tags