OpenSolaris

Build

This section provides specific step-by-step instructions to help you through your first build experience and is based on the source code provided with this starter kit. However, if you want to go beyond our scripted build and install process, check out the following resources:

Let's not waste any more time and just do it!

Prepare the Build System

Before you can build the ON and NWS consolidations, you must have a system installed with the following:

Solaris Express: Community Release distribution Found on Disk 2 of the OpenSolaris Starter Kit.

Follow the instructions on the Starter Kit.

Sun Studio 11 (compilers)

Found on this OpenSolaris Starter Kit.

Follow these instructions:

1. Move the currently installed Sun Studio 12 compiler to another location in /opt.

# cd /opt
# mv SUNWspro SUNWspro-12
# mv netbeans netbeans-12

2. Download file into a scratch download directory, such as /var/tmp.

3. Unpack the archive into the /opt directory with the commands:

# cd /opt
# bzcat <DVDdrive>/starter-kit/content/docs/Build/source/sunstudio11-sol-x86 | /bin/tar -xf -

4. You should update your PATH and MANPATH shell variables to the installation and documentation directories or modify your home directory's .cshrc file (for C shell) or .profile file (for Bourne or Korn shells) to make these changes permanent.

If you use csh:

% setenv PATH [installpath]/bin:$PATH
% setenv MANPATH [installpath]/man:$MANPATH

If you use sh (or ksh):

% PATH=[installpath]/bin:$PATH ; export PATH
% MANPATH=[installpath]/man:$MANPATH ; export MANPATH

Replace [installpath] with the pathname where you installed the tools. To build OpenSolaris, the install path should be the default:

/opt/SUNWspro

Note: If you have moved a previously installed version of Sun Studio to another directory, you will also need to update your PATH and MANPATH shell variables for that new directory.

You are now ready to use the Sun Studio tools to build OpenSolaris.

Get the Source

Before you begin, you must copy the following files on the DVD drive to the system where you plan to build the source. All the files are located in the DVD drive's /starter-kit/content/docs/Build/source directory.

Table 1. Source Files

ON-Specific Build Tools SUNWonbld.i386.tar.bz2
ON Source on-src.tar.bz2
ON Debug Closed Binaries on-closed-bins.i386.tar.bz2
ON Non Debug Closed Binaries on-closed-bins-nd.i386.tar.bz2
NWS Source nws-src.tar.bz2

Build the OS/Net Consolidation

This example uses /export/home/on_Open_REF_BLD as your workspace. Replace all instances of /export/home/on_Open_REF_BLD with your workspace if it is different.

1. Change directory to /export/on_Open_REF_BLD and make an Archives directory.

# cd /export/home/on_Open_REF_BLD
# mkdir Archives

2. Copy the ON content listed in Table 1 from the DVD to the /export/home/on_Open_REF_BLD/Archives directory.

# cp <DVDdrive>/starter-kit/content/docs/Build/source/on-src.tar.bz2 /export/home/on_Open_REF_BLD/Archives
# cp <DVDdrive>/starter-kit/content/docs/Build/source/on-closed-bins.i386.tar.bz2 /export/home/on_Open_REF_BLD/Archives
# cp <DVDdrive>/starter-kit/content/docs/Build/source/on-closed-bins-nd.i386.tar.bz2 /export/home/on_Open_REF_BLD/Archives

3. Unpack the sources and encumbered binaries.

# /usr/bin/bzip2 -dc Archives/on-src.tar.bz2 | tar xvf -
# /usr/bin/bzip2 -dc Archives/on-closed-bins.i386.tar.bz2 | tar xvf -
# /usr/bin/bzip2 -dc Archives/on-closed-bins-nd.i386.tar.bz2 | tar xvf -

The sources will unpack into "usr/src" and the binaries will unpack into "closed/root_i386" (i.e., closed/root_i386 or closed/root_sparc).

4. Install the current onbld tools.

The Yes,onbld package is a pkgadd-format directory that has been archived using tar and bzip2. Unpack it in a temporary directory and use pkgadd(1M) to install it. For example:

# cd /export/home/on_Open_REF_BLD/Archives
# /usr/bin/bzip2 -dc /path/to/SUNWonbld.i386.tar.bz2 | tar xvf -
# pkgadd -d onbld SUNWonbld

5. Update your environment and login dot-files if this is the first time you have installed the compiler and/or build tools.

  • Add /opt/SUNWspro/bin and /opt/onbld/bin to your $PATH.
  • Either remove /usr/ucb from your $PATH, or put it at the end.

6. Create an environment file to guide tools like nightly(1) and bldenv(1).

# cp /export/home/on_Open_REF_BLD/usr/src/tools/env/opensolaris.sh /export/home/on_Open_REF_BLD/
# chmod 664 /export/home/on_Open_REF_BLD/opensolaris.sh

