> Building illumos-gate

The packages from illumos-gate form the foundation of Tribblix. How they're built is described below.

There are some assumptions in the build process based on my personal environment, namely that lots of stuff is present under the directory /packages/localsrc/Tribblix which I have as an environment variable THOME. You'll need THOME set for much of the following to work.

Initial setup

What you'll also need is a copy of the tribblix-build repo, which contains the build scripts and other files for the build.

cd $THOME
git clone https://github.com/tribblix/tribblix-build

At the very end you'll need a copy of the build repo, which contains the online repo management scripts.

cd $THOME
git clone https://github.com/tribblix/build

You'll also need a signing key. In Tribblix, the ELF objects are signed (as in the -S flag for the package generation scripts below). To create one:

mkdir ${HOME}/f
cd ${HOME}/f
openssl req -x509 -newkey rsa:2048 -nodes \
  -subj "/O=MyName/CN=myname.org" \
  -keyout elfcert.key -out elfcert.crt -days 3650
chmod 644 elfcert.key

For verification, a copy of the .crt file needs to end up in the /etc/crypto/certs directory. With that, you can use elfsign verify to verify a given file.

The distribution packages (the zap files) themselves are also signed; that will be covered elsewhere.

Creating a build host

The canonical way to build illumos in Tribblix is to use a specially configured zone. This makes sure that the global zone doesn't get corrupted by the changes necessary to set up the build environment.

The zone will need the develop, java17, python312, and illumos-build overlays installed. To create it use a command such as the following:

zap create-zone -z illumos-build -t whole -i 192.168.1.201 \
-o develop -o java17 -o python312 -O illumos-build \
-S /export/packages/localsrc -U ptribble

Breaking this down, the -z flag defines the name of the zone, the -i flag sets up the IP address, the -o flags copy those overlays from the global zone and the -O flag installs the build environment in the zone. If some of the overlays aren't installed in the global zone then you can either install them there or use the -O flag instead.

The -S flag shares the named directory with the zone, and the -P flag copies the named user.

Once the zone is installed there are a few minor changes that are necessary.

pfexec zlogin illumos-build
rm /usr/bin/cpp
cd /usr/bin ; ln -s ../gnu/bin/xgettext gxgettext
cd / ; ln -s export/packages .

Setting up the build

The first thing you'll need is a copy of the illumos source. The way I do this is to have a reference copy of the gate on my machine, and build clones of that, rather than having to pull it over the network every time I do a build. If you want to build OmniTribblix then you'll need the source for the OmniOS variant of illumos-gate as well.

mkdir ${HOME}/Illumos-reference
cd ${HOME}/Illumos-reference
git clone https://github.com/illumos/illumos-gate
git clone https://github.com/omniosorg/illumos-omnios

Once you have these, simply git pull as necessary to keep them up to date.

You'll also need the closed components. Tribblix has minimized the use of non-open components, but you still need the whole set for the build. Assuming you're going to do you build in an Illumos directory, then get a copy of the closed binaries like so:

mkdir ${HOME}/Illumos
cd ${HOME}/Illumos
wget -c \
  http://www.tribblix.org/illumos-build/on-closed-bins.i386.tar.bz2 \
  http://www.tribblix.org/illumos-build/on-closed-bins-nd.i386.tar.bz2

You don't need to unpack them now; the build process will handle that.

Building the gate

The first step is to check out a copy of illumos that you can build. Let's assume you're going to build something called m36-gate.

cd ${HOME}/Illumos
rm -fr m36-gate
git clone ${HOME}/Illumos-reference/illumos-gate m36-gate

For OmniTribblix it's slightly trickier, there's a bit of a hack to remove a dependency on ncurses. Note also that the name of the OmniTribblix repo here has to match the name above with "lx" in the middle (the build looks for the corresponding vanilla copy of the gate).

