In the previous episode of the Mariner Story I showed how running Mariner within VirtualBox is easy but not without its own small challenges. This blog entry will show how to begin customizing the distribution.
Step One: building a demo OS
Fortunately for Mariner users, the distribution comes with a small tutorial on how to best use the flavour of Linux.
Customization is, in fact, the preferred way to use Mariner. This distribution isn't a distro like, say, Ubuntu - a fullyfledged OS that can be later installed upon.
Mariner is, essentially, a toolkit to build your own specialized Linux images and those images can be installed upon or customized further on. Needless to say, the Mariner team offers tools and infrastructure to achieve that goal and this article presents exactly that.
Mariner comes with an aptly named repository, MarinerDemo. It is much like CBL-Mariner but it does not build an image 'from scratch'; it uses the core image instead to build an image derivative. I will not repeat the steps here since they are clearly exposed in the demo so I recommend to follow the steps up to Image Config File.
Note: I followed the ISO route and not the VHD and VHDx isn't even supported by VirtualBox. Furthermore, as in the case of CBL-Mariner ISO VM from before, enabling EFI is essential to make the installer boot.
I named this derivative image Mariner-Demo-Blank because it contained no extra package. It was not really a derivative, hence the -Blank suffix in the name.
Step Two: building with provided binary (zip)
The 'blank' OS built above is really so: it doesn't even have the zip utility and that can be easily verified with the which zip command: it complaints that there is 'no zip'.
I followed the instructions in Customize Demo Image with Pre-built Packages with the caveat that I rebuilt the ISO and not a VHD as indicated in the tutorial.
Next was to create a Mariner-Demo-Zip virtual machine within VirtualBox and running command which zip within it gave the expected answer: /bin/zip.
Step Three: building with other binary repos
The zip utility gets specified within core-packages.json file without a repo because it is a pre-built binary. It is possible to use another repo to add binaries to Mariner.
The demo tutorial shows how to add libX11 by referring to mariner-ui.repo. I did not pursue this train of action as I consider it very similar to the steps above.
Step Four: building with new packages
The last step is to add new packages to the distribution. The tutorial demonstrates how to build a gnuchess package and then how to add it to the VHD. I chose to build the ISO instead of the VHD, as before.
- cloning the gnuchess repo yields a newer SPEC file than the one expected for version 6.2.7 mentioned in the tutorial
- the patch version in the SPEC file should be 6.2.7-6 and not 6.2.7-4 as instructed, because two new patches occured after the tutorial was published
- BuildRequires: help2man needs to be commented out from the newer SPEC file since it's not present in 6.2.7
Note: obviously, the user has the choice not to use 6.2.7 but the latest version. In this case the tutorial needs to be followed by reconsidering the versions and the SPEC snippets may differ. I preferred to stick with 6.2.7.
After a successful ISO build, creating a VirtualBox machine named Mariner-Demo-GnuChess as above and using the newly built image will load a Mariner VM containing gnuchess - a locally built package.
Some Thoughts
- Each of the steps above require a fresh clone of MarinerDemo repository
- The build steps are easy to fail. Sometimes the connection to the repositories proved to be flaky
- It is easy to make mistakes when altering the files. Extra-care is required