6 I have been running -current on my laptop since before FreeBSD 2.0 was
7 released and along the way developed this little trick to making the
10 sysbuild.sh is a way to build a new FreeBSD system on a computer from
11 a specification, while leaving the current installation intact.
13 sysbuild.sh assume you have two partitions that can hold your rootfs
14 and can be booted, and roughly speaking, all it does is build a new
15 system into the one you don't use, from the one you do use.
17 A partition named /freebsd is assumed to be part of your layout, and
18 that is where the sources and ports will be found.
20 If you know how nanobsd works, you will find a lot of similarity.
25 In all likelyhood, it is easier if we imagine you start with a blank
28 Grab a FreeBSD install ISO and boot it.
30 Create four disk slices:
37 Create a root filesystem in s1a filling the entire ad0s1 slice.
39 Create a swap partition, if you want one, in ad0s4b.
41 Install the boot0 bootmanager.
43 Install the "Minimal" FreeBSD system into ad0s1a.
45 Reboot from the newly installed system.
47 Run these commands to set up the other partitions sysbuild.sh cares about:
50 newfs -b 4096 -f 512 -O2 -U /dev/ad0s3
51 echo "/dev/ad0s3 /freebsd ufs rw 2 2" >> /etc/fstab
55 # deputy rootfilesystem
56 bsdlabel -B -w /dev/ad0s2
57 newfs -O2 -U /dev/ad0s2a
59 Next, install ports and sources:
66 mkdir ports src packages
68 # Or use svn if you prefer
69 csup -h cvsup.???.freebsd.org /usr/share/examples/cvsup/ports-supfile
70 csup -h cvsup.???.freebsd.org /usr/share/examples/cvsup/stable-supfile
72 And we should be ready to try a shot:
75 cp /usr/src/tools/tools/sysbuild/sysbuild.sh .
76 sh sysbuild.sh |& tee _.sb
78 If it succeeds, you should be able to:
80 boot0cfg -s 2 -v /dev/ad0
83 And come up with your newly built system.
85 Next time you want a new system, you just run sysbuild.sh again
86 and boot slice 1 when it's done.
91 The sysbuild.sh script takes various parameters:
93 -c specfile # configure stuff, see below.
94 -w # skip buildworld, assume it was done earlier.
95 -k # skip buildkernel, ---//---
96 -b # skip both buildworld & buildkernel
97 -p # install cached packacges if found.
99 The specfile is a shellscript where you can override or set a number of
100 shell variables and functions.
104 # use a kernel different from GENERIC
107 # Cache built packages, so we can use -p
108 PKG_DIR=/freebsd/packages
110 # Mount ports distfiles from another machine
111 REMOTEDISTFILES=fs:/rdonly/distfiles
113 # Fetch distfiles through a proxy
114 FTP_PROXY=http://127.0.0.1:3128/
115 HTTP_PROXY=http://127.0.0.1:3128/
116 export FTP_PROXY HTTP_PROXY
118 # We want these ports
120 /usr/ports/archivers/unzip
121 /usr/ports/archivers/zip
122 /usr/ports/cad/linux-eagle
123 /usr/ports/comms/lrzsz
124 /usr/ports/databases/rrdtool
125 /usr/ports/devel/subversion-freebsd
137 # Shell functions to tweak things
138 # (This makes commits to /etc mostly painless)
140 chpass -p "\$1\$IgMjWs2L\$Nu12OCsjfiwHHj0I7TmUN1" root
142 pw useradd phk -u 488 -d /home/phk -c "Poul-Henning Kamp" \
143 -G "wheel,operator,dialer" -s /bin/csh -w none
145 chpass -p "\$1\$VcM.9Ow8\$IcXHs0h9jsk27b8N64lOm/" phk
147 sed -i "" -e 's/^DS/DSorigo.freebsd.dk/' /etc/mail/sendmail.cf
148 sed -i "" -e '/console/s/^/#/' /etc/syslog.conf
149 echo "beastie_disable=YES" >> /boot/loader.conf
150 touch /root/.hushlogin