Makefile.bootcd revision 1.1
11.1Shubertf#	$NetBSD: Makefile.bootcd,v 1.1 2006/06/02 22:35:22 hubertf 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.1ShubertfCDINSTALLBOOT=	"${TOOL_INSTALLBOOT} ${CDBOOTOPTIONS} -m${MACHINE} @IMAGE@ ${MDEC}/bootxx_cd9660"
291.1Shubertf
301.1Shubertf# Stuff that should come from elsewhere - XXX where? - HF
311.1ShubertfCP?=		cp
321.1ShubertfRM?=		rm
331.1ShubertfMKDIR?=		mkdir -p
341.1ShubertfCHMOD?=		chmod
351.1Shubertf
361.1Shubertf
371.1ShubertfCLEANFILES+=	${CDBASE}.iso
381.1ShubertfCLEANFILES+=	bootxx
391.1Shubertf
401.1Shubertf
411.1Shubertf# for PRINTOBJDIR
421.1Shubertf.include <bsd.own.mk>
431.1Shubertf
441.1Shubertf.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
451.1Shubertf
461.1Shubertf_INSTKERELNOBJDIR!=	cd ${.CURDIR}/../../instkernel && ${PRINTOBJDIR}
471.1Shubertf
481.1Shubertf
491.1Shubertfdependall all: prepare copy-releasedir image
501.1Shubertf
511.1Shubertfprepare:
521.1Shubertf	${MKDIR} cdrom
531.1Shubertf	${CP} ${_INSTKERELNOBJDIR}/${CDKERNEL} cdrom/netbsd
541.1Shubertf	${RM} -f cdrom/boot
551.1Shubertf	${CP} ${DESTDIR}/usr/mdec/boot cdrom/boot
561.1Shubertf	${RM} -f bootxx
571.1Shubertf	${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx
581.1Shubertf	${CHMOD} +w bootxx
591.1Shubertf	${TOOL_INSTALLBOOT} \
601.1Shubertf		-t raw ${CDBOOTOPTIONS} -m${MACHINE} \
611.1Shubertf		bootxx ${DESTDIR}/usr/mdec/bootxx_cd9660
621.1Shubertf
631.1Shubertf# Copy $RELEASEDIR/${MACHINE} in the CDROM dir
641.1Shubertf#
651.1Shubertf# XXX This could be done a lot easier if makefs(8) could
661.1Shubertf# XXX include more than one directory on the image - HF
671.1Shubertf#
681.1Shubertfcopy-releasedir:
691.1Shubertf	if ${CDRELEASE} ; then 						\
701.1Shubertf		if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then 		\
711.1Shubertf			echo "No releasedir ${RELEASEDIR}/${MACHINE}, aborting" ; \
721.1Shubertf			exit 1 ; 					\
731.1Shubertf		fi ; 							\
741.1Shubertf		${MKDIR} cdrom/${MACHINE} ; 				\
751.1Shubertf		release_destdir=`pwd`/cdrom/${MACHINE} ; 		\
761.1Shubertf		cd ${RELEASEDIR}/${MACHINE} ; 				\
771.1Shubertf		echo Copying `pwd` to $$release_destdir ... ; 		\
781.1Shubertf		pax -rw -pe -v . $$release_destdir ; 			\
791.1Shubertf	fi
801.1Shubertf
811.1Shubertfimage:
821.1Shubertf	${TOOL_MAKEFS} -t cd9660 \
831.1Shubertf		-o 'bootimage=i386;bootxx,no-emul-boot' \
841.1Shubertf		${CDBASE}.iso cdrom
851.1Shubertf
861.1Shubertfrelease:
871.1Shubertf	${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${MACHINE}/installation/cdrom
881.1Shubertf
891.1Shubertfclean:
901.1Shubertf	${RM} -fr cdrom
911.1Shubertf
921.1Shubertf.include <bsd.prog.mk>
93