Makefile.bootcd revision 1.7
1#	$NetBSD: Makefile.bootcd,v 1.7 2007/01/17 00:47:40 hubertf Exp $
2#
3# Makefile snipped to create a CD/DVD ISO
4#
5
6# XXX TODO:
7# 1) merge with src/distrib/cdrom
8# 2) teach makefs to add data from more than 1 directory (see below)
9
10#
11# Required variables:
12#	CDBASE		Basename of the iso
13#	CDKERNEL	Kernel to copy from ../instkernel (or it's obj dir)
14#
15# Optional variables:
16#	CDRELEASE	Set to 'true' to include $RELEASEDIR/$MACHINE on the CD
17#	CDRELEASE_NOISOS Excludes installation/cdrom directory if set
18#	BOOT		Defaults to $DESTDIR/usr/mdec/boot
19#	BOOTXX_CD9660	Defaults to $DESTDIR/usr/mdec/bootxx_cd9660
20#	CDBOOTOPTIONS	Options for installboot, eg -o console=com0,speed=9600
21#	CDROMS_RELEASEDIR Where to install ${CDBASE}.iso
22#
23
24BOOT?=		${DESTDIR}/usr/mdec/boot
25BOOTXX_CD9660?=	${DESTDIR}/usr/mdec/bootxx_cd9660
26CDRELEASE?=	false
27CDROMS_RELEASEDIR?=	installation/cdrom
28.if defined(CDRELEASE_NOISOS)
29CDRELEASE_EXCLUDE=	-s ',./installation/cdrom.*,,gp'
30.endif
31
32# Stuff that should come from elsewhere - XXX where? - HF
33CP?=		cp
34RM?=		rm
35MKDIR?=		mkdir -p
36CHMOD?=		chmod
37
38
39CLEANFILES+=	${CDBASE}.iso
40CLEANFILES+=	bootxx
41
42
43# for PRINTOBJDIR
44.include <bsd.own.mk>
45
46.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
47
48_INSTKERELNOBJDIR!=	cd ${.CURDIR}/../../instkernel && ${PRINTOBJDIR}
49
50
51dependall all: prepare .WAIT copy-releasedir .WAIT image
52
53prepare:
54	${MKDIR} cdrom
55	${CP} ${_INSTKERELNOBJDIR}/${CDKERNEL} cdrom/netbsd
56	${RM} -f cdrom/boot
57	${CP} ${DESTDIR}/usr/mdec/boot cdrom/boot
58	${RM} -f bootxx
59	${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx
60	${CHMOD} +w bootxx
61	${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx
62
63# Copy $RELEASEDIR/${MACHINE} in the CDROM dir
64#
65# XXX This could be done a lot easier if makefs(8) could
66# XXX include more than one directory on the image - HF
67#
68copy-releasedir:
69	if ${CDRELEASE} ; then 						\
70		if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then 		\
71			echo "No releasedir ${RELEASEDIR}/${MACHINE}, aborting" ; \
72			exit 1 ; 					\
73		fi ; 							\
74		${MKDIR} cdrom/${MACHINE} ; 				\
75		release_destdir=`pwd`/cdrom/${MACHINE} ; 		\
76		cd ${RELEASEDIR}/${MACHINE} ; 				\
77		echo Copying `pwd` to $$release_destdir ... ; 		\
78		${TOOL_PAX} 						\
79			-rw -pe -v 					\
80			${CDRELEASE_EXCLUDE}				\
81			. $$release_destdir ; 				\
82	fi
83
84image:
85	${TOOL_MAKEFS} -t cd9660 \
86		-o 'rockridge,bootimage=i386;bootxx,no-emul-boot' \
87		${CDBASE}.iso cdrom
88
89release:
90	${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${MACHINE}/${CDROMS_RELEASEDIR}
91
92clean:
93	${RM} -fr cdrom
94
95.include <bsd.prog.mk>
96