NetBSD/distrib/common/Makefile.bootcd
2007-01-17 00:47:40 +00:00

96 lines
2.5 KiB
Makefile

# $NetBSD: Makefile.bootcd,v 1.7 2007/01/17 00:47:40 hubertf Exp $
#
# Makefile snipped to create a CD/DVD ISO
#
# XXX TODO:
# 1) merge with src/distrib/cdrom
# 2) teach makefs to add data from more than 1 directory (see below)
#
# Required variables:
# CDBASE Basename of the iso
# CDKERNEL Kernel to copy from ../instkernel (or it's obj dir)
#
# Optional variables:
# CDRELEASE Set to 'true' to include $RELEASEDIR/$MACHINE on the CD
# CDRELEASE_NOISOS Excludes installation/cdrom directory if set
# BOOT Defaults to $DESTDIR/usr/mdec/boot
# BOOTXX_CD9660 Defaults to $DESTDIR/usr/mdec/bootxx_cd9660
# CDBOOTOPTIONS Options for installboot, eg -o console=com0,speed=9600
# CDROMS_RELEASEDIR Where to install ${CDBASE}.iso
#
BOOT?= ${DESTDIR}/usr/mdec/boot
BOOTXX_CD9660?= ${DESTDIR}/usr/mdec/bootxx_cd9660
CDRELEASE?= false
CDROMS_RELEASEDIR?= installation/cdrom
.if defined(CDRELEASE_NOISOS)
CDRELEASE_EXCLUDE= -s ',./installation/cdrom.*,,gp'
.endif
# Stuff that should come from elsewhere - XXX where? - HF
CP?= cp
RM?= rm
MKDIR?= mkdir -p
CHMOD?= chmod
CLEANFILES+= ${CDBASE}.iso
CLEANFILES+= bootxx
# for PRINTOBJDIR
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
_INSTKERELNOBJDIR!= cd ${.CURDIR}/../../instkernel && ${PRINTOBJDIR}
dependall all: prepare .WAIT copy-releasedir .WAIT image
prepare:
${MKDIR} cdrom
${CP} ${_INSTKERELNOBJDIR}/${CDKERNEL} cdrom/netbsd
${RM} -f cdrom/boot
${CP} ${DESTDIR}/usr/mdec/boot cdrom/boot
${RM} -f bootxx
${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx
${CHMOD} +w bootxx
${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx
# Copy $RELEASEDIR/${MACHINE} in the CDROM dir
#
# XXX This could be done a lot easier if makefs(8) could
# XXX include more than one directory on the image - HF
#
copy-releasedir:
if ${CDRELEASE} ; then \
if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then \
echo "No releasedir ${RELEASEDIR}/${MACHINE}, aborting" ; \
exit 1 ; \
fi ; \
${MKDIR} cdrom/${MACHINE} ; \
release_destdir=`pwd`/cdrom/${MACHINE} ; \
cd ${RELEASEDIR}/${MACHINE} ; \
echo Copying `pwd` to $$release_destdir ... ; \
${TOOL_PAX} \
-rw -pe -v \
${CDRELEASE_EXCLUDE} \
. $$release_destdir ; \
fi
image:
${TOOL_MAKEFS} -t cd9660 \
-o 'rockridge,bootimage=i386;bootxx,no-emul-boot' \
${CDBASE}.iso cdrom
release:
${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${MACHINE}/${CDROMS_RELEASEDIR}
clean:
${RM} -fr cdrom
.include <bsd.prog.mk>