Though there are a lot of documents made available by sun about building opensolaris from source code, I think they are a bit overwhelming  for a beginner. So, here I am adding one more article to the list of documents available on the topic of building Solaris from source code which I'll try to make as simple as possible for a beginner to understand.

In order to build from source, four things are needed.

1. encumbered binaries tarball (on-closed-bins-DATE.PLATFORM.tar.bz2).
2. source tarball (on-src-DATE.tar.bz2; numbered builds only)
These two together constitute the child workspace.

3. ON build tools package (SUNWonbld-DATE.PLATFORM.tar.bz2). This provides the custom tools required for building opensolaris like nightly and bldenv. 4. compiler (Sun Studio 11 is the preferred compiler, and it is free for OpenSolaris community members.)

The first three can be obtained from the link below.
http://dlc.sun.com/osol/on/downloads/current/

Select the appropriate tarballs according to your architecture
(sparc or x86). 
The install image for the SUN Studio 11 compilercan be obtained from
the link below
http://opensolaris.org/os/community/tools/sun_studio_tools/
sun_studio_11_tools/

Now, to install the compiler from install image, follow the following steps.
1. Check that there is enough space in /opt. You can do this by cheking the
output of 'df -h /opt'. If the 'avail' field is 900M or larger, you can continue.
2. Become root. After that do
   # cd /opt
      # bzip2 -dc /var/tmp/sunstudio11-20050614.sparc.tar.bz2 | tar xf -   
Here, I have assumed the install image to be in /var/tmp. Please place
the exact path and name of your image file in the command above.

Now, to install the build tools, suppose you have downloaded them in 
/var/tmp, then do:
  # cd /var/tmp
  # bzip2 -dc SUNWonbld-DATE.PLATFORM.tar.bz2 | tar xf - 
  # su
  Password:
  # pkgadd -d onbld SUNWonbld

After this, the workspace needs to be created. Suppose you have
/export/home/testws as your child workspace. Now, unpack the 
source and closed binaries here i.e.,
  # cd /export/home/testws
  # bzip2 -dc opensolaris-src-DATE.tar.bz2 | tar xf -
  # bzip2 -dc opensolaris-closed-bins-DATE.PLATFORM.tar.gz | tar xf -
The source will unpack into usr/src and the closed binaried into 
closed/root_PLATFORM/

Now comes the final stage of performing the build. Copy the file
opensolaris.sh into /export/home/testws, i.e.,
  # cp /export/home/testws/usr/src/tools/env/opensolaris.sh    
     /export/home/testws

Now make the following changes in the copied file.
  • Change GATE to the name of the top-level directory (e.g., testws).
  • Change CODEMGR_WS to the top-level path (e.g., /export/home/testws).
  • Change STAFFER to your login.

Add /opt/onbld/bin as well as /opt/SUNWspro/bin to your path.
After having done all this, type
  # nightly ./opensolaris.sh &

This starts the nightly build. You can find something else to do for a few hours. The progress of the nighlty can be examined by typing the command 
  # tail -f  /export/home/testws/log/nightly.log

After nightly gets completed, a mail is sent $MAILTO field mentioned in the opensolaris.sh file. In case the nightly fails, correct the problem and add the '-i' option to nightly to do an incremental build so that it does not start from scratch.

This is just one way of performaing the build. There are a lot of other options available. For more indepth information, you can refer to the links given below.

Building ON from source
ON Downloads page
OpenSolaris README


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by Saloni Arya