summaryrefslogtreecommitdiff
path: root/distrib/common/Makefile.bootcd
blob: bd2935a358a8d067aa07eaa54647b0aba8e29482 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#	$NetBSD: Makefile.bootcd,v 1.2 2006/08/02 21:37:41 oster Exp $
#
# Makefile snipped to create a CD/DVD ISO
#

# XXX TODO:
# 1) merge with src/distrib/cdrom
# 2) teach makefs to add data from more than 1 directory (see below)

#
# Required variables:
#	CDBASE		Basename of the iso
#	CDKERNEL	Kernel to copy from ../instkernel (or it's obj dir)
#
# Optional variables:
#	CDRELEASE	Set to 'true' to include $RELEASEDIR/$MACHINE on the CD
#	BOOT		Defaults to $DESTDIR/usr/mdec/boot
#	BOOTXX_CD9660	Defaults to $DESTDIR/usr/mdec/bootxx_cd9660
#	CDBOOTOPTIONS	Options for installboot, eg -o console=com0,speed=9600
#	CDROMS_RELEASEDIR Where to install ${CDBASE}.iso
#

BOOT?=		${DESTDIR}/usr/mdec/boot
BOOTXX_CD9660?=	${DESTDIR}/usr/mdec/bootxx_cd9660
CDRELEASE?=	false
CDROMS_RELEASEDIR?=	installation/cdrom

CDINSTALLBOOT=	"${TOOL_INSTALLBOOT} ${CDBOOTOPTIONS} -m${MACHINE} @IMAGE@ ${MDEC}/bootxx_cd9660"

# Stuff that should come from elsewhere - XXX where? - HF
CP?=		cp
RM?=		rm
MKDIR?=		mkdir -p
CHMOD?=		chmod


CLEANFILES+=	${CDBASE}.iso
CLEANFILES+=	bootxx


# for PRINTOBJDIR
.include <bsd.own.mk>

.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"

_INSTKERELNOBJDIR!=	cd ${.CURDIR}/../../instkernel && ${PRINTOBJDIR}


dependall all: prepare .WAIT copy-releasedir .WAIT image

prepare:
	${MKDIR} cdrom
	${CP} ${_INSTKERELNOBJDIR}/${CDKERNEL} cdrom/netbsd
	${RM} -f cdrom/boot
	${CP} ${DESTDIR}/usr/mdec/boot cdrom/boot
	${RM} -f bootxx
	${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx
	${CHMOD} +w bootxx
	${TOOL_INSTALLBOOT} \
		-t raw ${CDBOOTOPTIONS} -m${MACHINE} \
		bootxx ${DESTDIR}/usr/mdec/bootxx_cd9660

# Copy $RELEASEDIR/${MACHINE} in the CDROM dir
#
# XXX This could be done a lot easier if makefs(8) could
# XXX include more than one directory on the image - HF
#
copy-releasedir:
	if ${CDRELEASE} ; then 						\
		if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then 		\
			echo "No releasedir ${RELEASEDIR}/${MACHINE}, aborting" ; \
			exit 1 ; 					\
		fi ; 							\
		${MKDIR} cdrom/${MACHINE} ; 				\
		release_destdir=`pwd`/cdrom/${MACHINE} ; 		\
		cd ${RELEASEDIR}/${MACHINE} ; 				\
		echo Copying `pwd` to $$release_destdir ... ; 		\
		pax -rw -pe -v . $$release_destdir ; 			\
	fi

image:
	${TOOL_MAKEFS} -t cd9660 \
		-o 'bootimage=i386;bootxx,no-emul-boot' \
		${CDBASE}.iso cdrom

release:
	${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${MACHINE}/installation/cdrom

clean:
	${RM} -fr cdrom

.include <bsd.prog.mk>