From d6ca0e8299d61c734d6d7e1b1907d3c5919da352 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Sun, 4 Mar 2007 04:59:41 +0000 Subject: [PATCH] Several fixes to make sgimipscd actually bootable: - introduce SGIMIPS_SGIVOL variable which specifies sgivol(8) path because nbsgivol tool is available only in TOOLDIR for sgimips and possibly exists in a different directory from default TOOLDIR path - use fixed (4096) value for SGIVOLHDR.size because default value taken from is 3135 (not multiples of 4) so it doesn't match 2048bytes/sector CD images - also pass SGIVOLHDR.size to sgivol(8) on creating volume - rename raw iso9660 image before creating SGIVOLHDR to avoid incomplete (non-bootable) image left on failure of sgivol(8) Problem (i.e. sgimipscd-3.0.2.iso is not bootable) was reported by Thierry Lacoste on port-sgimips, and fixed images are also tested by him on IP22 (and by me on IP32). --- distrib/cdrom/Makefile | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/distrib/cdrom/Makefile b/distrib/cdrom/Makefile index 2ff7cf3bed8d..18f9ebb8ba5c 100644 --- a/distrib/cdrom/Makefile +++ b/distrib/cdrom/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.32 2007/03/04 04:27:21 tsutsui Exp $ +# $NetBSD: Makefile,v 1.33 2007/03/04 04:59:41 tsutsui Exp $ # # Consult "*.conf" for the configuration variables; this Makefile is typically # not edited for basic configuration changes. @@ -79,6 +79,9 @@ VAX_IBOOT?= ${TOOL_INSTALLBOOT} -m vax -o sunsum,append MACPPC_IBOOTDIR!= cd ${.CURDIR}/macppc_installboot && ${PRINTOBJDIR} MACPPC_MKBOOTHFSDIR!= cd ${.CURDIR}/macppc_mkboothfs && ${PRINTOBJDIR} .endif +.if !empty(ALL_PORTS:Msgimips) +SGIMIPS_SGIVOL?= ${TOOLDIR}/bin/nbsgivol +.endif RSYNC_SITE?= rsync://rsync.NetBSD.org/NetBSD/${RELEASENAME} RSYNC_ARGS?= -va --delete @@ -365,13 +368,8 @@ ${file:C/^.*://}: .PHONY .if !empty(BASE_PORTS.${image}:Mmacppc) size-${image}: all-macppc_mkboothfs all-macppc_installboot .endif -.if !empty(BASE_PORTS.${image}:Msgimips) && defined(EXTFILES.sgimips) -SGIVOLHDR.size= ( fgrep SGI_BOOT_BLOCK_SIZE_VOLHDR \ - ${EXTFILEDIR}/sgimips.bootblock.h | \ - sed -e 's/[^0-9]*//' ) -.else -SGIVOLHDR.size= echo 0 -.endif + +SGIVOLHDR.size= 4096 size-${image}: stage-${image} extfileprep fileprep-${image} .if !empty(BASE_PORTS.${image}:Mmacppc) @@ -394,7 +392,7 @@ size-${image}: stage-${image} extfileprep fileprep-${image} fi && \ if [ "${BASE_PORTS.${image}:Msgimips}" != "" -a \ "${EXTFILES.sgimips}" != "" ]; then \ - size=$$(($$size + ${SGIVOLHDR.size:sh} * 512)); \ + size=$$(($$size + ${SGIVOLHDR.size} * 512)); \ fi && \ size=$$(($$(($$size + 16383)) / 16384 * 16384 + 32768)) && \ sizek=$$(($$size / 1024)) && \ @@ -430,14 +428,15 @@ ${IMAGEDIR}/${image}.iso: size-${image} .endif .if !empty(BASE_PORTS.${image}:Msgimips) && defined(EXTFILES.sgimips) @echo "Prepending SGI volume header" - cp $@ $@.tmp - dd if=/dev/zero bs=512 count=${SGIVOLHDR.size:sh} >> $@ - ${TOOLDIR}/bin/nbsgivol -f -i $@ - ${TOOLDIR}/bin/nbsgivol -f -w aoutboot ${STAGEDIR}/${image}/aoutboot $@ - ${TOOLDIR}/bin/nbsgivol -f -w ip2xboot ${STAGEDIR}/${image}/ip2xboot $@ - ${TOOLDIR}/bin/nbsgivol -f -w ip3xboot ${STAGEDIR}/${image}/ip3xboot $@ - dd if=$@.tmp of=$@ bs=512 seek=${SGIVOLHDR.size:sh} - rm -f $@.tmp + mv $@ $@.raw + dd if=/dev/zero of=$@.tmp bs=512 count=${SGIVOLHDR.size} + dd if=$@.raw of=$@.tmp bs=512 seek=${SGIVOLHDR.size} + ${SGIMIPS_SGIVOL} -f -i -h ${SGIVOLHDR.size} $@.tmp + ${SGIMIPS_SGIVOL} -f -w aoutboot ${STAGEDIR}/${image}/aoutboot $@.tmp + ${SGIMIPS_SGIVOL} -f -w ip2xboot ${STAGEDIR}/${image}/ip2xboot $@.tmp + ${SGIMIPS_SGIVOL} -f -w ip3xboot ${STAGEDIR}/${image}/ip3xboot $@.tmp + mv $@.tmp $@ + rm -f $@.raw $@.tmp .endif @echo Rounding up to 32k boundary and padding 32k.... @size=`ls -l $@ | awk '{print $$5}'` && \