Better size estimation (the previous code counted the compressed kernels,

but we only need the constant size volume header)
This commit is contained in:
martin 2005-10-04 16:11:15 +00:00
parent 17b2c3c86e
commit c1a47858e9
1 changed files with 14 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.13 2005/05/10 21:58:03 martin Exp $
# $NetBSD: Makefile.inc,v 1.14 2005/10/04 16:11:15 martin Exp $
#
# etc.sgimips/Makefile.inc -- sgimips-specific etc Makefile targets
#
@ -22,21 +22,19 @@ iso-image-md-pre:
SGI.image= ${RELEASEDIR}/${MACHINE}/installation/cdrom/netbsd-sgimips.img
iso-image-md-post:
EST=`ls -l ${CDROM.image} ${DESTDIR}/usr/mdec/aoutboot \
${DESTDIR}/usr/mdec/ip2xboot ${DESTDIR}/usr/mdec/ip3xboot \
| awk '{ s += $$5} END { print int(s/1024/1024/32+1)*32 }'` ; \
echo "Estimated image size: $${EST} MB"; \
dd if=/dev/zero of=${SGI.image} bs=1024k count=$${EST}
${TOOLDIR}/bin/nbsgivol -f -i ${SGI.image}
${TOOLDIR}/bin/nbsgivol -f -w aoutboot ${DESTDIR}/usr/mdec/aoutboot \
${SGI.image}
${TOOLDIR}/bin/nbsgivol -f -w ip2xboot ${DESTDIR}/usr/mdec/ip2xboot \
${SGI.image}
${TOOLDIR}/bin/nbsgivol -f -w ip3xboot ${DESTDIR}/usr/mdec/ip3xboot \
${SGI.image}
# Don't hardcode this. Pick it up from bootblock.h
SEEK=`awk '/SGI_BOOT_BLOCK_SIZE_VOLHDR/{print $$3}' \
@SEEK=`awk '/SGI_BOOT_BLOCK_SIZE_VOLHDR/{print $$3}' \
${DESTDIR}/usr/include/sys/bootblock.h` ; \
dd if=${CDROM.image} of=${SGI.image} bs=512 seek=$${SEEK}
EST=`ls -l ${CDROM.image} \
| awk '{ s += $$5} END { print int(('$${SEEK}'*512+s)/1024/1024/32+1)*32 }'` ; \
echo "Estimated image size: $${EST} MB"; \
dd if=/dev/zero of=${SGI.image} bs=1024k count=$${EST}; \
${TOOLDIR}/bin/nbsgivol -f -i ${SGI.image}; \
${TOOLDIR}/bin/nbsgivol -f -w aoutboot ${DESTDIR}/usr/mdec/aoutboot \
${SGI.image}; \
${TOOLDIR}/bin/nbsgivol -f -w ip2xboot ${DESTDIR}/usr/mdec/ip2xboot \
${SGI.image}; \
${TOOLDIR}/bin/nbsgivol -f -w ip3xboot ${DESTDIR}/usr/mdec/ip3xboot \
${SGI.image}; \
dd if=${CDROM.image} of=${SGI.image} bs=512 seek=$${SEEK}
mv ${SGI.image} ${CDROM.image}
rm -f ${RELEASEDIR}/ip2x ${RELEASEDIR}/ip3x