Subject: Re: is sgimipscd-3.0.2.iso bootable
To: None <port-sgimips@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-sgimips
Date: 03/04/2007 01:41:41
lacoste@univ-paris12.fr wrote:

> 1) I had to issue the boot command twice !?!
> 
> >> boot -f scsi(0)cdrom(4)rdisk(0)partition(8)ip2xboot
> 
> Cannot load scsi(0)cdrom(4)rdisk(0)partition(8)ip2xboot.
> Illegal f_magic number 0xbe5, expected MIPSELMAGIC or MIPSEBMAGIC.
> Unable to load scsi(0)cdrom(4)rdisk(0)partition(8)ip2xboot: execute format 
> error
> >> boot -f scsi(0)cdrom(4)rdisk(0)partition(8)ip2xboot
> 
> NetBSD/sgimips 3.0.2 Bootstrap, Revision 1.2
> (builds@b0.netbsd.org, Wed Nov  1 05:28:20 UTC 2006)

Looks ARCS' bug, but if it could be a workaround it's okay :-)

> 2) The instalation fails when mounting the cd to install sets.
> Is this expected?
> 
>      Status: Command failed
>     Command: /sbin/mount -rt cd9660 /dev/cd0a /mnt2
>      Hit enter to continue
> --------------------------------------------------------------------------------
> mount_cd9660: /dev/cd0a on /mnt2: Invalid argument

I can reproduce it on my IP32 and there is another problem
in src/distrib/cdrom/Makefile on creating sgivolhdr.

Could you try this one?
ftp://ftp.netbsd.org/pub/NetBSD/misc/tsutsui/sgimipscd-3.0.2-bootable.iso.gz

It works fine on IP32, and if it works on your IP22
I'll commit it and ask releng to check how it goes.
---
Izumi Tsutsui


Index: 3.0.2.conf
===================================================================
RCS file: /cvsroot/src/distrib/cdrom/3.0.2.conf,v
retrieving revision 1.1
diff -u -r1.1 3.0.2.conf
--- 3.0.2.conf	2 Nov 2006 10:46:30 -0000	1.1
+++ 3.0.2.conf	3 Mar 2007 15:49:29 -0000
@@ -21,6 +21,9 @@
 # which are CD-image specific.
 
 CD_IMAGES=
+.if defined(TARGET_CD_IMAGE)
+CD_IMAGES+=	${TARGET_CD_IMAGE}-${ISO_RELEASE}
+.else
 CD_IMAGES+=	multi-cd1-${ISO_RELEASE}
 CD_IMAGES+=	multi-cd2-${ISO_RELEASE}
 CD_IMAGES+=	multi-cd3-${ISO_RELEASE}
@@ -78,6 +81,7 @@
 CD_IMAGES+=	sun3cd-${ISO_RELEASE}
 CD_IMAGES+=	vaxcd-${ISO_RELEASE}
 CD_IMAGES+=	x68kcd-${ISO_RELEASE}
+.endif
 
 ##############################################################################
 # The maximum size of an individual CD.
Index: 3.1.conf
===================================================================
RCS file: /cvsroot/src/distrib/cdrom/3.1.conf,v
retrieving revision 1.1
diff -u -r1.1 3.1.conf
--- 3.1.conf	21 Aug 2006 21:14:24 -0000	1.1
+++ 3.1.conf	3 Mar 2007 15:49:29 -0000
@@ -21,6 +21,9 @@
 # which are CD-image specific.
 
 CD_IMAGES=
+.if defined(TARGET_CD_IMAGE)
+CD_IMAGES+=	${TARGET_CD_IMAGE}-${ISO_RELEASE}
+.else
 CD_IMAGES+=	multi-cd1-${ISO_RELEASE}
 CD_IMAGES+=	multi-cd2-${ISO_RELEASE}
 CD_IMAGES+=	multi-cd3-${ISO_RELEASE}
@@ -78,6 +81,7 @@
 CD_IMAGES+=	sun3cd-${ISO_RELEASE}
 CD_IMAGES+=	vaxcd-${ISO_RELEASE}
 CD_IMAGES+=	x68kcd-${ISO_RELEASE}
+.endif
 
 ##############################################################################
 # The maximum size of an individual CD.
Index: 4.0.conf
===================================================================
RCS file: /cvsroot/src/distrib/cdrom/4.0.conf,v
retrieving revision 1.1
diff -u -r1.1 4.0.conf
--- 4.0.conf	24 Aug 2006 18:15:08 -0000	1.1
+++ 4.0.conf	3 Mar 2007 15:49:29 -0000
@@ -21,6 +21,9 @@
 # which are CD-image specific.
 
 CD_IMAGES=
+.if defined(TARGET_CD_IMAGE)
+CD_IMAGES=	${TARGET_CD_IMAGE}-${ISO_RELEASE}
+.else
 CD_IMAGES+=	multi-cd1-${ISO_RELEASE}
 CD_IMAGES+=	multi-cd2-${ISO_RELEASE}
 CD_IMAGES+=	multi-cd3-${ISO_RELEASE}
@@ -78,6 +81,7 @@
 CD_IMAGES+=	sun3cd-${ISO_RELEASE}
 CD_IMAGES+=	vaxcd-${ISO_RELEASE}
 CD_IMAGES+=	x68kcd-${ISO_RELEASE}
+.endif
 
 ##############################################################################
 # The maximum size of an individual CD.
Index: Makefile
===================================================================
RCS file: /cvsroot/src/distrib/cdrom/Makefile,v
retrieving revision 1.30
diff -u -r1.30 Makefile
--- Makefile	20 Feb 2007 18:09:05 -0000	1.30
+++ Makefile	3 Mar 2007 15:49:29 -0000
@@ -79,6 +79,9 @@
 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 @@
 .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 @@
 	fi && \
 	if [ "${BASE_PORTS.${image}:Msgimips}" != "" && \
 	    "${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 @@
 .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}'` && \