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 likelihood, 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 svn co https://svn0.us-east.FreeBSD.org/base/stable/10 src
69 svn co https://svn0.us-east.FreeBSD.org/ports/head ports
71 And we should be ready to try a shot:
74 cp /usr/src/tools/tools/sysbuild/sysbuild.sh .
75 sh sysbuild.sh |& tee _.sb
77 If it succeeds, you should be able to:
79 boot0cfg -s 2 -v /dev/ad0
82 And come up with your newly built system.
84 Next time you want a new system, you just run sysbuild.sh again
85 and boot slice 1 when it's done.
90 The sysbuild.sh script takes various parameters:
92 -c specfile # configure stuff, see below.
93 -w # skip buildworld, assume it was done earlier.
94 -k # skip buildkernel, ---//---
95 -b # skip both buildworld & buildkernel
96 -p # install cached packacges if found.
98 The specfile is a shellscript where you can override or set a number of
99 shell variables and functions.
103 # use a kernel different from GENERIC
106 # Cache built packages, so we can use -p
107 PKG_DIR=/freebsd/packages
109 # Mount ports distfiles from another machine
110 REMOTEDISTFILES=fs:/rdonly/distfiles
112 # Fetch distfiles through a proxy
113 FTP_PROXY=http://127.0.0.1:3128/
114 HTTP_PROXY=http://127.0.0.1:3128/
115 export FTP_PROXY HTTP_PROXY
117 # We want these ports
119 /usr/ports/archivers/unzip
120 /usr/ports/archivers/zip
121 /usr/ports/cad/linux-eagle
122 /usr/ports/comms/lrzsz
123 /usr/ports/databases/rrdtool
124 /usr/ports/devel/subversion-freebsd
136 # Shell functions to tweak things
137 # (This makes commits to /etc mostly painless)
139 chpass -p "\$1\$IgMjWs2L\$Nu12OCsjfiwHHj0I7TmUN1" root
141 pw useradd phk -u 488 -d /home/phk -c "Poul-Henning Kamp" \
142 -G "wheel,operator,dialer" -s /bin/csh -w none
144 chpass -p "\$1\$VcM.9Ow8\$IcXHs0h9jsk27b8N64lOm/" phk
146 sed -i "" -e 's/^DS/DSorigo.freebsd.dk/' /etc/mail/sendmail.cf
147 sed -i "" -e '/console/s/^/#/' /etc/syslog.conf
148 echo "beastie_disable=YES" >> /boot/loader.conf
149 touch /root/.hushlogin