Makefile.bootcd revision 1.10
1# $NetBSD: Makefile.bootcd,v 1.10 2007/08/30 04:27:04 jnemeth 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# 14# Optional variables: 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# 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# CDMAKEFSOPTIONS Options for makefs, eg bootimage=i386;bootxx,no-emul-boot 22# CDROMS_RELEASEDIR Where to install ${CDBASE}.iso 23# CDINSTKERNEL instkernel directory (relative to ${.CURDIR}) 24# CDKERNELS couples of the form: 25# source name_on_cd 26# source kernels are copied from ${CDINSTKENRNEL} (or it's obj dir) 27# note that as of yet, bootxx_cd9660 can't load kernel names of more than 28# 8 chars. 29# 30 31BOOT?= ${DESTDIR}/usr/mdec/boot 32BOOTXX_CD9660?= ${DESTDIR}/usr/mdec/bootxx_cd9660 33CDRELEASE?= false 34CDSOURCE?= false 35.if ${CDRELEASE} == false 36CDROMS_RELEASEDIR?= ${MACHINE}/installation/cdrom 37.else 38CDROMS_RELEASEDIR?= iso 39.endif 40.if defined(CDRELEASE_NOISOS) 41CDRELEASE_EXCLUDE= -s ',./installation/cdrom.*,,gp' 42.endif 43 44.include <bsd.sys.mk> # for HOST_SH 45.include <bsd.own.mk> # For PRINTOBJDIR 46.include <bsd.kernobj.mk> # For KERNSRCDIR 47 48DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s 49ISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z 50PUBLISHER?= The_NetBSD_Project 51.if defined(CDMAKEFSOPTIONS) 52_CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER},${CDMAKEFSOPTIONS} 53.else 54_CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER} 55.endif 56 57# Stuff that should come from elsewhere - XXX where? - HF 58CP?= cp 59RM?= rm 60MKDIR?= mkdir -p 61CHMOD?= chmod 62 63 64CLEANFILES+= ${CDBASE}.iso 65CLEANFILES+= bootxx.${MACHINE} 66 67 68.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" 69 70.if defined(CDINSTKERNEL) 71_INSTKERNELNOBJDIR!= cd ${.CURDIR}/${CDINSTKERNEL} && ${PRINTOBJDIR} 72.endif 73.if exists(${DESTDIR}/usr/mdec/bootxx_cd9660) 74.if exists(${DESTDIR}/usr/mdec/boot.${MACHINE}) 75BOOT2=boot.${MACHINE} 76.else 77BOOT2=boot 78.endif 79.endif 80 81prepare: 82 ${MKDIR} cdrom 83.if defined(CDKERNELS) 84.for kernel target in ${CDKERNELS} 85 ${CP} ${_INSTKERNELNOBJDIR}/${kernel} cdrom/${target} 86.endfor 87.if exists(${DESTDIR}/usr/mdec/bootxx_cd9660) 88 ${RM} -f cdrom/${BOOT2} 89 ${CP} ${DESTDIR}/usr/mdec/${BOOT2} cdrom/${BOOT2} 90 ${RM} -f bootxx.${MACHINE} 91 ${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx.${MACHINE} 92 ${CHMOD} +w bootxx.${MACHINE} 93.if defined(CDBOOTOPTIONS) 94 ${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx.${MACHINE} 95.endif 96.endif 97.endif 98 99# Copy $RELEASEDIR/${MACHINE} in the CDROM dir 100# 101# XXX This could be done a lot easier if makefs(8) could 102# XXX include more than one directory on the image - HF 103# 104copy-releasedir: 105 ${RM} -f ${RELEASEDIR}/${CDROMS_RELEASEDIR}/${CDBASE}.iso 106 if ${CDRELEASE}; then \ 107 if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then \ 108 echo "Missing ${RELEASEDIR}/${MACHINE}, aborting"; \ 109 exit 1; \ 110 fi; \ 111 ${MKDIR} cdrom/${MACHINE}; \ 112 curdir=$$(pwd); \ 113 release_destdir=$$(pwd)/cdrom/${MACHINE}; \ 114 cd ${RELEASEDIR}/${MACHINE}; \ 115 echo Copying $$(pwd) to $$release_destdir ...; \ 116 ${TOOL_PAX} \ 117 -rw -pe -v \ 118 ${CDRELEASE_EXCLUDE} \ 119 . $$release_destdir; \ 120 cd $$curdir; \ 121 fi 122 if ${CDSOURCE}; then \ 123 if [ ! -d ${RELEASEDIR}/source ]; then \ 124 echo "Missing ${RELEASEDIR}/source, aborting"; \ 125 exit 1; \ 126 fi; \ 127 ${MKDIR} cdrom/source; \ 128 curdir=$$(pwd); \ 129 release_destdir=$$(pwd)/cdrom/source; \ 130 cd ${RELEASEDIR}/source; \ 131 echo Copying $$(pwd) to $$release_destdir ...; \ 132 ${TOOL_PAX} \ 133 -rw -pe -v \ 134 . $$release_destdir; \ 135 cd $$curdir; \ 136 fi 137 138image: 139 ${TOOL_MAKEFS} -t cd9660 -o ${_CDMAKEFSOPTIONS:Q} ${CDBASE}.iso cdrom 140 141.if ${CDRELEASE} == false 142release: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image .WAIT image_md_post 143 ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR} 144 ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR} 145 146iso_image: 147.else 148release: 149 150iso_image: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image .WAIT image_md_post 151 ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR} 152 ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR} 153.endif 154 155clean: 156 ${RM} -fr cdrom 157 158prepare_md_post: .PHONY 159image_md_post: .PHONY 160 161 162.include <bsd.prog.mk> 163