cd ${HOME}/Illumos
rm -fr m36lx-gate
git clone ${HOME}/Illumos-reference/illumos-omnios m36lx-gate
cd m36lx-gate
git format-patch --stdout -1 3cb7d45669f9143c833d58e902f8880804a51791 > 1.patch
sed -i s:Makefile.tools:Makefile:g 1.patch 
git format-patch --stdout -1 6b8791159f33fb8479bb3c5a19e624dff6ed35bf > 2.patch
gpatch -R -p1 < 1.patch
gpatch -R -p1 < 2.patch
rm 1.patch 2.patch
cd ..

Then all you have to do is log in to the illumos-build zone and run the build.

zap zssh illumos-build

cd ${HOME}/Illumos/m36-gate
${THOME}/tribblix-build/illumos/releasebuild m36

For OmniTribblix it's:

zap zssh illumos-build

cd ${HOME}/Illumos/m36lx-gate
${THOME}/tribblix-build/illumos/omnibuild m36lx

You don't need to use m36, of course. If you do it like this then you'll get a build of the current code with the m36 name attached to it. All that's required is that there's an illumos.sh env file in the ${THOME}/tribblix-build/illumos directory with a suffix equal to the name you choose, so you can create a distribution with whatever name you like. It's probably best to start from the most recent env file there, as it will be the closest to having the right properties for the current state of Tribblix and illumos.

Adding gfx-drm

The other component that we need from illumos is the gfx-drm packages. These can be built with a single script.

cd ${HOME}/Illumos
rm -fr gfx-drm
${THOME}/tribblix-build/gfx-drm/gfx-drm.sh -V 0.36

The version given here, 0.36, matches m36. This will build both the vanilla and omnitribblix packages. (They're the same, they just have different version numbers to match what packaging expects.)

Creating packages

Assuming the build is successful, you can create packages from the builds.

You need to be root in the global zone for this step. (You can't use $THOME or $HOME here as root is a different account.)

/packages/localsrc/Tribblix/tribblix-build/repo_all.sh \
  -G /export/home/ptribble/Illumos/m36-gate \
  -V "0.36" \
  -D /var/tmp/m36-pkgs \
  -S /export/home/ptribble/f/elfcert >& /var/tmp/m36.log

Or for OmniTribblix, it's:

/packages/localsrc/Tribblix/tribblix-build/repo_all.sh \
  -G /export/home/ptribble/Illumos/m36lx-gate \
  -V "0.36lx" \
  -D /var/tmp/m36lx-pkgs \
  -S /export/home/ptribble/f/elfcert >& /var/tmp/m36lx.log

Those take a while. One they're done I copy them to my local distribution area, as yourself in the global zone:

cd ${THOME}
mkdir -p illumos-pkgs-m36/pkgs/
cp /var/tmp/m36-pkgs/pkgs/*.zap illumos-pkgs-m36/pkgs/
cp /var/tmp/m36-pkgs/pkgs/*.zap.md5 illumos-pkgs-m36/pkgs/

and for OmniTribblix

cd ${THOME}
mkdir -p illumos-pkgs-m36lx/pkgs/
cp /var/tmp/m36lx-pkgs/pkgs/*.zap illumos-pkgs-m36lx/pkgs/
cp /var/tmp/m36lx-pkgs/pkgs/*.zap.md5 illumos-pkgs-m36lx/pkgs/

You also need to copy the gfx-drm packages into the same place. Remember this was done in the illumos-build zone, and that we shared $THOME with the zone when we created it.

zap zssh illumos-build
cd ${THOME}
cp /var/tmp/gfx-pkgs/pkgs/*.zap* illumos-pkgs-m36/pkgs/
cp /var/tmp/omni-gfx-pkgs/pkgs/*.zap* illumos-pkgs-m36lx/pkgs/

Then the metadata (catalog) needs to be created, again as yourself in the global zone:

cd ${THOME}/build
./create-illumos-files ../illumos-pkgs-m36/pkgs
./create-illumos-files ../illumos-pkgs-m36lx/pkgs

Index | Previous Section | Next Section


tribblix@gmail.com :: GitHub :: Privacy