[BACK]Return to Makefile.bootcd CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / distrib / common

Annotation of src/distrib/common/Makefile.bootcd, Revision 1.20

1.20    ! riz         1: #      $NetBSD: Makefile.bootcd,v 1.19 2012/01/22 03:53:32 tsutsui Exp $
1.1       hubertf     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
1.7       hubertf    16: #      CDRELEASE_NOISOS Excludes installation/cdrom directory if set
1.9       christos   17: #      CDSOURCE        Set to 'true' to include $RELEASEDIR/source on the CD
1.13      sborrill   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
1.1       hubertf    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
1.8       bouyer     27: #      CDMAKEFSOPTIONS Options for makefs, eg bootimage=i386;bootxx,no-emul-boot
1.1       hubertf    28: #      CDROMS_RELEASEDIR Where to install ${CDBASE}.iso
1.8       bouyer     29: #      CDINSTKERNEL    instkernel directory (relative to ${.CURDIR})
                     30: #      CDKERNELS       couples of the form:
                     31: #                              source  name_on_cd
1.15      ad         32: #      CDRUNTIME       files/directories to copy from $DESTDIR onto the CD
1.12      sborrill   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)
1.1       hubertf    37: #
                     38:
                     39: BOOT?=         ${DESTDIR}/usr/mdec/boot
                     40: BOOTXX_CD9660?=        ${DESTDIR}/usr/mdec/bootxx_cd9660
                     41: CDRELEASE?=    false
1.9       christos   42: CDSOURCE?=     false
1.8       bouyer     43: .if ${CDRELEASE} == false
                     44: CDROMS_RELEASEDIR?=    ${MACHINE}/installation/cdrom
                     45: .else
1.20    ! riz        46: CDROMS_RELEASEDIR?=    images
1.8       bouyer     47: .endif
1.7       hubertf    48: .if defined(CDRELEASE_NOISOS)
                     49: CDRELEASE_EXCLUDE=     -s ',./installation/cdrom.*,,gp'
                     50: .endif
1.19      tsutsui    51: .if !defined(CDRELEASE_LIVEIMAGE)
                     52: CDRELEASE_EXCLUDE+=    -s ',./installation/liveimage.*,,gp'
                     53: .endif
                     54: .if !defined(CDRELEASE_INSTALLIMAGE)
                     55: CDRELEASE_EXCLUDE+=    -s ',./installation/installimage.*,,gp'
                     56: .endif
1.1       hubertf    57:
1.8       bouyer     58: .include <bsd.sys.mk>          # for HOST_SH
                     59: .include <bsd.own.mk>          # For PRINTOBJDIR
                     60: .include <bsd.kernobj.mk>      # For KERNSRCDIR
                     61:
1.18      jmcneill   62: DISTRIBVER!=   ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh
1.8       bouyer     63: DISTRIBREV!=   ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s
                     64: ISO_VOLID!=    echo NETBSD_${DISTRIBREV} | tr a-z A-Z
                     65: PUBLISHER?= The_NetBSD_Project
                     66: .if defined(CDMAKEFSOPTIONS)
                     67: _CDMAKEFSOPTIONS=      rockridge,label=${ISO_VOLID},publisher=${PUBLISHER},${CDMAKEFSOPTIONS}
                     68: .else
                     69: _CDMAKEFSOPTIONS=      rockridge,label=${ISO_VOLID},publisher=${PUBLISHER}
                     70: .endif
                     71:
1.1       hubertf    72: # Stuff that should come from elsewhere - XXX where? - HF
                     73: CP?=           cp
                     74: RM?=           rm
                     75: MKDIR?=                mkdir -p
                     76: CHMOD?=                chmod
