Advanced Namespace Tools blog

25 December 2017

Creating a 9front-ANTS live+install CD image part 2

The last blog entry described modifying the /rc/bin/inst scripts into /rc/bin/instants. That was successful, but the cd itself was still running the original 9pc kernel without ANTS modifications. Userspace programs like hubfs and grio were available because they were contained in the duplicated file tree, but I wanted to convert the CD to a real live cd, with kernel features like private /srv spaces and writable /proc/pid/ns available for testing.

Making the CD a live ANTS environment

This really required only minimal tweaks, because by design, ANTS is fully "backwards compatible" - everything that works in standard 9front should work fine with ANTS. I wasn't completely sure this would be true of the cd booting process because it differs somewhat from the standard boot sequence, but I was optimistic. Almost the only thing that really needed changing was the kernel boot parameter in the cd plan9.ini, stored in /sys/lib/dist/cfg/plan9.ini. There was also one additional variable added:

bootfile=/386/9ants
tgzfs=no

The tgzfs line tells the ANTS boot script not to try to load a tools.tgz from 9fat into the ramdisk-rooted boot namespace. There is already a decent selection of software available in the paqfs, the tools.tgz is intended to create an even richer environment and make it easier to customize the boot namespace without changing kernels. There was another minor addition to the default glenda profile stored in /sys/lib/dist/usr/glenda/lib/profile:

if(~ $cdboot yes)
	bind /rc/bin/instants /bin/inst

The install scripts expect themselves to exist at /bin/inst, but I always try to avoid overwriting or replacing anything in the standard distribution with ANTS modifications except when absolutely necessary, preferring to use namespace manipulation to accomplish customization. These modifications were all that were needed to make a new build of the cd into a fully functional ANTS live environment, complete with kernel modifications and availability of the independent boot namespace. There is no password set, but the cpu listener is already active on port 17060 so you can make that environment available via cpu with:

echo 'key proto=dp9ik user=glenda dom=livecd !password=sooperseekrit' >/mnt/factotum/ctl

If you cpu into the boot namespace, you can access a standard userspace with this series of commands:

rerootwin -f boot
service=con
. $home/lib/profile
grio

That will create a subrio re-rooted into the standard namespace.

Standardizing the creation process with the build script

Having created a fully functional live/install cd, I wanted to automate the process and incorporate the needed files into the ANTS repository. That meant storing the modified cd plan9.ini and glenda's profile in new subdirs of the frontmods directory, and adding a "9frontcd" target for the build script. It combines the standard procedure from the FQA with binds for the modified components. Here is what that ended up as:

if(! test -f /386/9ants || ! test -f /386/tools.tgz){
	echo please build 9ants kernel and tools.tgz and place in /386
	exit no.files
}
mkdir /sys/src/ants
mkdir /rc/bin/instants
bind /root /n/src9
bind $builddir /n/src9/sys/src/ants
bind frontmods/instants /n/src9/rc/bin/instants
bind -b frontmods/syslibdistcfg /n/src9/sys/lib/dist/cfg
bind -b frontmods/usrglendalib /n/src9/sys/lib/dist/usr/glenda/lib
bind -ac /dist/plan9front /n/src9
cd /sys/lib/dist
mk /tmp/9front.iso
cd $builddir
exit

Now that I have an ANTS-specific live/install cd, I should be able to continue updating it and producing new versions without needing to reinstall from the default 9front iso, but for completeness sake, I will describe the workflow I used for doing so.

First, I did an install from the latest 9front iso, changing the size of the hjfs partition to be smaller, as described in http://doc.9gridchan.org/them/vultr. After rebooting, I ran the 9front sysupdate and rebuilt a few things which had received changes. Then, I cloned the https://bitbucket.org/mycroftiv/antsexperiments repository, cd'd into it, and issued the "build vultrfossil" command. Next I rebooted into the new ANTS-fossil environment it created, copied the 9ants kernel and tools.tgz from the 9fat into the /386 directory, and then issued the new "build 9frontcd" command to produce the 9front-ants .iso image.

The next step is editing documentation to mention its existence and link to it, and figuring out to what extent it should "publicized" in some fashion. I think making ANTS available in this form should make it easier for people to explore its features. The complexity barrier to playing with a live cd is lower than reading the docs to figure out how to build and install from a repo.