OpenSolaris Auto-Builder

To make my own life easy I finally sat down and wrote a utilty that automates the entire process of patching and building OpenSolaris and XVM(XEN) from source and also generates the binary packages. I had wrote about building OpenSolaris from source on OpenSolaris itself. See my blog entry titled “Self – Host Almost! Building OpenSolaris on OpenSolaris“. That entry missed out a few details and in any case there is a lot of minutiae making for a mistake-prone manual work.

The utility takes a workspace containing the OpenSolaris build snapshot tarballs and patches to apply and at the end delivers binary packages. It is also has the ability to check for pre-requisites for running the build. For eg. presence of proper version of SUN Studio 12, development and locale headers, assembler etc. It should work on both BeleniX and OpenSolaris though I have found time to only test it on BeleniX till date.

Getting it: On BeleniX just execute  spkg updatecatalog; spkg install autobuilder. On OpenSolaris execute pkgadd -d http://www.belenix.org/binfiles/autobuilder.pkg

Setting up: Create a directory like say osol_ws. Now create osol_ws/downloads and osol_ws/patches. If you have patches for ON create another directory osol_ws/patches/on_patches and copy them into it. Copy your XEN patches if any into osol_ws/patches/xvm_patches. Now run osol_builder prereq while connected to the net. This will check for prerequisites for building OSOL on your distro and fix most of the requirements except for installing the proper SUN Studio 12 which you will have to do manually since it requires a login to download from SUN’s site.

Building: Now download all the requires build snapshot tarballs into osol_ws/downloads: on-src.tar.bz2, xvm-src.tar.bz2, SUNWonbld.i386.tar.bz2 or SUNWonbld.sparc.tar.bz2 ,  on-closed-bins-nd.i386.tar.bz2 or on-closed-bins-nd.sparc.tar.bz2. Finally fire up the script: osol_builder build -R /path/to/osol_ws -d myosol

Running the utility without arguments prints a complete help text that will explain the subcommands and options.

I have only been tested this on i386, though it should work on SPARC as well since the architecture is detected at runtime. However the script only builds for non-debug stuff. So support needs to be added to allow building debug binaries as well. In addition one may want to only build either XVM or ON whereas today it builds both. It delivers a pre-determined set of nightly options (in workspace/patches dir) that may not be suitable to your needs. This needs to be customizable. Obviously one can think of other enhancements and obviously fixes/enhancements to the utility are welcome. Since the utiliy is a mix of little bit of shell script and Python the source code is there when you install the package. Look at: /usr/bin/osol_builder, /usr/bin/osol_builder.py.

If you do find the script useful or find bugs please drop an email to belenix-discuss@opensolaris.org or even put a comment here.

Update(Dec, 17, 1008):

The package file is now updated as I discovered a bug and also changed a patch into a script to avoid having to maintain a build-specific patch.

Advertisements

One thought on “OpenSolaris Auto-Builder

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s