Upgrading a removable disk installation
keramida at ceid.upatras.gr
Sat Mar 1 20:31:20 UTC 2008
On 2008-02-29 09:46, Steve Bertrand <iaccounts at ibctech.ca> wrote:
> Hi all,
> I have a couple of systems that run from USB thumb sticks. These machines
> run 6.2.
> I'd like to do a typical source upgrade to 7.0 on a test machine.
> To do this, I plug the USB disk into a 'host' machine, and to save space on
> the thumb drive, I csup the sources to the standard locations on the host
> My thumb drive 'OS' slice is mounted as /var/removable-os on the host
> What I am unclear about is how I go about telling buildworld etc on the
> host machine. that I want to install the updates to the /var/removable-os
> location, instead of the default '/'.
It should be easy to use DESTDIR for this. I regularly update my USB
flash installation using the DESTDIR support of our Makefiles and the
following (a slightly modified version of the process described by
Warner Losh <imp at FreeBSD.org> in a series of excellent blog posts at
The commands below use sh(1) syntax, but it should be easy to `port'
them to csh(1) too:
# cd /usr/src
# export MAKEOBJDIRPREFIX='/ws/obj/bsd.i836'
# export TARGET='i386'
# export TARGET_ARCH='i386'
# make buildworld
# make buildkernel KERNCONF=KERAMIDA
# fdisk -I da0
# fdisk -B da0
# bsdlabel -w da0s1 auto
# bsdlabel -B da0s1
# newfs -L USBROOT /dev/da0s1a
# mount /dev/da0s1a /mnt
# make installworld DESTDIR=/mnt
# make installkernel DESTDIR=/mnt KERNCONF=KERAMIDA INSTALL_NODEBUG=t
# make distrib-dirs DESTDIR=/mnt
# make distribution DESTDIR=/mnt
# echo /dev/ufs/USBROOT / ufs rw 1 1 > /mnt/etc/fstab
# echo ifconfig_DEFAULT=DHCP > /mnt/etc/rc.conf
# echo 'hostname="demo"' >> /mnt/etc/rc.conf
As long as you have a base system which can buildworld for the target
version/release, this should work.
You can obviously skip the change for `MAKEOBJDIRPREFIX', `TARGET' and
`TARGET_ARCH', if you are building the same version & architecture for
the USB flash disk.
I usually customize `GENERIC', but you can use `KERNCONF=GENERIC' where
I have used `KERNCONF=KERAMIDA' above.
A post which describes the steps I copied above. See the comments
of the blog post too. They contain a fair amount of useful tips.
Yet another well written post, by Warner. This time it describes
how to build an SD disk for ARM systems, but it is also a nice read.
Some of the bits are quite interesting, i.e. the description of how
the hypothetical ARM-based system boots :)
More information about the freebsd-questions