Makefile.bootcd revision 1.4
1#	$NetBSD: Makefile.bootcd,v 1.4 2006/11/01 16:47:17 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#	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
28CDINSTALLBOOT=	"${TOOL_INSTALLBOOT} ${CDBOOTOPTIONS} -m${MACHINE} @IMAGE@ ${MDEC}/bootxx_cd9660"
29
30# Stuff that should come from elsewhere - XXX where? - HF
31CP?=		cp
32RM?=		rm
33MKDIR?=		mkdir -p
34CHMOD?=		chmod
35
36
37CLEANFILES+=	${CDBASE}.iso
38CLEANFILES+=	bootxx
39
40
41# for PRINTOBJDIR
42.include <bsd.own.mk>
43
44.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
45
46_INSTKERELNOBJDIR!=	cd ${.CURDIR}/../../instkernel && ${PRINTOBJDIR}
47
48
49dependall all: prepare .WAIT copy-releasedir .WAIT image
50
51prepare:
52	${MKDIR} cdrom
53	${CP} ${_INSTKERELNOBJDIR}/${CDKERNEL} cdrom/netbsd
54	${RM} -f cdrom/boot
55	${CP} ${DESTDIR}/usr/mdec/boot cdrom/boot
56	${RM} -f bootxx
57	${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx
58	${CHMOD} +w bootxx
59	${TOOL_INSTALLBOOT} \
60		-t raw ${CDBOOTOPTIONS} -m${MACHINE} \
61		bootxx ${DESTDIR}/usr/mdec/bootxx_cd9660
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} -rw -pe -v . $$release_destdir ; 		\
79	fi
80
81image:
82	${TOOL_MAKEFS} -t cd9660 \
83		-o 'rockridge,bootimage=i386;bootxx,no-emul-boot' \
84		${CDBASE}.iso cdrom
85
86release:
87	${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${MACHINE}/installation/cdrom
88
89clean:
90	${RM} -fr cdrom
91
92.include <bsd.prog.mk>
93