NetBSD Build World

Heads-up on PVH

export CVSROOT="anoncvs@anoncvs.fr.NetBSD.org:/cvsroot"
export CVS_RSH="ssh"

cd /usr/
cvs -z9 checkout src
cd src/sys/
cvs -z9 up -dP -rbouyer-xenpvh

(re)start clean (included when doing release)

cd /usr/src/
rm -rf /root/tools /root/dest /root/release /root/obj
mkdir /root/tools /root/dest /root/release /root/obj
time ./build.sh -T /root/tools -D /root/dest -R /root/release -O /root/obj \
    -j16 cleandir > ../make.cleandir.log && print CLEAN
#207.62s

prepare the tools

time ./build.sh -T /root/tools -O /root/obj -j16 tools \
    > ../make.tools.log && print TOOLS
#1103.07s
#1158.18s
#1122.64s

full release

time ./build.sh -T /root/tools -D /root/dest -R /root/release -O /root/obj \
    -j16 release > ../make.release.log && print RELEASE
#8247.83s

sets only

#-T /root/tools -D /root/dest -D ../destdir -O /root/obj -j16 sets

Requirements

enough disk space, eventually give your guest an additional vdisk,

dd if=/dev/zero of=bsdbuild.data.ffs bs=1G count=0 seek=10000
...
disklabel xbd1
newfs -O2 /dev/xbd1a
dumpfs /dev/rxbd1a | head -3
vi /etc/fstab

/dev/xbd1a /data ffs rw 0 2

mount /data

enough processing power,

egrep 'memory|^[v]?cpu' /var/run/dmesg.boot

run the build inside a tmux or screen session,

export PKG_PATH="http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/8.0/All/"
pkg_add screen
cp /usr/pkg/share/examples/screen/etcscreenrc /usr/pkg/etc/screenrc
ln -s /usr/pkg/etc/screenrc /root/screenrc
cat >> /root/screenrc <<-EOF
caption always "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
bindkey ^[, prev
bindkey ^[. next
defscrollback 100000
EOF
screen -S build

Fetching the source

now proceed,

cd /data
ls -alkF
ftp -a ftp://ftp.ee.netbsd.org/pub/NetBSD/NetBSD-current/tar_files/src.tar.gz
ftp -a ftp://ftp.ee.netbsd.org/pub/NetBSD/NetBSD-current/tar_files/src.tar.gz.SHA1
sha1 src.tar.gz
cat src.tar.gz.SHA1
progress -zf src.tar.gz tar xf -

handy symlinks

cd ~/
ln -s /data/src
cd /usr/
ln -s /data/src

clean everything up before building

rm -rf ../tooldir ../destdir ../releasedir ../objdir
mkdir ../tooldir ../destdir ../releasedir ../objdir
time ./build.sh -T ../tooldir -D ../destdir -R ../releasedir -O ../objdir -j24 cleandir \
    >/dev/null && print cleandir done #207.62s
rm -f *.log
rm -rf obj tools/obj
rm -rf dist/bind/bin/tests/system/dnssec/ns1

get up-to-date source tree

cd /data/src/
#cvs -n -q -z9 up -dP
time cvs -q -z9 up -dP #183.44s

in case you are looking for a very recent commit or bug fix e.g.

cd sbin/fsck_ext2fs/
cvs -z9 log -h setup.c

Building

prepare the toolchain

time ./build.sh -T ../tooldir -O ../objdir -j24 tools \
    > ../make.tools.log && print tools done #1103.07s/1158.18s
tail ../make.tools.log

without X11, no -x,

rm -rf ../destdir ../releasedir
mkdir ../destdir ../releasedir

#time ./build.sh -T ../tooldir -D ../destdir -O ../objdir -j24 sets \
#   > ../make.sets.log && print sets done
#tail -100 ../make.sets.log 

time ./build.sh -T ../tooldir -D ../destdir -R ../releasedir -O ../objdir -j24 release \
    > ../make.release.log && print release done #8247.83s
tail ../make.release.log

and eventually look at the cpu usage,

pkg_add htop
mkdir /proc
echo "procfs /proc procfs ro,linux 0 0" >> /etc/fstab
mount /proc

egrep '^[v]?cpu' /var/run/dmesg.boot | tail -2
htop

Clean-up

cd /data/
rm -rf dest/ destdir/ objdir/ releasedir/ tooldir/

Resources

https://www.netbsd.org/docs/guide/en/chap-build.html

https://www.netbsd.org/docs/guide/en/part-compile.html

https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/BUILDING

https://wiki.netbsd.org/tutorials/how_to_build_netbsd-current/


HOME | GUIDES | BENCHMARKS | html