Makefile.bootcd revision 1.10
11.10Sjnemeth# $NetBSD: Makefile.bootcd,v 1.10 2007/08/30 04:27:04 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.1Shubertf# BOOT Defaults to $DESTDIR/usr/mdec/boot 191.1Shubertf# BOOTXX_CD9660 Defaults to $DESTDIR/usr/mdec/bootxx_cd9660 201.1Shubertf# CDBOOTOPTIONS Options for installboot, eg -o console=com0,speed=9600 211.8Sbouyer# CDMAKEFSOPTIONS Options for makefs, eg bootimage=i386;bootxx,no-emul-boot 221.1Shubertf# CDROMS_RELEASEDIR Where to install ${CDBASE}.iso 231.8Sbouyer# CDINSTKERNEL instkernel directory (relative to ${.CURDIR}) 241.8Sbouyer# CDKERNELS couples of the form: 251.8Sbouyer# source name_on_cd 261.8Sbouyer# source kernels are copied from ${CDINSTKENRNEL} (or it's obj dir) 271.8Sbouyer# note that as of yet, bootxx_cd9660 can't load kernel names of more than 281.8Sbouyer# 8 chars. 291.1Shubertf# 301.1Shubertf 311.1ShubertfBOOT?= ${DESTDIR}/usr/mdec/boot 321.1ShubertfBOOTXX_CD9660?= ${DESTDIR}/usr/mdec/bootxx_cd9660 331.1ShubertfCDRELEASE?= false 341.9SchristosCDSOURCE?= false 351.8Sbouyer.if ${CDRELEASE} == false 361.8SbouyerCDROMS_RELEASEDIR?= ${MACHINE}/installation/cdrom 371.8Sbouyer.else 381.8SbouyerCDROMS_RELEASEDIR?= iso 391.8Sbouyer.endif 401.7Shubertf.if defined(CDRELEASE_NOISOS) 411.7ShubertfCDRELEASE_EXCLUDE= -s ',./installation/cdrom.*,,gp' 421.7Shubertf.endif 431.1Shubertf 441.8Sbouyer.include <bsd.sys.mk> # for HOST_SH 451.8Sbouyer.include <bsd.own.mk> # For PRINTOBJDIR 461.8Sbouyer.include <bsd.kernobj.mk> # For KERNSRCDIR 471.8Sbouyer 481.8SbouyerDISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s 491.8SbouyerISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z 501.8SbouyerPUBLISHER?= The_NetBSD_Project 511.8Sbouyer.if defined(CDMAKEFSOPTIONS) 521.8Sbouyer_CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER},${CDMAKEFSOPTIONS} 531.8Sbouyer.else 541.8Sbouyer_CDMAKEFSOPTIONS= rockridge,label=${ISO_VOLID},publisher=${PUBLISHER} 551.8Sbouyer.endif 561.8Sbouyer 571.1Shubertf# Stuff that should come from elsewhere - XXX where? - HF 581.1ShubertfCP?= cp 591.1ShubertfRM?= rm 601.1ShubertfMKDIR?= mkdir -p 611.1ShubertfCHMOD?= chmod 621.1Shubertf 631.1Shubertf 641.1ShubertfCLEANFILES+= ${CDBASE}.iso 651.8SbouyerCLEANFILES+= bootxx.${MACHINE} 661.1Shubertf 671.1Shubertf 681.1Shubertf.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" 691.1Shubertf 701.8Sbouyer.if defined(CDINSTKERNEL) 711.8Sbouyer_INSTKERNELNOBJDIR!= cd ${.CURDIR}/${CDINSTKERNEL} && ${PRINTOBJDIR} 721.8Sbouyer.endif 731.8Sbouyer.if exists(${DESTDIR}/usr/mdec/bootxx_cd9660) 741.8Sbouyer.if exists(${DESTDIR}/usr/mdec/boot.${MACHINE}) 751.8SbouyerBOOT2=boot.${MACHINE} 761.8Sbouyer.else 771.8SbouyerBOOT2=boot 781.8Sbouyer.endif 791.8Sbouyer.endif 801.1Shubertf 811.1Shubertfprepare: 821.1Shubertf ${MKDIR} cdrom 831.8Sbouyer.if defined(CDKERNELS) 841.8Sbouyer.for kernel target in ${CDKERNELS} 851.8Sbouyer ${CP} ${_INSTKERNELNOBJDIR}/${kernel} cdrom/${target} 861.8Sbouyer.endfor 871.8Sbouyer.if exists(${DESTDIR}/usr/mdec/bootxx_cd9660) 881.8Sbouyer ${RM} -f cdrom/${BOOT2} 891.8Sbouyer ${CP} ${DESTDIR}/usr/mdec/${BOOT2} cdrom/${BOOT2} 901.8Sbouyer ${RM} -f bootxx.${MACHINE} 911.8Sbouyer ${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx.${MACHINE} 921.8Sbouyer ${CHMOD} +w bootxx.${MACHINE} 931.8Sbouyer.if defined(CDBOOTOPTIONS) 941.8Sbouyer ${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx.${MACHINE} 951.8Sbouyer.endif 961.8Sbouyer.endif 971.8Sbouyer.endif 981.1Shubertf 991.1Shubertf# Copy $RELEASEDIR/${MACHINE} in the CDROM dir 1001.1Shubertf# 1011.1Shubertf# XXX This could be done a lot easier if makefs(8) could 1021.1Shubertf# XXX include more than one directory on the image - HF 1031.1Shubertf# 1041.1Shubertfcopy-releasedir: 1051.8Sbouyer ${RM} -f ${RELEASEDIR}/${CDROMS_RELEASEDIR}/${CDBASE}.iso 1061.9Schristos if ${CDRELEASE}; then \ 1071.1Shubertf if [ ! -d ${RELEASEDIR}/${MACHINE} ]; then \ 1081.9Schristos echo "Missing ${RELEASEDIR}/${MACHINE}, aborting"; \ 1091.9Schristos exit 1; \ 1101.9Schristos fi; \ 1111.9Schristos ${MKDIR} cdrom/${MACHINE}; \ 1121.10Sjnemeth curdir=$$(pwd); \ 1131.9Schristos release_destdir=$$(pwd)/cdrom/${MACHINE}; \ 1141.9Schristos cd ${RELEASEDIR}/${MACHINE}; \ 1151.9Schristos echo Copying $$(pwd) to $$release_destdir ...; \ 1161.7Shubertf ${TOOL_PAX} \ 1171.7Shubertf -rw -pe -v \ 1181.7Shubertf ${CDRELEASE_EXCLUDE} \ 1191.9Schristos . $$release_destdir; \ 1201.10Sjnemeth cd $$curdir; \ 1211.9Schristos fi 1221.9Schristos if ${CDSOURCE}; then \ 1231.9Schristos if [ ! -d ${RELEASEDIR}/source ]; then \ 1241.9Schristos echo "Missing ${RELEASEDIR}/source, aborting"; \ 1251.9Schristos exit 1; \ 1261.9Schristos fi; \ 1271.9Schristos ${MKDIR} cdrom/source; \ 1281.10Sjnemeth curdir=$$(pwd); \ 1291.9Schristos release_destdir=$$(pwd)/cdrom/source; \ 1301.9Schristos cd ${RELEASEDIR}/source; \ 1311.9Schristos echo Copying $$(pwd) to $$release_destdir ...; \ 1321.9Schristos ${TOOL_PAX} \ 1331.9Schristos -rw -pe -v \ 1341.9Schristos . $$release_destdir; \ 1351.10Sjnemeth cd $$curdir; \ 1361.1Shubertf fi 1371.1Shubertf 1381.1Shubertfimage: 1391.8Sbouyer ${TOOL_MAKEFS} -t cd9660 -o ${_CDMAKEFSOPTIONS:Q} ${CDBASE}.iso cdrom 1401.8Sbouyer 1411.8Sbouyer.if ${CDRELEASE} == false 1421.8Sbouyerrelease: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image .WAIT image_md_post 1431.8Sbouyer ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1441.8Sbouyer ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1451.1Shubertf 1461.8Sbouyeriso_image: 1471.8Sbouyer.else 1481.1Shubertfrelease: 1491.8Sbouyer 1501.8Sbouyeriso_image: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image .WAIT image_md_post 1511.8Sbouyer ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1521.8Sbouyer ${RELEASE_INSTALL} ${CDBASE}.iso ${RELEASEDIR}/${CDROMS_RELEASEDIR} 1531.8Sbouyer.endif 1541.1Shubertf 1551.1Shubertfclean: 1561.1Shubertf ${RM} -fr cdrom 1571.1Shubertf 1581.8Sbouyerprepare_md_post: .PHONY 1591.8Sbouyerimage_md_post: .PHONY 1601.8Sbouyer 1611.8Sbouyer 1621.1Shubertf.include <bsd.prog.mk> 163