Live FreeBSD CD

From: Andrew Turner <andrew_at_fubar.geek.nz>
Date: Tue, 30 Nov 2004 21:37:49 +1300
Using nanobsd as a starting point I have created a live CD system I've
named liveFreeBSD. It requires syutils/cdrtools to create
liveFreeBSD.iso. Unlike FreeBSIE it only uses files from the tree with 3
exceptions.

To use run the shell archive and set WORLDDIR to an appropriate value
ie. /usr/src.

It works in a similar way to nanobsd with the exception of the way it is
customised. To customise liveFreeBSD create a new directory then have
CUSTOMIZE point to it. If there is a make.conf file in it liveFreeBSD
will pick it up and use it in the came way as an /etc/make.conf. Any
directories will have their contents copied.
eg.
$ find /home/andrew/FreeBSD -type f
/home/andrew/FreeBSD/etc/test1.txt
/home/andrew/FreeBSD/make.conf

$ make obj
$ make CUSTOMIZE=/home/andrew/FreeBSD
Will build the bootable CD with the file /etc/test1.txt. It will bring
in any Makefile options from /home/andrew/FreeBSD/make.conf

I have tested this on HEAD and RELENG_5.

KNOWN BUGS:
* Customize will only copy files 1 level deep, ie. 
${CUSTOMIZE}/etc/<file> but not
${CUSTOMIZE}/usr/share/<file>

Andrew

