Building Opensolaris
Nexenta, via the debian build tools, makes it very very easy to build the Opensolaris kernel packages. These are the Nexenta packages that begin with 'sunw'.
Quick Build Steps
Nexenta provides a package called nexenta-on-source, which is what you install to build the source in 3 commands.
# apt-get install nexenta-on-source # cd /usr/src/nexenta-on-source/ && apt-satisfydepends # dpkg-buildpackage -b
All of the building and package dependencies have been predefined.
- The "build-depends" field in nexenta-on-source defines all necessary build dependencies like Sun Studio, etc.. which are automatically installed in the second step.
- The complete process can be defined into two main groups : building the kernel (binaries) into a temporary (proto) directory, and building the packages.
- Once the packages are built, a local apt repository is setup and populated with these packages, allowing a user to dist-upgrade his system.
- The above upgrades are "Safe".. and done via apt-clone, so you dont have to fear losing your system state.
The build process itself does the following:
- Pulls in necessary sources from public opensolaris repository and required encumbered binaries.
- Runs a non-incremental nightly build.
Adding your changes and building a specific package
If you've run the build at least once (i.e, kernel binaries have been generated in the temporary directory), you can then easily rebuild any single package.
If you want the edit a particular package, you would typically do the following:
- Locate the module in the source tree via http://src.opensolaris.org/source/
- Enter the nexenta-build directory (/usr/src/nexenta-on-source/) and navigate to module directory and then run
#/opt/onbld/bin/bldenv /path/to/opensolaris.sh # make # make install
The new binaries will be automatically placed in the proto area. To rebuild the package that this binary belongs to, enter the debian/packages directory and run dpkg-buildpackage.
Enter the packaging directory via,
# cd debian/packages # cd (name-of-package) # dpkg-buildpackage -b
This will build the new .deb package.
Patches
Nexenta-on-source package maintains many patches in the debain/patches directory. These are applied on top of the vanilla sources as a part of the build process.
The opensolaris sources are pulled in from a mercurial repository. Patches are maintained via the mercurial q-* commands (quilt commands)
| hg qtop | Lists out the patch that is currently at the top of the stack. |
| hg qnew | Creates a place holder for a new patch. |
| hg qpush -a | Applies all the patches in the patches directory. |
| hg qpop -a | pops all the patches from the patch queue rending it empty. |
| hg qgoto |
moves |
| hg qrefesh | updates the topmost applied patch in the stack. |
Patched are maintained and applied via a stack mechanism.
Creating a new patch
# hg qnew "(patch name)" .. Edit the file that needs your changes. # hg qrefresh # hg qpush -a
This will add your newly created patch to the top of the patch stack. It will be applied the next time you run a build.
Editing an existing patch
NOTE: ALWAYS ensure that the patch you wish to edit is at the top of the stack. If the below mentioned procedures are applied on a patch not destined for change, you can end up with a broken build.
#hg qtop .. Use this to verify if the target patch is at the top of the stack. .. Edit the file you want to change. #hg qrefresh
If the intended patch is not at the top of the stack then,
#hg qgoto(This takes you to your intended patch) .. modify the file you wish to. #hg qrefresh.
Note : This page is currently in flux. If you run into issues, or have any questions, ask us in the help forum