This document will describe how to get a rudimentary Live CD built on your own system from a working/running FreeBSD install.
To begin, start by building world and the proper kernel for your live CD. You can build a live CD on a 64-bit box for 32-bit fairly easily. The process is described briefly here.
Building world and kernel for a live CD is no different than building it for a running system. During the install process, we want to specify a new location, which will be our live CD. You do this with the DESTDIR variable, given to make.
# cd /usr/src # make buildworld DESTDIR=/path/to/livecd # make installworld DESTDIR=/path/to/livecd # make distribution DESTDIR=/path/to/livecd
If you're building a 64-bit live CD on a 32-bit box, or something else, add TARGET_ARCH and TARGET variables to your build/install. Here's an example of a 32-bit build being done on a 64-bit system:
# make buildworld TARGET_ARCH=i386 TARGET=i386 DESTDIR=/path/to/livecd # make installworld TARGET_ARCH=i386 TARGET=i386 DESTDIR=/path/to/livecd # make distribution TARGET_ARCH=i368 TARGET=i386 DESTDIR=/path/to/livecd
Configuration / Installing Packages
Once these operations are complete, you will have a 'working' system in /path/to/livecd (make sure the directory exists before putting files there!) Now, you can chroot to this directory and install a ports tree, add packages, etc. Again, if you're building a 32-bit live CD on a 64-bit system, or something similar, you need to do a couple things first.
- Setup a working devfs in your chroot:
# mount -t devfs devfs /path/to/livecd/dev # chroot /path/to/livecd
As above, if you're cross-compiling, you need to set a couple environment variables. Once inside your chroot, set the following environment variables:
MACHINE i386 UNAME_p UNAME_m
You should now be able to pkg_add or build any ports you need for your live CD. In our example, we're using this live CD to restore backups via rsync from a remote server.
mkisofs -no-emul -r -b boot/cdboot -J -V FreeBSD-CLX -o /home/ecrist/clx.iso livecd32/