1.17      christos   77: ECHO?=         echo
1.1       hubertf    78:
1.18      jmcneill   79: .if ${CDRELEASE} == false
                     80: CDIMAGE=       ${CDBASE}.iso
                     81: .else
                     82: CDIMAGE=       NetBSD-${DISTRIBVER}-${CDBASE:S/cd$//}.iso
                     83: .endif
1.1       hubertf    84:
1.18      jmcneill   85: CLEANFILES+=   ${CDIMAGE}
1.8       bouyer     86: CLEANFILES+=   bootxx.${MACHINE}
1.1       hubertf    87:
                     88:
                     89: .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
                     90:
1.8       bouyer     91: .if defined(CDINSTKERNEL)
                     92: _INSTKERNELNOBJDIR!=   cd ${.CURDIR}/${CDINSTKERNEL} && ${PRINTOBJDIR}
                     93: .endif
                     94: .if exists(${DESTDIR}/usr/mdec/bootxx_cd9660)
                     95: .if exists(${DESTDIR}/usr/mdec/boot.${MACHINE})
                     96: BOOT2=boot.${MACHINE}
                     97: .else
                     98: BOOT2=boot
                     99: .endif
                    100: .endif
1.1       hubertf   101:
                    102: prepare:
                    103:        ${MKDIR} cdrom
1.8       bouyer    104: .if defined(CDKERNELS)
                    105: .for kernel target in ${CDKERNELS}
                    106:        ${CP} ${_INSTKERNELNOBJDIR}/${kernel} cdrom/${target}
                    107: .endfor
                    108: .if exists(${DESTDIR}/usr/mdec/bootxx_cd9660)
                    109:        ${RM} -f cdrom/${BOOT2}
                    110:        ${CP} ${DESTDIR}/usr/mdec/${BOOT2} cdrom/${BOOT2}
                    111:        ${RM} -f bootxx.${MACHINE}
                    112:        ${CP} ${DESTDIR}/usr/mdec/bootxx_cd9660 bootxx.${MACHINE}
                    113:        ${CHMOD} +w bootxx.${MACHINE}
                    114: .if defined(CDBOOTOPTIONS)
                    115:        ${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} bootxx.${MACHINE}
                    116: .endif
                    117: .endif
                    118: .endif
1.1       hubertf   119:
                    120: # Copy $RELEASEDIR/${MACHINE} in the CDROM dir
                    121: #
                    122: # XXX This could be done a lot easier if makefs(8) could
                    123: # XXX include more than one directory on the image - HF
                    124: #
                    125: copy-releasedir:
1.18      jmcneill  126:        ${RM} -f ${RELEASEDIR}/${CDROMS_RELEASEDIR}/${CDIMAGE}
1.9       christos  127:        if ${CDRELEASE}; then                                           \
1.14      matt      128:                if [ ! -d ${RELEASEDIR}/${RELEASEMACHINEDIR} ]; then            \
                    129:                        echo "Missing ${RELEASEDIR}/${RELEASEMACHINEDIR}, aborting"; \
1.9       christos  130:                        exit 1;                                         \
                    131:                fi;                                                     \
                    132:                ${MKDIR} cdrom/${MACHINE};                              \
1.10      jnemeth   133:                curdir=$$(pwd);                                         \
1.9       christos  134:                release_destdir=$$(pwd)/cdrom/${MACHINE};               \
1.15      ad        135:                cd ${RELEASEDIR}/${RELEASEMACHINEDIR};                  \
1.9       christos  136:                echo Copying $$(pwd) to $$release_destdir ...;          \
1.7       hubertf   137:                ${TOOL_PAX}                                             \
                    138:                        -rw -pe -v                                      \
                    139:                        ${CDRELEASE_EXCLUDE}                            \
1.9       christos  140:                        . $$release_destdir;                            \
1.10      jnemeth   141:                cd $$curdir;                                            \
1.9       christos  142:        fi
                    143:        if ${CDSOURCE}; then                                            \
                    144:                if [ ! -d ${RELEASEDIR}/source ]; then                  \
                    145:                        echo "Missing ${RELEASEDIR}/source, aborting";  \
                    146:                        exit 1;                                         \
                    147:                fi;                                                     \
                    148:                ${MKDIR} cdrom/source;                                  \
1.10      jnemeth   149:                curdir=$$(pwd);                                         \
1.9       christos  150:                release_destdir=$$(pwd)/cdrom/source;                   \
                    151:                cd ${RELEASEDIR}/source;                                \
                    152:                echo Copying $$(pwd) to $$release_destdir ...;          \
                    153:                ${TOOL_PAX}                                             \
                    154:                        -rw -pe -v                                      \
                    155:                        . $$release_destdir;                            \
1.10      jnemeth   156:                cd $$curdir;                                            \
1.1       hubertf   157:        fi
1.15      ad        158:        if [ "X${CDRUNTIME}}" != "X" ]; then                            \
                    159:                curdir=$$(pwd);                                         \
                    160:                release_destdir=$${curdir}/cdrom;                       \
                    161:                cd $$release_destdir;                                   \
                    162:                cd ${DESTDIR};                                          \
                    163:                for cde in ${CDRUNTIME};                                \
                    164:                do                                                      \
                    165:                        ${TOOL_PAX} -rw -pp -v $${cde} $$release_destdir;\
                    166:                done;                                                   \
                    167:                cd $$curdir;                                            \
                    168:        fi
1.13      sborrill  169:        if [ "X${CDEXTRA}${CDBUILDEXTRA}" != "X" ]; then                \
1.16      hubertf   170:                curdir=`pwd`;                                           \
1.13      sborrill  171:                skipflag="";                                            \
1.16      hubertf   172:                cdextra_skip="${CDEXTRA_SKIP}";                         \
                    173:                if [ "X$${cdextra_skip}" != "X" ]; then                 \
1.13      sborrill  174:                        rm -f cdskip;                                   \
1.16      hubertf   175:                        for skip in $${cdextra_skip};                   \
1.13      sborrill  176:                        do                                              \
                    177:                                echo $${skip} >> cdskip;                \
                    178:                        done;                                           \
                    179:                        skipflag="-X $${curdir}/cdskip";                \
                    180:                fi;                                                     \
1.16      hubertf   181:                cdextra="${CDEXTRA}";                                   \
                    182:                cdbuildextra="${CDBUILDEXTRA}";                         \
                    183:                for cde in $${cdextra} $${cdbuildextra};                \
1.13      sborrill  184:                do                                                      \
                    185:                        release_destdir=$${curdir}/cdrom;               \
                    186:                        if [ -f $${cde} ]; then                         \
                    187:                                echo Copying $${cde} to $$release_destdir ...;  \
                    188:                                ${CP} $${cde} $${release_destdir};      \
                    189:                        elif [ -d $${cde} ]; then                       \
                    190:                                cd $${cde};                             \
                    191:                                echo Copying $$(pwd) to $$release_destdir ...;  \
                    192:                                ${TOOL_MTREE} -c $${skipflag} |         \
                    193:                                        ${TOOL_PAX} -rw -pe -v -M       \
                    194:                                        $$release_destdir;              \
                    195:                        else                                            \
                    196:                                echo "Missing $${cde}, aborting";       \
                    197:                                exit 1;                                 \
                    198:                        fi;                                             \
                    199:                        cd $$curdir;                                    \
                    200:                done;                                                   \
1.11      jnemeth   201:        fi
1.1       hubertf   202:
                    203: image:
1.18      jmcneill  204:        ${TOOL_MAKEFS} -t cd9660 -o ${_CDMAKEFSOPTIONS:Q} ${CDIMAGE} cdrom
1.8       bouyer    205:
                    206: .if ${CDRELEASE} == false
1.15      ad        207: release: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image_md_pre .WAIT image .WAIT image_md_post
1.8       bouyer    208:        ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR}
1.18      jmcneill  209:        ${RELEASE_INSTALL} ${CDIMAGE} ${RELEASEDIR}/${CDROMS_RELEASEDIR}
1.1       hubertf   210:
1.8       bouyer    211: iso_image:
                    212: .else
1.1       hubertf   213: release:
1.8       bouyer    214:
1.15      ad        215: iso_image: prepare .WAIT prepare_md_post .WAIT copy-releasedir .WAIT image_md_pre .WAIT image .WAIT image_md_post
1.8       bouyer    216:        ${MKDIR} ${RELEASEDIR}/${CDROMS_RELEASEDIR}
1.18      jmcneill  217:        ${RELEASE_INSTALL} ${CDIMAGE} ${RELEASEDIR}/${CDROMS_RELEASEDIR}
1.8       bouyer    218: .endif
1.1       hubertf   219:
                    220: clean:
                    221:        ${RM} -fr cdrom
                    222:
1.8       bouyer    223: prepare_md_post: .PHONY
                    224: image_md_post: .PHONY
1.15      ad        225: image_md_pre: .PHONY
1.8       bouyer    226:
1.1       hubertf   227: .include <bsd.prog.mk>

CVSweb <webmaster@jp.NetBSD.org>