Makefile.bootcd revision 1.6
11.6Sdsl#	$NetBSD: Makefile.bootcd,v 1.6 2007/01/07 18:34:48 dsl Exp $
21.1Shubertf#
31.1Shubertf# Makefile snipped to create a CD/DVD ISO
41.1Shubertf#
51.1Shubertf
61.1Shubertf# XXX TODO:
71.1Shubertf# 1) merge with src/distrib/cdrom
81.1Shubertf# 2) teach makefs to add data from more than 1 directory (see below)
91.1Shubertf
101.1Shubertf#
111.1Shubertf# Required variables:
121.1Shubertf#	CDBASE		Basename of the iso
131.1Shubertf#	CDKERNEL	Kernel to copy from ../instkernel (or it's obj dir)
141.1Shubertf#
151.1Shubertf# Optional variables:
161.1Shubertf#	CDRELEASE	Set to 'true' to include $RELEASEDIR/$MACHINE on the CD
171.1Shubertf#	BOOT		Defaults to $DESTDIR/usr/mdec/boot
181.1Shubertf#	BOOTXX_CD9660	Defaults to $DESTDIR/usr/mdec/bootxx_cd9660
191.1Shubertf#	CDBOOTOPTIONS	Options for installboot, eg -o console=com0,speed=9600
201.1Shubertf#	CDROMS_RELEASEDIR Where to install ${CDBASE}.iso
211.1Shubertf#
221.1Shubertf
231.1ShubertfBOOT?=		${DESTDIR}/usr/mdec/boot
241.1ShubertfBOOTXX_CD9660?=	${DESTDIR}/usr/mdec/bootxx_cd9660
251.1ShubertfCDRELEASE?=	false
261.1ShubertfCDROMS_RELEASEDIR?=	installation/cdrom
271.1Shubertf
281.1Shubertf# Stuff that should come from elsewhere - XXX where? - HF
291.1ShubertfCP?=		cp
301.1ShubertfRM?=		rm
311.1ShubertfMKDIR?=		mkdir -p
321.1ShubertfCHMOD?=		chmod
331.1Shubertf
341.1Shubertf
351.1ShubertfCLEANFILES+=	${CDBASE}.iso
361.1ShubertfCLEANFILES+=	bootxx
371.1Shubertf
381.1Shubertf
391.1Shubertf# for PRINTOBJDIR
401.1Shubertf.include <bsd.own.mk>
411.1Shubertf
421.1Shubertf.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
431.1Shubertf
441.1Shubertf_INSTKERELNOBJDIR!=	cd ${.CURDIR}/../../instkernel && ${PRINTOBJDIR}
451.1Shubertf
461.1Shubertf
471.2Sosterdependall all: prepare .WAIT copy-releasedir .WAIT image
481.1Shubertf
491.1Shubertfprepare:
501.1Shubertf	${MKDIR} cdrom
511.1Shubertf	${CP} ${_INSTKERELNOBJDIR}/${CDKERNEL} cdrom/netbsd
521.1Shubertf	${RM} -f cdrom/boot
531.1Shubertf	${CP} ${DESTDIR}/usr/mdec/boot cdrom/boot
541.1Shubertf	${RM} -f bootxx
551.1Shubertf	${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx
561.1Shubertf	${CHMOD} +w bootxx
571.6Sdsl	${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx
581.1Shubertf
591.1Shubertf# Copy $RELEASEDIR/${MACHINE} in the CDROM dir
601.1Shubertf#
611.1Shubertf# XXX This could be done a lot easier if makefs(8) could
621.1Shubertf# XXX include more than one directory on the image - HF
631.1Shubertf#
641.1Shubertfcopy-releasedir:
651.1Shubertf	if ${CDRELEASE} ; then 						\
661.1Shubertf		if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then 		\
671.1Shubertf			echo "No releasedir ${RELEASEDIR}/${MACHINE}, aborting" ; \
681.1Shubertf			exit 1 ; 					\
691.1Shubertf		fi ; 							\
701.1Shubertf		${MKDIR} cdrom/${MACHINE} ; 				\
711.1Shubertf		release_destdir=`pwd`/cdrom/${MACHINE} ; 		\
721.1Shubertf		cd ${RELEASEDIR}/${MACHINE} ; 				\
731.1Shubertf		echo Copying `pwd` to $$release_destdir ... ; 		\
741.3Sjmmv		${TOOL_PAX} -rw -pe -v . $$release_destdir ; 		\
751.1Shubertf	fi
761.1Shubertf
771.1Shubertfimage:
781.1Shubertf	${TOOL_MAKEFS} -t cd9660 \
791.4Shubertf		-o 'rockridge,bootimage=i386;bootxx,no-emul-boot' \
801.1Shubertf		${CDBASE}.iso cdrom
811.1Shubertf
821.1Shubertfrelease:
831.5Shubertf	${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${MACHINE}/${CDROMS_RELEASEDIR}
841.1Shubertf
851.1Shubertfclean:
861.1Shubertf	${RM} -fr cdrom
871.1Shubertf
881.1Shubertf.include <bsd.prog.mk>
89