1 # $NetBSD: Makefile.bootcd,v 1.16 2008/12/02 10:06:00 hubertf Exp $
3 # Makefile snipped to create a CD/DVD ISO
7 # 1) merge with src/distrib/cdrom
8 # 2) teach makefs to add data from more than 1 directory (see below)
12 # CDBASE Basename of the iso
15 # CDRELEASE Set to 'true' to include $RELEASEDIR/$MACHINE on the CD
16 # CDRELEASE_NOISOS Excludes installation/cdrom directory if set
17 # CDSOURCE Set to 'true' to include $RELEASEDIR/source on the CD
18 # CDEXTRA Set to a list of files or directories containing extra
19 # stuff to put on CD (set by build.sh -C flag)
20 # CDBUILDEXTRA Set to a list of files or directories containing extra
21 # stuff to put on CD (use in Makefiles)
22 # CDEXTRA_SKIP A list of file exclusion paths to exclude when copying
23 # directories of extra stuff in CDEXTRA AND CDBUILDEXTRA
24 # BOOT Defaults to $DESTDIR/usr/mdec/boot
25 # BOOTXX_CD9660 Defaults to $DESTDIR/usr/mdec/bootxx_cd9660
26 # CDBOOTOPTIONS Options for installboot, eg -o console=com0,speed=9600
27 # CDMAKEFSOPTIONS Options for makefs, eg bootimage=i386;bootxx,no-emul-boot
28 # CDROMS_RELEASEDIR Where to install ${CDBASE}.iso
29 # CDINSTKERNEL instkernel directory (relative to ${.CURDIR})
30 # CDKERNELS couples of the form:
32 # CDRUNTIME files/directories to copy from $DESTDIR onto the CD
33 # source kernels are copied from ${CDINSTKERNEL} (or its obj dir)
34 # note that as of yet, bootxx_cd9660 can't load kernel names of more than
35 # 8 chars (though they can be in a sub-directory meaning the pathname is
36 # longer than 8 chars)
39 BOOT?= ${DESTDIR}/usr/mdec/boot
40 BOOTXX_CD9660?= ${DESTDIR}/usr/mdec/bootxx_cd9660
43 .if ${CDRELEASE} == false
44 CDROMS_RELEASEDIR?= ${MACHINE}/installation/cdrom
46 CDROMS_RELEASEDIR?= iso
48 .if defined(CDRELEASE_NOISOS)
49 CDRELEASE_EXCLUDE= -s ',./installation/cdrom.*,,gp'
52 .include <bsd.sys.mk> # for HOST_SH
53 .include <bsd.own.mk> # For PRINTOBJDIR
54 .include <bsd.kernobj.mk> # For KERNSRCDIR
56 DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s
57 ISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z
58 PUBLISHER?= The_NetBSD_Project
59 .if defined(CDMAKEFSOPTIONS)
60 _CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER},${CDMAKEFSOPTIONS}
62 _CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER}
65 # Stuff that should come from elsewhere - XXX where? - HF
73 CLEANFILES+= ${CDBASE}.iso
74 CLEANFILES+= bootxx.${MACHINE}
77 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
79 .if defined(CDINSTKERNEL)
80 _INSTKERNELNOBJDIR!= cd ${.CURDIR}/${CDINSTKERNEL} && ${PRINTOBJDIR}
82 .if exists(${DESTDIR}/usr/mdec/bootxx_cd9660)
83 .if exists(${DESTDIR}/usr/mdec/boot.${MACHINE})
92 .if defined(CDKERNELS)
93 .for kernel target in ${CDKERNELS}
94 ${CP} ${_INSTKERNELNOBJDIR}/${kernel} cdrom/${target}
96 .if exists(${DESTDIR}/usr/mdec/bootxx_cd9660)
97 ${RM} -f cdrom/${BOOT2}
98 ${CP} ${DESTDIR}/usr/mdec/${BOOT2} cdrom/${BOOT2}
99 ${RM} -f bootxx.${MACHINE}
100 ${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx.${MACHINE}
101 ${CHMOD} +w bootxx.${MACHINE}
102 .if defined(CDBOOTOPTIONS)
103 ${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx.${MACHINE}
108 # Copy $RELEASEDIR/${MACHINE} in the CDROM dir
110 # XXX This could be done a lot easier if makefs(8) could
111 # XXX include more than one directory on the image - HF
114 ${RM} -f ${RELEASEDIR}/${CDROMS_RELEASEDIR}/${CDBASE}.iso
115 if ${CDRELEASE}; then \
116 if [ ! -d ${RELEASEDIR}/${RELEASEMACHINEDIR} ]; then \
117 echo "Missing ${RELEASEDIR}/${RELEASEMACHINEDIR}, aborting"; \
120 ${MKDIR} cdrom/${MACHINE}; \
122 release_destdir=$$(pwd)/cdrom/${MACHINE}; \
123 cd ${RELEASEDIR}/${RELEASEMACHINEDIR}; \
124 echo Copying $$(pwd) to $$release_destdir ...; \
127 ${CDRELEASE_EXCLUDE} \
128 . $$release_destdir; \
131 if ${CDSOURCE}; then \
132 if [ ! -d ${RELEASEDIR}/source ]; then \
133 echo "Missing ${RELEASEDIR}/source, aborting"; \
136 ${MKDIR} cdrom/source; \
138 release_destdir=$$(pwd)/cdrom/source; \
139 cd ${RELEASEDIR}/source; \
140 echo Copying $$(pwd) to $$release_destdir ...; \
143 . $$release_destdir; \
146 if [ "X${CDRUNTIME}}" != "X" ]; then \
148 release_destdir=$${curdir}/cdrom; \
149 cd $$release_destdir; \
151 for cde in ${CDRUNTIME}; \
153 ${TOOL_PAX} -rw -pp -v $${cde} $$release_destdir;\
157 if [ "X${CDEXTRA}${CDBUILDEXTRA}" != "X" ]; then \
160 cdextra_skip="${CDEXTRA_SKIP}"; \
161 if [ "X$${cdextra_skip}" != "X" ]; then \
163 for skip in $${cdextra_skip}; \
165 echo $${skip} >> cdskip; \
167 skipflag="-X $${curdir}/cdskip"; \
169 cdextra="${CDEXTRA}"; \
170 cdbuildextra="${CDBUILDEXTRA}"; \
171 for cde in $${cdextra} $${cdbuildextra}; \
173 release_destdir=$${curdir}/cdrom; \
174 if [ -f $${cde} ]; then \
175 echo Copying $${cde} to $$release_destdir ...; \
176 ${CP} $${cde} $${release_destdir}; \
177 elif [ -d $${cde} ]; then \
179 echo Copying $$(pwd) to $$release_destdir ...; \
180 ${TOOL_MTREE} -c $${skipflag} | \
181 ${TOOL_PAX} -rw -pe -v -M \
184 echo "Missing $${cde}, aborting"; \
192 ${TOOL_MAKEFS} -t cd9660 -o ${_CDMAKEFSOPTIONS:Q} ${CDBASE}.iso cdrom
194 .if ${CDRELEASE} == false
195 release: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image_md_pre .WAIT image .WAIT image_md_post
196 ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR}
197 ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR}
203 iso_image: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image_md_pre .WAIT image .WAIT image_md_post
204 ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR}
205 ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR}
211 prepare_md_post: .PHONY
212 image_md_post: .PHONY
215 .include <bsd.prog.mk>