#!/bin/rc # build script for advanced namespace tools/rootless boot kernel # build clean, build patched, build tools, build extras, build bootpaq, build docs # build ramfs / build if(! test -e bootdir.extras){ echo 'This build script must be run only from the base rootless directory' exit wrong.dir } if(~ `{pwd} /tmp*){ echo 'The /tmp directory is used by the build process - cannot build here' exit wrong.dir } ## set up namespace so we keep everything we do contained rfork ne builddir=`{pwd} if(! test -d compiletemp){ echo 'mkdir compiletemp' mkdir compiletemp } if(! test -d bootdir.extras/root/adm){ echo 'creating bootdir.extras/root skeleton' cd bootdir.extras tar xf skel.tar cd $builddir } if(! test -d root/bin){ echo 'creating root tools skeleton' tar xzf root.targz } bind -b $builddir/src.9.boot /sys/src/9/boot bind -b $builddir/src.9.port /sys/src/9/port bind -b $builddir/src.9.pc /sys/src/9/pc bind -b $builddir/scripts /bin bind $builddir /n/rootless bind -bc $builddir/compiletemp /sys/src/9/pc if(~ $1 worker){ if(! ~ $user `{cat /dev/hostowner}){ echo only hostowner can build a worker exit no.hostowner } echo WARNING FORMATS DRIVE SDC1 sleep 10 echo building worker sdC1 disk/mbr -m /386/mbr /dev/sdC1/data disk/fdisk -baw /dev/sdC1/data disk/prep -bw -a^(9fat nvram) /dev/sdC1/plan9 disk/format -b /386/pbslba -d -r 2 /dev/sdC1/9fat /386/9load $builddir/9pcram.gz $builddir/tools.tgz $builddir/cfg/plan9.ini dossrv -f /dev/sdC1/9fat c1fat mount -c /srv/c1fat /n/c1fat mkdir /n/c1fat/adm dircp $builddir/cfg/adm /n/c1fat/adm unmount /n/c1fat rm /srv/c1fat cp $builddir/cfg/nvram /dev/sdC1/nvram chmod 640 /dev/sdC1/nvram exit '' } if(~ $1 isoinstall){ if(! ~ $user `{cat /dev/hostowner}){ echo only hostowner can build isoinstall exit no.hostowner } echo WARNING changes your plan9.ini echo use build everything to build with no system changes sleep 5 echo installing hubfs and grio and scripts cd hubfs1.1 mk install cd $builddir cd grio mk install cd $builddir cp scripts/* /rc/bin cp bootdir.extras/namespace.saveterm /lib/namespace.saveterm echo installing 9pcram kernel and tools.tgz and plan9.ini 9fat: kernel=9pcram.gz if(test -e compiletemp/9pcram.gz) kernel=compiletemp/9pcram.gz cp $kernel /n/9fat/9pcram.gz cp tools.tgz /n/9fat/tools.tgz mv /n/9fat/plan9.ini /n/9fat/p9ini.old cp doc/PLAN9.INI /n/9fat/plan9.ini echo installing manpages cp doc/man.cpns /sys/man/1/cpns cp doc/man.rerootwin /sys/man/1/rerootwin cp doc/man.addwrroot /sys/man/1/addwrroot cp doc/man.ventiprog /sys/man/8/ventiprog cp doc/man.plan9rc /sys/man/8/plan9rc cp doc/antspaper.ms /sys/doc/ants.ms cp doc/ants.ps /sys/doc/ants.ps mv /sys/man/3/proc /sys/man/3/oldproc mv /sys/man/8/boot /sys/man/8/oldboot cp doc/modified.manpages/proc.man /sys/man/3/proc cp doc/modified.manpages/boot.man /sys/man/8/boot echo install complete exit '' } if(~ $1 docs){ echo building docs cp hubfs1.1/hubfs.man doc/man.hubfs cd doc cp man.cpns $builddir/sys/man/1/cpns cp man.rerootwin $builddir/sys/man/1/rerootwin cp man.addwrroot $builddir/sys/man/1/addwrroot cp man.ventiprog $builddir/sys/man/8/ventiprog cp man.plan9rc $builddir/sys/man/8/plan9rc cp man.hubfs $builddir/sys/man/4/hubfs cp modified.manpages/proc.man $builddir/sys/man/3/proc cp modified.manpages/boot.man $builddir/sys/man/8/boot troff -ms antspaper.ms | dpost >ants.ps cd $builddir exit '' } if(~ $1 everything){ echo building everything build clean build patched build tools build extras build bootpaq build exit '' } if(~ $1 clean){ echo building mk clean cd /sys/src/9/pc mk clean cd $builddir cd grio mk clean cd $builddir cd hubfs1.1 mk clean cd $builddir rm root/bin/* >/dev/null >[2=1] rm bootdir.extras/bootpaq >/dev/null >[2=1] exit '' } if(~ $1 patched){ echo building patched ramfs mkdir /tmp/rc mkdir /tmp/factotum dircp /sys/src/cmd/rc /tmp/rc dircp /sys/src/cmd/auth/factotum /tmp/factotum cp patched/rc.plan9.c /tmp/rc/plan9.c cp patched/factotumdat.h /tmp/factotum/dat.h cp patched/factotumfs.c /tmp/factotum/fs.c cp patched/factotumutil.c /tmp/factotum/util.c cd /tmp/rc mk cp 8.out $builddir/bootdir.extras/rc cd /tmp/factotum mk 8.factotum cp 8.factotum $builddir/bootdir.extras/factotum cd $builddir strip bootdir.extras/rc >/dev/null >[2=1] strip bootdir.extras/factotum >/dev/null >[2=1] rm -rf /tmp/rc rm -rf /tmp/factotum exit '' } if(~ $1 extras){ echo building extras cd grio mk clean mk cp 8.out ../bootdir.extras/grio cd ../hubfs1.1 mk clean mk all cp 8.hubfs ../bootdir.extras/hubfs cp 8.hubshell ../bootdir.extras/hubshell cp hub ../bootdir.extras cd $builddir strip bootdir.extras/grio >/dev/null >[2=1] strip bootdir.extras/hubfs >/dev/null >[2=1] strip bootdir.extras/hubshell >/dev/null >[2=1] exit '' } if(~ $1 bootpaq){ echo building bootpaq cp scripts/* bootdir.extras/root/bin cd bootdir.extras rm skel.tar tar cf skel.tar root cd $builddir rm root/bin/* >/dev/null >[2=1] cp root/lib/_mkpaq root/bin cd root/bin . _mkpaq cd $builddir strip root/bin/* >/dev/null >[2=1] mkpaqfs -b 8192 -o bootdir.extras/bootpaq root/bin sha1sum bootdir.extras/bootpaq >>build.hashes exit '' } if(~ $1 tools){ echo building tools rm root/bin/* >/dev/null >[2=1] tar czf root.targz root cp root/lib/_toolcopy root/bin cd root/bin . _toolcopy cd $builddir strip root/bin/* >/dev/null >[2=1] ramfs -m /tmp tar cf /tmp/tools.tar root gzip -9 -c /tmp/tools.tar >tools.tgz rm /tmp/tools.tar cd $builddir sha1sum tools.tgz >>build.hashes exit '' } echo building kernel rm root/bin/* >/dev/null >[2=1] cp /bin/paqfs root/bin cp /bin/usb/usbd root/bin cp /bin/disk/partfs root/bin cp /bin/bind root/bin cp /bin/mount root/bin cp /bin/read root/bin cp /bin/cat root/bin cp /bin/echo root/bin cp /bin/test root/bin strip root/bin/* >/dev/null >[2=1] if(~ $1 ramfs){ echo building kernel in tmp ramfs -m /tmp bind -bc /tmp /sys/src/9/pc } cd /sys/src/9/pc mk 'CONF=pcram' gzip -9 -c 9pcram > $builddir/compiletemp/9pcram.gz cd $builddir sha1sum compiletemp/9pcram.gz >>build.hashes exit ''