Makefile.bootcd revision 1.11
11.11Sjnemeth# $NetBSD: Makefile.bootcd,v 1.11 2007/08/31 14:20:29 jnemeth 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.8Sbouyer# source kernels are copied from ${CDINSTKENRNEL} (or it's obj dir) 281.8Sbouyer# note that as of yet, bootxx_cd9660 can't load kernel names of more than 291.8Sbouyer# 8 chars. 301.1Shubertf# 311.1Shubertf 321.1ShubertfBOOT?= ${DESTDIR}/usr/mdec/boot 331.1ShubertfBOOTXX_CD9660?= ${DESTDIR}/usr/mdec/bootxx_cd9660 341.1ShubertfCDRELEASE?= false 351.9SchristosCDSOURCE?= false 361.8Sbouyer.if ${CDRELEASE} == false 371.8SbouyerCDROMS_RELEASEDIR?= ${MACHINE}/installation/cdrom 381.8Sbouyer.else 391.8SbouyerCDROMS_RELEASEDIR?= iso 401.8Sbouyer.endif 411.7Shubertf.if defined(CDRELEASE_NOISOS) 421.7ShubertfCDRELEASE_EXCLUDE= -s ',./installation/cdrom.*,,gp' 431.7Shubertf.endif 441.1Shubertf 451.8Sbouyer.include <bsd.sys.mk> # for HOST_SH 461.8Sbouyer.include <bsd.own.mk> # For PRINTOBJDIR 471.8Sbouyer.include <bsd.kernobj.mk> # For KERNSRCDIR 481.8Sbouyer 491.8SbouyerDISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s 501.8SbouyerISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z 511.8SbouyerPUBLISHER?= The_NetBSD_Project 521.8Sbouyer.if defined(CDMAKEFSOPTIONS) 531.8Sbouyer_CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER},${CDMAKEFSOPTIONS} 541.8Sbouyer.else 551.8Sbouyer_CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER} 561.8Sbouyer.endif 571.8Sbouyer 581.1Shubertf# Stuff that should come from elsewhere - XXX where? - HF 591.1ShubertfCP?= cp 601.1ShubertfRM?= rm 611.1ShubertfMKDIR?= mkdir -p 621.1ShubertfCHMOD?= chmod 631.1Shubertf 641.1Shubertf 651.1ShubertfCLEANFILES+= ${CDBASE}.iso 661.8SbouyerCLEANFILES+= bootxx.${MACHINE} 671.1Shubertf 681.1Shubertf 691.1Shubertf.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" 701.1Shubertf 711.8Sbouyer.if defined(CDINSTKERNEL) 721.8Sbouyer_INSTKERNELNOBJDIR!= cd ${.CURDIR}/${CDINSTKERNEL} && ${PRINTOBJDIR} 731.8Sbouyer.endif 741.8Sbouyer.if exists(${DESTDIR}/usr/mdec/bootxx_cd9660) 751.8Sbouyer.if exists(${DESTDIR}/usr/mdec/boot.${MACHINE}) 761.8SbouyerBOOT2=boot.${MACHINE} 771.8Sbouyer.else 781.8SbouyerBOOT2=boot 791.8Sbouyer.endif 801.8Sbouyer.endif 811.1Shubertf 821.1Shubertfprepare: 831.1Shubertf ${MKDIR} cdrom 841.8Sbouyer.if defined(CDKERNELS) 851.8Sbouyer.for kernel target in ${CDKERNELS} 861.8Sbouyer ${CP} ${_INSTKERNELNOBJDIR}/${kernel} cdrom/${target} 871.8Sbouyer.endfor 881.8Sbouyer.if exists(${DESTDIR}/usr/mdec/bootxx_cd9660) 891.8Sbouyer ${RM} -f cdrom/${BOOT2} 901.8Sbouyer ${CP} ${DESTDIR}/usr/mdec/${BOOT2} cdrom/${BOOT2} 911.8Sbouyer ${RM} -f bootxx.${MACHINE} 921.8Sbouyer ${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx.${MACHINE} 931.8Sbouyer ${CHMOD} +w bootxx.${MACHINE} 941.8Sbouyer.if defined(CDBOOTOPTIONS) 951.8Sbouyer ${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx.${MACHINE} 961.8Sbouyer.endif 971.8Sbouyer.endif 981.8Sbouyer.endif 991.1Shubertf 1001.1Shubertf# Copy $RELEASEDIR/${MACHINE} in the CDROM dir 1011.1Shubertf# 1021.1Shubertf# XXX This could be done a lot easier if makefs(8) could 1031.1Shubertf# XXX include more than one directory on the image - HF 1041.1Shubertf# 1051.1Shubertfcopy-releasedir: 1061.8Sbouyer ${RM} -f ${RELEASEDIR}/${CDROMS_RELEASEDIR}/${CDBASE}.iso 1071.9Schristos if ${CDRELEASE}; then \ 1081.1Shubertf if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then \ 1091.9Schristos echo "Missing ${RELEASEDIR}/${MACHINE}, aborting"; \ 1101.9Schristos exit 1; \ 1111.9Schristos fi; \ 1121.9Schristos ${MKDIR} cdrom/${MACHINE}; \ 1131.10Sjnemeth curdir=$$(pwd); \ 1141.9Schristos release_destdir=$$(pwd)/cdrom/${MACHINE}; \ 1151.9Schristos cd ${RELEASEDIR}/${MACHINE}; \ 1161.9Schristos echo Copying $$(pwd) to $$release_destdir ...; \ 1171.7Shubertf ${TOOL_PAX} \ 1181.7Shubertf -rw -pe -v \ 1191.7Shubertf ${CDRELEASE_EXCLUDE} \ 1201.9Schristos . $$release_destdir; \ 1211.10Sjnemeth cd $$curdir; \ 1221.9Schristos fi 1231.9Schristos if ${CDSOURCE}; then \ 1241.9Schristos if [ ! -d ${RELEASEDIR}/source ]; then \ 1251.9Schristos echo "Missing ${RELEASEDIR}/source, aborting"; \ 1261.9Schristos exit 1; \ 1271.9Schristos fi; \ 1281.9Schristos ${MKDIR} cdrom/source; \ 1291.10Sjnemeth curdir=$$(pwd); \ 1301.9Schristos release_destdir=$$(pwd)/cdrom/source; \ 1311.9Schristos cd ${RELEASEDIR}/source; \ 1321.9Schristos echo Copying $$(pwd) to $$release_destdir ...; \ 1331.9Schristos ${TOOL_PAX} \ 1341.9Schristos -rw -pe -v \ 1351.9Schristos . $$release_destdir; \ 1361.10Sjnemeth cd $$curdir; \ 1371.1Shubertf fi 1381.11Sjnemeth if [ "X${CDEXTRA}" != "X" ]; then \ 1391.11Sjnemeth if [ ! -d ${CDEXTRA} ]; then \ 1401.11Sjnemeth echo "Missing ${CDEXTRA}, aborting"; \ 1411.11Sjnemeth exit 1; \ 1421.11Sjnemeth fi; \ 1431.11Sjnemeth curdir=$$(pwd); \ 1441.11Sjnemeth release_destdir=$$(pwd)/cdrom; \ 1451.11Sjnemeth cd ${CDEXTRA}; \ 1461.11Sjnemeth echo Copying $$(pwd) to $$release_destdir ...; \ 1471.11Sjnemeth ${TOOL_PAX} \ 1481.11Sjnemeth -rw -pe -v \ 1491.11Sjnemeth . $$release_destdir; \ 1501.11Sjnemeth cd $$curdir; \ 1511.11Sjnemeth fi 1521.1Shubertf 1531.1Shubertfimage: 1541.8Sbouyer ${TOOL_MAKEFS} -t cd9660 -o ${_CDMAKEFSOPTIONS:Q} ${CDBASE}.iso cdrom 1551.8Sbouyer 1561.8Sbouyer.if ${CDRELEASE} == false 1571.8Sbouyerrelease: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image .WAIT image_md_post 1581.8Sbouyer ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1591.8Sbouyer ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1601.1Shubertf 1611.8Sbouyeriso_image: 1621.8Sbouyer.else 1631.1Shubertfrelease: 1641.8Sbouyer 1651.8Sbouyeriso_image: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image .WAIT image_md_post 1661.8Sbouyer ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1671.8Sbouyer ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1681.8Sbouyer.endif 1691.1Shubertf 1701.1Shubertfclean: 1711.1Shubertf ${RM} -fr cdrom 1721.1Shubertf 1731.8Sbouyerprepare_md_post: .PHONY 1741.8Sbouyerimage_md_post: .PHONY 1751.8Sbouyer 1761.8Sbouyer 1771.1Shubertf.include <bsd.prog.mk> 178