The opensolaris.sh file doesn't have to go into /export/home/on_Open_REF_BLD, but that's a convenient place to put it. You don't have to keep the name opensolaris.sh, but that's the name we'll use in these notes.

Then make the following changes in your opensolaris.sh:

  • Change NIGHTLY_OPTIONS to meet your requirements. (e.g.,"NIGHTLY_OPTIONS=-NnaDlmrtz")
    (See Nightly Build Options for definitions.)
  • Change GATE to the name of the top-level directory (e.g.,"GATE=on_Open_REF_BLD").
  • Change CODEMGR_WS to the top-level path (e.g., "CODEMGR_WS=/export//home/$GATE").
  • Change STAFFER to your login.
  • Change MAILTO to an email address to receive the build results notice.
  • (optional) Customize VERSION. This is the string that "uname -v" will print.

7. Build a complete set of archives.

# cd /export/home/on_Open_REF_BLD
# /opt/onbld/bin/nightly ./opensolaris.sh &

Find something else to work on for a few hours. You can monitor the build's progress using ptree(1). nightly(1) will send mail to $MAILTO when it has finished.

The results mail from nightly(1) will have an overview of the build results. A copy of the mail text and a more detailed log file will be available in the workspace (/export/home/on_Open_REF_BLD/log/log.<mmdd>). Pieces of the detailed log are also available under usr/src. For example, usr/src/install-i386.out will have the log from the x86 "make install" part of the build.

By default nightly(1) will do a "clobber" build, which includes a "make clobber" and blowing away any files that earlier builds installed into $ROOT (/export/home/on_Open_REF_BLD/proto/root_i386). To bypass these steps, do an incremental build with "nightly -i ./opensolaris.sh &".

8. To build a specific component, first use bldenv(1) to set up various environment variables, then cd to the subtree that you want to build. For example:

# cd /export/home/on_Open_REF_BLD
# bldenv -d ./opensolaris.sh
[status information from bldenv]
# cd usr/src/cmd/vi
# dmake all

To build the kernel, run dmake(1) from usr/src/uts. If you encounter errors, try running with a clean environment:

# env - HOME=$HOME SHELL=$SHELL DISPLAY=$DISPLAY TERM=$TERM LOGNAME=$LOGNAME LANG=C LC_ALL=C PAGER=less MANPATH=$MANPATH /opt/onbld/bin/bldenv ./opensolaris.sh

Please see the OpenSolaris Developer's Reference Guide for information on how to install kernels (using Install(1)) and archives (using BFU).

Build the NWS Consolidation

General questions on the NWS code for OpenSolaris should be directed to the OpenSolaris Storage discussion list . Please note that the mailing lists are configured to only allow posts via the web forum interface or from list subscribers.

1. Copy nws-src.tar.bz2 from the DVD drive to /export/home/

# cp <DVDdrive>/starter-kit/content/docs/Build/source/nws-src.tar.bz2/export/home/

2. Unpack the NWS source into your build area.

# bzip2 -dc nws-src.tar.bz2 | tar -xvf -

This will create the directory nws-src in your build area.

3. Change directories to the newly created nws-src directory.

This directory contains:

  • src directory
  • ReleaseNotes
  • opennws.env
  • opennws_build

4. Edit the opennws.env setting file for your build environment.

Setting Do This...
BUILD_OPTIONS - Minimum settings N or D (Nondebug and/or Debug) BUILD_OPTIONS="DNlp"
OS_REF_BUILD - Points to your built ON for OpenSolaris workspace OS_REF_BUILD=/export/home/on_Open_REF_BLD
GATE - Name of your NWS for OpenSolaris source workspace directory GATE=nws-src
CODEMGR_WS - Full path to where your NWS build workspace resides CODEMGR_WS=/export/home/$GATE
MAILTO - Upon completion, an email containing the build log will be sent to this address  
SPRO_ROOT - This variable should point to the location where the SUNWspro has been installed to.  
ONBLD_TOOLS - The directory where the SUNWonbld package was installed to.  

5. Build the NWS consolidation source

# ./opennws_build -E ./opennws.env &

Install the OS/Net Build

To install the OS/Net consolidation packages that you just built on your current system, follow the Bonwick-Faulkner Upgrade (BFU) instructions.

Install the NWS Build

Install the NWS packages that you just built on your current system:

1. Save the Install_OpenNWS script to your system and make sure it is executable.

2. Run the Install_OpenNWS script.

# ./Install_OpenNWS -w /export/home/nws-src

3. Reconfigure boot your system.

# touch /reconfigure
# reboot

Congratulations!

Give yourself a pat on the back. You did it. Your system should now be running OpenSolaris, build 72.