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 <sys/bootblock.h> 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).
This commit is contained in:
tsutsui 2007-03-04 04:59:41 +00:00
parent 3723e75357
commit d6ca0e8299
1 changed files with 16 additions and 17 deletions

View File

@ -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 # Consult "*.conf" for the configuration variables; this Makefile is typically
# not edited for basic configuration changes. # 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_IBOOTDIR!= cd ${.CURDIR}/macppc_installboot && ${PRINTOBJDIR}
MACPPC_MKBOOTHFSDIR!= cd ${.CURDIR}/macppc_mkboothfs && ${PRINTOBJDIR} MACPPC_MKBOOTHFSDIR!= cd ${.CURDIR}/macppc_mkboothfs && ${PRINTOBJDIR}
.endif .endif
.if !empty(ALL_PORTS:Msgimips)
SGIMIPS_SGIVOL?= ${TOOLDIR}/bin/nbsgivol
.endif
RSYNC_SITE?= rsync://rsync.NetBSD.org/NetBSD/${RELEASENAME} RSYNC_SITE?= rsync://rsync.NetBSD.org/NetBSD/${RELEASENAME}
RSYNC_ARGS?= -va --delete RSYNC_ARGS?= -va --delete
@ -365,13 +368,8 @@ ${file:C/^.*://}: .PHONY
.if !empty(BASE_PORTS.${image}:Mmacppc) .if !empty(BASE_PORTS.${image}:Mmacppc)
size-${image}: all-macppc_mkboothfs all-macppc_installboot size-${image}: all-macppc_mkboothfs all-macppc_installboot
.endif .endif
.if !empty(BASE_PORTS.${image}:Msgimips) && defined(EXTFILES.sgimips)
SGIVOLHDR.size= ( fgrep SGI_BOOT_BLOCK_SIZE_VOLHDR \ SGIVOLHDR.size= 4096
${EXTFILEDIR}/sgimips.bootblock.h | \
sed -e 's/[^0-9]*//' )
.else
SGIVOLHDR.size= echo 0
.endif
size-${image}: stage-${image} extfileprep fileprep-${image} size-${image}: stage-${image} extfileprep fileprep-${image}
.if !empty(BASE_PORTS.${image}:Mmacppc) .if !empty(BASE_PORTS.${image}:Mmacppc)
@ -394,7 +392,7 @@ size-${image}: stage-${image} extfileprep fileprep-${image}
fi && \ fi && \
if [ "${BASE_PORTS.${image}:Msgimips}" != "" -a \ if [ "${BASE_PORTS.${image}:Msgimips}" != "" -a \
"${EXTFILES.sgimips}" != "" ]; then \ "${EXTFILES.sgimips}" != "" ]; then \
size=$$(($$size + ${SGIVOLHDR.size:sh} * 512)); \ size=$$(($$size + ${SGIVOLHDR.size} * 512)); \
fi && \ fi && \
size=$$(($$(($$size + 16383)) / 16384 * 16384 + 32768)) && \ size=$$(($$(($$size + 16383)) / 16384 * 16384 + 32768)) && \
sizek=$$(($$size / 1024)) && \ sizek=$$(($$size / 1024)) && \
@ -430,14 +428,15 @@ ${IMAGEDIR}/${image}.iso: size-${image}
.endif .endif
.if !empty(BASE_PORTS.${image}:Msgimips) && defined(EXTFILES.sgimips) .if !empty(BASE_PORTS.${image}:Msgimips) && defined(EXTFILES.sgimips)
@echo "Prepending SGI volume header" @echo "Prepending SGI volume header"
cp $@ $@.tmp mv $@ $@.raw
dd if=/dev/zero bs=512 count=${SGIVOLHDR.size:sh} >> $@ dd if=/dev/zero of=$@.tmp bs=512 count=${SGIVOLHDR.size}
${TOOLDIR}/bin/nbsgivol -f -i $@ dd if=$@.raw of=$@.tmp bs=512 seek=${SGIVOLHDR.size}
${TOOLDIR}/bin/nbsgivol -f -w aoutboot ${STAGEDIR}/${image}/aoutboot $@ ${SGIMIPS_SGIVOL} -f -i -h ${SGIVOLHDR.size} $@.tmp
${TOOLDIR}/bin/nbsgivol -f -w ip2xboot ${STAGEDIR}/${image}/ip2xboot $@ ${SGIMIPS_SGIVOL} -f -w aoutboot ${STAGEDIR}/${image}/aoutboot $@.tmp
${TOOLDIR}/bin/nbsgivol -f -w ip3xboot ${STAGEDIR}/${image}/ip3xboot $@ ${SGIMIPS_SGIVOL} -f -w ip2xboot ${STAGEDIR}/${image}/ip2xboot $@.tmp
dd if=$@.tmp of=$@ bs=512 seek=${SGIVOLHDR.size:sh} ${SGIMIPS_SGIVOL} -f -w ip3xboot ${STAGEDIR}/${image}/ip3xboot $@.tmp
rm -f $@.tmp mv $@.tmp $@
rm -f $@.raw $@.tmp
.endif .endif
@echo Rounding up to 32k boundary and padding 32k.... @echo Rounding up to 32k boundary and padding 32k....
@size=`ls -l $@ | awk '{print $$5}'` && \ @size=`ls -l $@ | awk '{print $$5}'` && \