Makefile.bootcd revision 1.12
11.12Ssborrill# $NetBSD: Makefile.bootcd,v 1.12 2007/11/20 16:12:50 sborrill Exp $ 21.1Shubertf# 31.1Shubertf# Makefile snipped to create a CD/DVD ISO 41.1Shubertf# 51.1Shubertf 61.1Shubertf# XXX TODO: 71.1Shubertf# 1) merge with src/distrib/cdrom 81.1Shubertf# 2) teach makefs to add data from more than 1 directory (see below) 91.1Shubertf 101.1Shubertf# 111.1Shubertf# Required variables: 121.1Shubertf# CDBASE Basename of the iso 131.1Shubertf# 141.1Shubertf# Optional variables: 151.1Shubertf# CDRELEASE Set to 'true' to include $RELEASEDIR/$MACHINE on the CD 161.7Shubertf# CDRELEASE_NOISOS Excludes installation/cdrom directory if set 171.9Schristos# CDSOURCE Set to 'true' to include $RELEASEDIR/source on the CD 181.11Sjnemeth# CDEXTRA Set to a directory containing extra stuff to put on CD 191.1Shubertf# BOOT Defaults to $DESTDIR/usr/mdec/boot 201.1Shubertf# BOOTXX_CD9660 Defaults to $DESTDIR/usr/mdec/bootxx_cd9660 211.1Shubertf# CDBOOTOPTIONS Options for installboot, eg -o console=com0,speed=9600 221.8Sbouyer# CDMAKEFSOPTIONS Options for makefs, eg bootimage=i386;bootxx,no-emul-boot 231.1Shubertf# CDROMS_RELEASEDIR Where to install ${CDBASE}.iso 241.8Sbouyer# CDINSTKERNEL instkernel directory (relative to ${.CURDIR}) 251.8Sbouyer# CDKERNELS couples of the form: 261.8Sbouyer# source name_on_cd 271.12Ssborrill# source kernels are copied from ${CDINSTKERNEL} (or its obj dir) 281.12Ssborrill# note that as of yet, bootxx_cd9660 can't load kernel names of more than 291.12Ssborrill# 8 chars (though they can be in a sub-directory meaning the pathname is 301.12Ssborrill# longer than 8 chars) 311.1Shubertf# 321.1Shubertf 331.1ShubertfBOOT?= ${DESTDIR}/usr/mdec/boot 341.1ShubertfBOOTXX_CD9660?= ${DESTDIR}/usr/mdec/bootxx_cd9660 351.1ShubertfCDRELEASE?= false 361.9SchristosCDSOURCE?= false 371.8Sbouyer.if ${CDRELEASE} == false 381.8SbouyerCDROMS_RELEASEDIR?= ${MACHINE}/installation/cdrom 391.8Sbouyer.else 401.8SbouyerCDROMS_RELEASEDIR?= iso 411.8Sbouyer.endif 421.7Shubertf.if defined(CDRELEASE_NOISOS) 431.7ShubertfCDRELEASE_EXCLUDE= -s ',./installation/cdrom.*,,gp' 441.7Shubertf.endif 451.1Shubertf 461.8Sbouyer.include <bsd.sys.mk> # for HOST_SH 471.8Sbouyer.include <bsd.own.mk> # For PRINTOBJDIR 481.8Sbouyer.include <bsd.kernobj.mk> # For KERNSRCDIR 491.8Sbouyer 501.8SbouyerDISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s 511.8SbouyerISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z 521.8SbouyerPUBLISHER?= The_NetBSD_Project 531.8Sbouyer.if defined(CDMAKEFSOPTIONS) 541.8Sbouyer_CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER},${CDMAKEFSOPTIONS} 551.8Sbouyer.else 561.8Sbouyer_CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER} 571.8Sbouyer.endif 581.8Sbouyer 591.1Shubertf# Stuff that should come from elsewhere - XXX where? - HF 601.1ShubertfCP?= cp 611.1ShubertfRM?= rm 621.1ShubertfMKDIR?= mkdir -p 631.1ShubertfCHMOD?= chmod 641.1Shubertf 651.1Shubertf 661.1ShubertfCLEANFILES+= ${CDBASE}.iso 671.8SbouyerCLEANFILES+= bootxx.${MACHINE} 681.1Shubertf 691.1Shubertf 701.1Shubertf.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" 711.1Shubertf 721.8Sbouyer.if defined(CDINSTKERNEL) 731.8Sbouyer_INSTKERNELNOBJDIR!= cd ${.CURDIR}/${CDINSTKERNEL} && ${PRINTOBJDIR} 741.8Sbouyer.endif 751.8Sbouyer.if exists(${DESTDIR}/usr/mdec/bootxx_cd9660) 761.8Sbouyer.if exists(${DESTDIR}/usr/mdec/boot.${MACHINE}) 771.8SbouyerBOOT2=boot.${MACHINE} 781.8Sbouyer.else 791.8SbouyerBOOT2=boot 801.8Sbouyer.endif 811.8Sbouyer.endif 821.1Shubertf 831.1Shubertfprepare: 841.1Shubertf ${MKDIR} cdrom 851.8Sbouyer.if defined(CDKERNELS) 861.8Sbouyer.for kernel target in ${CDKERNELS} 871.8Sbouyer ${CP} ${_INSTKERNELNOBJDIR}/${kernel} cdrom/${target} 881.8Sbouyer.endfor 891.8Sbouyer.if exists(${DESTDIR}/usr/mdec/bootxx_cd9660) 901.8Sbouyer ${RM} -f cdrom/${BOOT2} 911.8Sbouyer ${CP} ${DESTDIR}/usr/mdec/${BOOT2} cdrom/${BOOT2} 921.8Sbouyer ${RM} -f bootxx.${MACHINE} 931.8Sbouyer ${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx.${MACHINE} 941.8Sbouyer ${CHMOD} +w bootxx.${MACHINE} 951.8Sbouyer.if defined(CDBOOTOPTIONS) 961.8Sbouyer ${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx.${MACHINE} 971.8Sbouyer.endif 981.8Sbouyer.endif 991.8Sbouyer.endif 1001.1Shubertf 1011.1Shubertf# Copy $RELEASEDIR/${MACHINE} in the CDROM dir 1021.1Shubertf# 1031.1Shubertf# XXX This could be done a lot easier if makefs(8) could 1041.1Shubertf# XXX include more than one directory on the image - HF 1051.1Shubertf# 1061.1Shubertfcopy-releasedir: 1071.8Sbouyer ${RM} -f ${RELEASEDIR}/${CDROMS_RELEASEDIR}/${CDBASE}.iso 1081.9Schristos if ${CDRELEASE}; then \ 1091.1Shubertf if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then \ 1101.9Schristos echo "Missing ${RELEASEDIR}/${MACHINE}, aborting"; \ 1111.9Schristos exit 1; \ 1121.9Schristos fi; \ 1131.9Schristos ${MKDIR} cdrom/${MACHINE}; \ 1141.10Sjnemeth curdir=$$(pwd); \ 1151.9Schristos release_destdir=$$(pwd)/cdrom/${MACHINE}; \ 1161.9Schristos cd ${RELEASEDIR}/${MACHINE}; \ 1171.9Schristos echo Copying $$(pwd) to $$release_destdir ...; \ 1181.7Shubertf ${TOOL_PAX} \ 1191.7Shubertf -rw -pe -v \ 1201.7Shubertf ${CDRELEASE_EXCLUDE} \ 1211.9Schristos . $$release_destdir; \ 1221.10Sjnemeth cd $$curdir; \ 1231.9Schristos fi 1241.9Schristos if ${CDSOURCE}; then \ 1251.9Schristos if [ ! -d ${RELEASEDIR}/source ]; then \ 1261.9Schristos echo "Missing ${RELEASEDIR}/source, aborting"; \ 1271.9Schristos exit 1; \ 1281.9Schristos fi; \ 1291.9Schristos ${MKDIR} cdrom/source; \ 1301.10Sjnemeth curdir=$$(pwd); \ 1311.9Schristos release_destdir=$$(pwd)/cdrom/source; \ 1321.9Schristos cd ${RELEASEDIR}/source; \ 1331.9Schristos echo Copying $$(pwd) to $$release_destdir ...; \ 1341.9Schristos ${TOOL_PAX} \ 1351.9Schristos -rw -pe -v \ 1361.9Schristos . $$release_destdir; \ 1371.10Sjnemeth cd $$curdir; \ 1381.1Shubertf fi 1391.11Sjnemeth if [ "X${CDEXTRA}" != "X" ]; then \ 1401.11Sjnemeth if [ ! -d ${CDEXTRA} ]; then \ 1411.11Sjnemeth echo "Missing ${CDEXTRA}, aborting"; \ 1421.11Sjnemeth exit 1; \ 1431.11Sjnemeth fi; \ 1441.11Sjnemeth curdir=$$(pwd); \ 1451.11Sjnemeth release_destdir=$$(pwd)/cdrom; \ 1461.11Sjnemeth cd ${CDEXTRA}; \ 1471.11Sjnemeth echo Copying $$(pwd) to $$release_destdir ...; \ 1481.11Sjnemeth ${TOOL_PAX} \ 1491.11Sjnemeth -rw -pe -v \ 1501.11Sjnemeth . $$release_destdir; \ 1511.11Sjnemeth cd $$curdir; \ 1521.11Sjnemeth fi 1531.1Shubertf 1541.1Shubertfimage: 1551.8Sbouyer ${TOOL_MAKEFS} -t cd9660 -o ${_CDMAKEFSOPTIONS:Q} ${CDBASE}.iso cdrom 1561.8Sbouyer 1571.8Sbouyer.if ${CDRELEASE} == false 1581.8Sbouyerrelease: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image .WAIT image_md_post 1591.8Sbouyer ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1601.8Sbouyer ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1611.1Shubertf 1621.8Sbouyeriso_image: 1631.8Sbouyer.else 1641.1Shubertfrelease: 1651.8Sbouyer 1661.8Sbouyeriso_image: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image .WAIT image_md_post 1671.8Sbouyer ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1681.8Sbouyer ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1691.8Sbouyer.endif 1701.1Shubertf 1711.1Shubertfclean: 1721.1Shubertf ${RM} -fr cdrom 1731.1Shubertf 1741.8Sbouyerprepare_md_post: .PHONY 1751.8Sbouyerimage_md_post: .PHONY 1761.8Sbouyer 1771.8Sbouyer 1781.1Shubertf.include <bsd.prog.mk> 179