FQA INDEX | FQA 4 - 9front Installation Guide | FQA 6 - Networking

FQA 5 - Building the System from Source

html | pdf | troff

5.1 - Why should I build my system from source?

Some reasons why you might actually wish or need to build from source:

5.2 - Building 9front from source

5.2.1 - Update sources

9front uses hg(1) to synchronize the system with the 9front repository:

cd /

bind -ac /dist/plan9front /

hg incoming

hg -v pull -u

which is consolidated in the command:


If hg refuses to update due to conflicts (e.g. if you installed something locally which was later incorporated into 9front), this is a quick workaround which discards local changes:

hg update -C --clean

After the tree is updated, recompile/build the updated programs as needed. - hgrc

During installation, the 9front Mercurial repository is copied to /dist/plan9front/.hg, is chmod 775, and is owned by user glenda and group sys. To update the repository when logged in as a user other than glenda, add that user to group sys add then add the following to $home/lib/hgrc:




To use Mercurial with webfs(4) instead of Python’s built-in HTTP:



Note: The hgwebfs extension expects login credentials to be present in factotum(4), else Mercurial will abort when any attempt is made to access resources that require authentication. To add credentials to factotum:

echo 'key proto=pass realm=PAIN server=code.9front.org service=http \

    user=cinap_lenrek !password=FckG00gl!' >>/mnt/factotum/ctl

Note: Depending on who you are and the repository being used, your credentials may differ.

Credentials may be saved permanently and loaded into factotum at boot time using FQA 8.4.7 - secstore.

5.2.2 - Building from source

Note: A minimum of 512MB RAM is needed to link some programs. If less than 512MB is available, be sure to turn on swap before building (Read: swap(8)).

# create any missing directories needed for the build

cd /

. /sys/lib/rootstub

# build everything

cd /sys/src

mk install

mk clean

# build manpage indices

cd /sys/man


# build the papers and html (optional)

cd /sys/doc


mk html

Build the kernel for 386:

cd /sys/src/9/pc

mk install

Build the kernel for amd64:

cd /sys/src/9/pc64

mk install

Build the kernel for Raspberry Pi:

cd /sys/src/9/bcm

mk install

Read: FQA 7.2.5 - How do I install a new kernel? - Cross compiling

To cross compile, simply set the objtype environment variable prior to running the build. For example, to build all the amd64 binaries on a 386 system:

# create any missing directories needed for the build

cd /

. /sys/lib/rootstub

cd /sys/src

objtype=amd64 mk install

5.3 - Building an ISO

The 9front ISO is a livecd that also serves as install media.

Note: Currently, only the 386 architecture is built for the ISO. Read: FQA 8.9 - Bootstrapping architectures not included on the ISO for more information on booting other architectures.

# put your root file system into /n/src9

bind /root /n/src9

# put your hg repository there

bind -ac /dist/plan9front /n/src9

# build the iso

cd /sys/lib/dist

mk /tmp/9front.iso

5.4 - Common Problems when Compiling and Building

Most of the time, problems in the build process are caused by not following the above directions carefully.

People who complained about this section of the FQA have so far not submitted anything better.

Good luck.

5.4.1 - Updating compilers

Changes to the compilers may necessitate updating the compiler before rebuilding the rest of the system:

cd /sys/src/cmd/cc; mk install

cd /sys/src/cmd/6c; mk install  # choose the appropriate compiler for your architecture

FQA INDEX | FQA 4 - 9front Installation Guide | FQA 6 - Networking