code: fqa.9front.org

ref: 1d17ae034c477cedd86d43d9a8332453d76b36e6
dir: /fqa5.ms/

View raw version
.\" This troff source is processed to create all forms of the
.\" 9FRONT DASH 1 book and the http://fqa.9front.org website.
.\" NOTE: Purely experimental. Methods employed may change.
.\" troff -ms -mpictures fqa5.ms | page
.\" htmlroff -u -ms -mhtml fqa5.ms >fqa5.html
.de FG	\" .FG <basename>
.ie h .html - <img src="\\$1.\\$2" />
.el .BP \\$1.ps
.br
..
.po 1i \" page offset (from left)
.fp 1 R LucidaSans
.fp 2 I LucidaSansI
.fp 3 B LucidaSansB
.fp 4 BI LucidaSansI
.fp 5 CW LucidaCW
.paragraph 0
.margin 0
.HTML "FQA 5 - Building the System from Source
.html - <style type="text/css">body{font-size:10pt}; a{font-size:10pt}</style>
.html - <a href="fqa.html">FQA INDEX</a> |
.html - <a href="fqa4.html">FQA 4 - 9front Installation Guide</a> |
.html - <a href="fqa6.html">FQA 6 - Networking</a>
.html - <hr />
.SH
.LG
.ihtml h1 <h1>
FQA 5 - Building the System from Source
.ihtml h1
.NL
.R
.html - <a href="fqa5.html">html</a> |
.html - <a href="fqa5.pdf">pdf</a> |
.html - <a href="fqa5.ms">troff</a>

.FG thesource jpg

.html - <a name="5.1" />
.ihtml h2 <h2>
.SH
5.1 - Why should I build my system from source?
.R
.ihtml h2

Some reasons why you might actually wish or need to build from source:
.ihtml ul <ul>
.IP
• Updates have been committed since you performed the installation.

• Test or develop new features.
.LP
.ihtml ul

.html - <a name="5.2" />
.ihtml h2 <h2>
.SH
5.2 - Building 9front from source
.R
.ihtml h2

.html - <a name="5.2.1" />
.ihtml h3 <h3>
.SH
5.2.1 - Update sources
.R
.ihtml h3

9front uses
.ihtml a <a href="http://man.9front.org/1/hg">
hg(1)
.ihtml a
to synchronize the system with the
.ihtml a <a href="https://code.9front.org/hg/plan9front/">
9front repository:
.ihtml a
.P1
cd /
bind -ac /dist/plan9front /
hg incoming
hg -v pull -u
.P2

which is consolidated in the command:
.P1
sysupdate
.P2

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:
.P1
hg update -C --clean
.P2

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

.html - <a name="5.2.1.1" />
.ihtml h4 <h4>
.SH
5.2.1.1 - hgrc
.R
.ihtml h4

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

To use Mercurial with
.ihtml a <a href="http://man.9front.org/4/webfs">
.CW webfs(4)
.ihtml a
instead of Python's built-in HTTP:
.P1
[extensions]
hgwebfs=
.P2

.B Note:
The
.CW hgwebfs
extension expects login credentials to be present in
.ihtml a <a href="http://man.9front.org/4/factotum">
.CW factotum(4) ,
.ihtml a
else Mercurial will abort when any attempt is made to access resources
that require authentication. To add credentials to
.CW factotum :
.P1
echo\ \'key\ proto=pass\ realm=PAIN\ server=code.9front.org\ service=http \\
	user=cinap_lenrek\ !password=FckG00gl!\'\ >>/mnt/factotum/ctl
.P2

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

Credentials may be saved permanently and loaded into
.CW factotum
at boot time using
.ihtml a <a href="http://fqa.9front.org/fqa8.html#8.4.7">
.I
FQA 8.4.7 - secstore.
.R
.ihtml a

.html - <a name="5.2.2" />
.ihtml h3 <h3>
.SH
5.2.2 - Building from source
.R
.ihtml h3

.B 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:
.ihtml a <a href="http://man.9front.org/8/swap">
.CW swap(8) ,
.ihtml a
.ihtml a <a href="fqa3.html#3.3">
.I
FQA 3.3 - What is an appropriate first system to learn 9front on?
.R
.ihtml a

.P1
# 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
mk

# build the papers and html (optional)
cd /sys/doc
mk
mk html
.P2

Build the kernel for 386:
.P1
cd /sys/src/9/pc
mk install
.P2

Build the kernel for amd64:
.P1
cd /sys/src/9/pc64
mk install
.P2

Build the kernel for Raspberry Pi:
.P1
cd /sys/src/9/bcm
mk install
.P2

Read:
.ihtml a <a href="fqa7.html#7.2.5">
.I
FQA 7.2.5 - How do I install a new kernel?
.R
.ihtml a

.html - <a name="5.2.2.1" />
.ihtml h4 <h4>
.SH
5.2.2.1 - Cross compiling
.R
.ihtml h4

To cross compile, simply set the
.CW objtype
environment variable prior to running the build. For example, to build all the amd64 binaries on a 386 system:
.P1
# create any missing directories needed for the build
cd /
\&. /sys/lib/rootstub
cd /sys/src
objtype=amd64 mk install
.P2

.html - <a name="5.3" />
.ihtml h2 <h2>
.SH
5.3 - Building an ISO
.R
.ihtml h2

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

.B Note:
Currently, only the 386 architecture is built for the ISO. Read:
.ihtml a <a href="fqa8.html#8.9">
.I
FQA 8.9 - Bootstrapping architectures not included on the ISO
.R
.ihtml a
for more information on booting other architectures.

.P1
# 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
.P2

.html - <a name="5.4" />
.ihtml h2 <h2>
.SH
5.4 - Common Problems when Compiling and Building
.R
.ihtml h2

Most of the time, problems in the build process are caused by not following the above directions carefully.
./" 5.4 should mention that sometimes you end up with a .8 file in a bad 
./" state which can usually be resolved by deleting the .8 file or mk clean

.html - <hr />
.html - <a href="fqa.html">FQA INDEX</a> |
.html - <a href="fqa4.html">FQA 4 - 9front Installation Guide</a> |
.html - <a href="fqa6.html">FQA 6 - Networking</a>