Makefile.bootcd revision 1.6
1#	$NetBSD: Makefile.bootcd,v 1.6 2007/01/07 18:34:48 dsl 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#	BOOT		Defaults to $DESTDIR/usr/mdec/boot
18#	BOOTXX_CD9660	Defaults to $DESTDIR/usr/mdec/bootxx_cd9660
19#	CDBOOTOPTIONS	Options for installboot, eg -o console=com0,speed=9600
20#	CDROMS_RELEASEDIR Where to install ${CDBASE}.iso
21#
22
23BOOT?=		${DESTDIR}/usr/mdec/boot
24BOOTXX_CD9660?=	${DESTDIR}/usr/mdec/bootxx_cd9660
25CDRELEASE?=	false
26CDROMS_RELEASEDIR?=	installation/cdrom
27
28# Stuff that should come from elsewhere - XXX where? - HF
29CP?=		cp
30RM?=		rm
31MKDIR?=		mkdir -p
32CHMOD?=		chmod
33
34
35CLEANFILES+=	${CDBASE}.iso
36CLEANFILES+=	bootxx
37
38
39# for PRINTOBJDIR
40.include <bsd.own.mk>
41
42.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
43
44_INSTKERELNOBJDIR!=	cd ${.CURDIR}/../../instkernel && ${PRINTOBJDIR}
45
46
47dependall all: prepare .WAIT copy-releasedir .WAIT image
48
49prepare:
50	${MKDIR} cdrom
51	${CP} ${_INSTKERELNOBJDIR}/${CDKERNEL} cdrom/netbsd
52	${RM} -f cdrom/boot
53	${CP} ${DESTDIR}/usr/mdec/boot cdrom/boot
54	${RM} -f bootxx
55	${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx
56	${CHMOD} +w bootxx
57	${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx
58
59# Copy $RELEASEDIR/${MACHINE} in the CDROM dir
60#
61# XXX This could be done a lot easier if makefs(8) could
62# XXX include more than one directory on the image - HF
63#
64copy-releasedir:
65	if ${CDRELEASE} ; then 						\
66		if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then 		\
67			echo "No releasedir ${RELEASEDIR}/${MACHINE}, aborting" ; \
68			exit 1 ; 					\
69		fi ; 							\
70		${MKDIR} cdrom/${MACHINE} ; 				\
71		release_destdir=`pwd`/cdrom/${MACHINE} ; 		\
72		cd ${RELEASEDIR}/${MACHINE} ; 				\
73		echo Copying `pwd` to $$release_destdir ... ; 		\
74		${TOOL_PAX} -rw -pe -v . $$release_destdir ; 		\
75	fi
76
77image:
78	${TOOL_MAKEFS} -t cd9660 \
79		-o 'rockridge,bootimage=i386;bootxx,no-emul-boot' \
80		${CDBASE}.iso cdrom
81
82release:
83	${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${MACHINE}/${CDROMS_RELEASEDIR}
84
85clean:
86	${RM} -fr cdrom
87
88.include <bsd.prog.mk>
89