-- 
437742420

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	Makefile
#	etc
#	make.conf
#
echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
X# Copyright (c) 2003-2004 Poul-Henning Kamp.
X# Copyright (c) 2004      Thomas Quinot.
X# Copyright (c) 2004      Andrew Turner.
X#
X# See /usr/share/examples/etc/bsd-style-copyright for license terms.
X#
X# $FreeBSD: src/tools/tools/nanobsd/Makefile,v 1.8 2004/08/16 22:41:58 thomas Exp $
X
X#.include "${.CURDIR}/make.conf"
X
X# parallism flag for make.
XMAKEJ?=
X
X# You probably do not need to change these.
XWORLDDIR?= ${.CURDIR}/../../..
XWD?=	${.OBJDIR}/_.w
X
X# Keep overides for custom builds in the ${.CURDIR}/${CUSTOMIZE} directory
X#CUSTOMIZE?=test
X
X.if defined(CUSTOMIZE) && !empty(CUSTOMIZE)
X.if ${CUSTOMIZE:C/^\/.*$/\//} == "/"
XCUSTOMIZE_PATH=${CUSTOMIZE}
X.elif exists(${.CURDIR}/${CUSTOMIZE})
XCUSTOMIZE_PATH=${.CURDIR}/${CUSTOMIZE}
X.endif
X.endif
X
X.if exists(${CUSTOMIZE_PATH}/make.conf)
XMAKE_CONF_INCLUDE=${CUSTOMIZE_PATH}/make.conf
X.include "${MAKE_CONF_INCLUDE}"
X.endif
X
X#
X# The final resulting image is in ${.OBJDIR}/_.i and the single slice
X# image in ${.OBJDIR}/_.i.s1
X#
X
X# Main target
Xall:	buildworld installworld buildimage
X
X#
X# This is where you customizations to the image can be performed
X# Please make sure to do everything relative to ${WD} here.
X#
X.if defined(CUSTOMIZE_PATH)
XPATHS!= find ${CUSTOMIZE_PATH} -type d -depth 1
X.endif
X
XCustomize:	_.cs
X_.cs:	_.iw _.di _.ik _.di
X.if defined(CUSTOMIZE_PATH)
X.for __DIR in ${PATHS}
X	_at_echo ${WD}${__DIR:S/${CUSTOMIZE_PATH}//}
X	mkdir -p ${WD}${__DIR:S/${CUSTOMIZE_PATH}//}
X	-cp ${__DIR}/* ${WD}/${__DIR:S/${CUSTOMIZE_PATH}//}
X.endfor
X.endif
X	touch _.cs
X
X###########################################################################
X#
X# The rest is pretty (or ugly if you prefer) magic, and should generally
X# not need to be fiddled with.  Good luck if you need to venture past this
X# point.
X#
X
X# Run a buildworld with our private make.conf
Xbuildworld:	_.bw
X_.bw:
X	(cd ${WORLDDIR} && \
X		make ${MAKEJ} -s buildworld __MAKE_CONF=${.CURDIR}/make.conf \
X		MAKE_CONF_INCLUDE=${MAKE_CONF_INCLUDE} ) > _.bw.tmp 2>&1
X	mv _.bw.tmp _.bw
X
X# Run installworld and install into our object directory
Xinstallworld:	_.iw
X_.iw:	_.bw
X	-rm -rf ${WD} > /dev/null 2>&1
X	-chflags -R noschg ${WD} > /dev/null 2>&1
X	rm -rf ${WD}
X	mkdir -p ${WD}
X	(cd ${WORLDDIR} && \
X		make ${MAKEJ} -s installworld \
X		DESTDIR=${WD} \
X		__MAKE_CONF=${.CURDIR}/make.conf \
X		MAKE_CONF_INCLUDE=${MAKE_CONF_INCLUDE} \
X		) > _.iw.tmp 2>&1
X	mv _.iw.tmp _.iw
X
X# Run distribution target in /etc.
X_.di:	_.iw
X	mkdir -p ${WD}
X	(cd ${WORLDDIR}/etc && \
X		make ${MAKEJ} -s distribution \
X		DESTDIR=${WD} \
X		__MAKE_CONF=${.CURDIR}/make.conf \
X		MAKE_CONF_INCLUDE=${MAKE_CONF_INCLUDE} \
X		) > _.di.tmp 2>&1
X	mv _.di.tmp _.di
X
X# Build kernel
X_.bk:
X	(cd ${WORLDDIR} && \
X		make ${MAKEJ} -s buildkernel \
X		__MAKE_CONF=${.CURDIR}/make.conf \
X		MAKE_CONF_INCLUDE=${MAKE_CONF_INCLUDE} \
X		) > _.bk.tmp 2>&1
X	mv _.bk.tmp _.bk
X
X# Install kernel and hints file
X_.ik:	_.bk _.di
X	cp ${WORLDDIR}/sys/i386/conf/GENERIC.hints ${WD}/boot/device.hints
X	(cd ${WORLDDIR} && \
X		make ${MAKEJ} installkernel \
X		DESTDIR=${WD} \
X		__MAKE_CONF=${.CURDIR}/make.conf \
X		MAKE_CONF_INCLUDE=${MAKE_CONF_INCLUDE} \
X		) > _.ik.tmp 2>&1
X	mv _.ik.tmp _.ik
X
X
X# Create a disk image from the installed image
Xbuildimage:	_.md
X_.md:	_.cs
X	-umount ${WD}/dev > /dev/null 2>&1
X	chflags -R noschg ${WD} > /dev/null 2>&1
X	rm -rf ${WD}/var/* ${WD}/dev/* ${WD}/tmp
X	ln -s var/tmp ${WD}/tmp
X	cp ${.CURDIR}/etc/* ${WD}/etc
X	mkisofs -R -U -b boot/cdboot -no-emul-boot \
X		-o liveFreeBSD.iso ${WD}
X	touch _.md
X
Xclean:
X	-rm -rf _.* > /dev/null 2>&1
X	-chflags -R noschg _.* > /dev/null 2>&1
X	rm -rf _.* liveFreeBSD.iso
X
X.include <bsd.obj.mk>
END-of-Makefile
echo c - etc
mkdir -p etc > /dev/null 2>&1
echo x - make.conf
sed 's/^X//' >make.conf << 'END-of-make.conf'
X#
X# Copyright (c) 2003-2004 Poul-Henning Kamp.
X# Copyright (c) 2004      Thomas Quinot.
X# Copyright (c) 2004      Andrew Turner.
X#
X# See /usr/share/examples/etc/bsd-style-copyright for license terms.
X#
X# $FreeBSD: src/tools/tools/nanobsd/make.conf,v 1.3 2004/08/16 22:52:40 thomas Exp $
X#
XKERNCONF?=GENERIC
X
X.if defined (MAKE_CONF_INCLUDE) && !empty(MAKE_CONF_INCLUDE) && exists(${MAKE_CONF_INCLUDE})
X.include "${MAKE_CONF_INCLUDE}"
X.endif
X
END-of-make.conf

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	etc/fstab
#	etc/host.conf
#	etc/nsswitch.conf
#
echo x - etc/fstab
sed 's/^X//' >etc/fstab << 'END-of-etc/fstab'
X/dev/acd0 / cd9660 ro 0 0
X
END-of-etc/fstab
echo x - etc/host.conf
sed 's/^X//' >etc/host.conf << 'END-of-etc/host.conf'
X# Auto-generated from nsswitch.conf, do not edit
Xhosts
Xbind
END-of-etc/host.conf
echo x - etc/nsswitch.conf
sed 's/^X//' >etc/nsswitch.conf << 'END-of-etc/nsswitch.conf'
Xgroup: compat
Xgroup_compat: nis
Xhosts: files dns
Xnetworks: files
Xpasswd: compat
Xpasswd_compat: nis
Xshells: files
END-of-etc/nsswitch.conf
exit
Received on Tue Nov 30 2004 - 07:38:25 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:23 UTC