Difference between revisions of "FreeBSD/LiveCD"

From Secure Computing Wiki
Jump to: navigation, search
(work in progress)
Line 1: Line 1:
== 32bit within 64bit land ==
+
This document will describe how to get a rudimentary Live CD built on your own system from a working/running FreeBSD install.
<pre>14:31 < ecrist> if I chroot to a 32-bit env on a 64-bit host, it wants to install 64-bit packages, can I change that somehow?
+
 
14:33 < jpaetzel> yeah
+
== Getting Started ==
14:33 < jpaetzel> if you do man uname
+
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.
14:34 < jpaetzel> There are some env vars you can set to fool things into thinking it's 32 bit
+
 
14:35 < jpaetzel> # setenv MACHINE i386
+
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.
14:35 < jpaetzel> # setenv UNAME_p i386
+
 
14:35 < jpaetzel> # setenv UNAME_m i386
+
<pre># cd /usr/src
 +
# make buildworld DESTDIR=/path/to/livecd
 +
# make installworld DESTDIR=/path/to/livecd
 +
# make distribution DESTDIR=/path/to/livecd</pre>
 +
 
 +
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:
 +
<pre># 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
 
</pre>
 
</pre>
 +
 +
 +
== 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:
 +
<pre># mount -t devfs devfs /path/to/livecd/dev
 +
# chroot /path/to/livecd</pre>
 +
 +
As above, if you're cross-compiling, you need to set a couple environment variables.  Once inside your chroot, set the following environment variables:
 +
<pre>MACHINE i386
 +
UNAME_p
 +
UNAME_m</pre>
 +
 +
You should now be able to pkg_add or build any ports you need for your live CD.
  
 
== commands ==
 
== commands ==
Line 15: Line 38:
 
=== Links ===
 
=== Links ===
 
* [http://wiki.freebsd.org/AvgLiveCD http://wiki.freebsd.org/AvgLiveCD]
 
* [http://wiki.freebsd.org/AvgLiveCD http://wiki.freebsd.org/AvgLiveCD]
 +
* [http://bsdimp.blogspot.com/2006/09/cross-building-freebsd.html Cross Compiling on FreeBSD]
  
 
=== Man Pages ===
 
=== Man Pages ===
 
* mdmfs
 
* mdmfs

Revision as of 11:16, 7 July 2010

This document will describe how to get a rudimentary Live CD built on your own system from a working/running FreeBSD install.

Getting Started

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.

  1. 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.

commands

mkisofs -no-emul -r -b boot/cdboot -J -V FreeBSD-CLX -o /home/ecrist/clx.iso livecd32/

Resources

Links

Man Pages

  • mdmfs