You still can achieve that by doing a normal installation using sysinstall and just choosing
da0 instead of
ad0.
Another way is to create an image on your (internal) disk and install things inside it. This is more useful than the above if you want to redistribute the image. (Well you can always do the above and dd the pendrive to create an image of it but still.)
You'll need the distributions from
here or from a
disc1/
dvd1. The
base and
kernels distributions are the only ones required, the rest is optional.
If you want to customize the system, then install from source as is done normally (buildworld/kernel, installworld/kernel).
Of course you should mount directories such as
/tmp,
/var/run,
/var/log, etc. on
md(4) (i.e.
FStype=
mfs in
fstab) in order to minimize writes on the flash memory.
% dd if=/dev/zero of=freebsd.iso count=2000 bs=1m
# mdconfig -a -t vnode -f freebsd.iso -u 0
# fdisk -BI /dev/md0
# bsdlabel -B -w md0s1
(a single partition for a live system should be good enough)
# newfs /dev/md0s1a
# mount -o noatime /dev/md0s1a /mnt/md
In the directory of each distribution you want to install (you should be using sh for that):
# DESTDIR=/mnt/md ./install.sh
Do anything else you want to do here.
# umount /mnt/md
# mdconfig -d -u 0
Note 1: the above may contain many errors, missing and inaccurate things, but you should get the general idea.
Note 2: the kernel should be installed in
/boot/kernel so make sure it's there when you extract the
kernels distribution.
Note 3: don't forget to create the
/mnt/md/etc/fstab file and any other configuration file.
Note 4: you can create a GEOM label for your partition.
Applications can be installed as packages (or packaged ports, see
pkg_create(1)) from your current installation using
pkg_add()'s
-C /
--chroot option I believe. Or you could boot the pendrive and install applications from there.