code: fqa.9front.org

ref: 5dc4afccc896cc41f1a5850f0ec520d76881e9a7
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/git">
git(1)
.ihtml a
to synchronize the system with the
.ihtml a <a href="http://git.9front.org/plan9front/plan9front/HEAD/info.html">
9front repository:
.ihtml a
.P1
cd /
bind -ac /dist/plan9front /
git/pull -u gits://git.9front.org/plan9front/plan9front
.P2

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

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

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

.FG nosnackcar jpg

.html - <a name="5.2.1.2" />
.ihtml h3 <h3>
.SH
5.2.1.2 - git
.R
.ihtml h3

During installation, the 9front git repository is copied to
.CW /dist/plan9front/.git ,
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 .

.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

.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

.B Note:
Before cross compiling a kernel, the compiler, assembler, linker, and
.ihtml a <a href="http://man.9front.org/4/paqfs">
.CW paqfs(4)
.ihtml a
for the target architecture need to be built and installed (Read
.ihtml a <a href="http://fqa.9front.org/fqa8.html#5.2.2.1">
.I
FQA 5.2.2.1 - Cross compiling).
.ihtml a

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 arm / Raspberry Pi:
.P1
cd /sys/src/9/bcm
mk 'CONF=pi' install
mk 'CONF=pi2' install
.P2

Build the kernel for arm64 / Raspberry Pi 3:
.P1
cd /sys/src/9/bcm64
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 and amd64 architectures have downloadable ISOs (rpi has a bootable image). 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.$objtype.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.

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

Good luck.
./" 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 - <a name="5.4.1" />
.ihtml h2 <h2>
.SH
5.4.1 - Updating compilers
.R
.ihtml h2

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

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

.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>