NetBSD/distrib/common/Makefile.bootcd

93 lines
2.4 KiB
Makefile

# $NetBSD: Makefile.bootcd,v 1.2 2006/08/02 21:37:41 oster 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
# 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
CDINSTALLBOOT= "${TOOL_INSTALLBOOT} ${CDBOOTOPTIONS} -m${MACHINE} @IMAGE@ ${MDEC}/bootxx_cd9660"
# 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} \
-t raw ${CDBOOTOPTIONS} -m${MACHINE} \
bootxx ${DESTDIR}/usr/mdec/bootxx_cd9660
# 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 ... ; \
pax -rw -pe -v . $$release_destdir ; \
fi
image:
${TOOL_MAKEFS} -t cd9660 \
-o 'bootimage=i386;bootxx,no-emul-boot' \
${CDBASE}.iso cdrom
release:
${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${MACHINE}/installation/cdrom
clean:
${RM} -fr cdrom
.include <bsd.prog.mk>