Subject: Re: Patches to allow sgimips cross-built full releases and ISO
To: sgimips NetBSD list <sgimips@mrynet.com>
From: J Lachlan Kanaley <kanaley@student.usyd.edu.au>
List: port-sgimips
Date: 05/18/2004 13:08:26
Geez, that was quick! cheers!
Unfortunately I can't get the first patch to apply cleanly though.
The second applies no worries.
> patch -C < patch.1
Hmm... Looks like a normal diff to me...
The text leading up to this was:
--------------------------
|Index: etc/etc.sgimips/Makefile.inc
|===================================================================
|RCS file: /cvsroot/src/etc/etc.sgimips/Makefile.inc,v
|retrieving revision 1.9
|diff -r1.9 Makefile.inc
--------------------------
Patching file etc/etc.sgimips/Makefile.inc using Plan A...
Hunk #1 succeeded at 16.
Hunk #2 succeeded at 57.
Hunk #3 failed at 59.
1 out of 3 hunks failed--saving rejects to
etc/etc.sgimips/Makefile.inc.rej
done
- Lachlan
On Mon, May 17, 2004 at 09:45:10PM -0500, sgimips NetBSD list wrote:
> Hi All,
>
> Attached are two diffs to etc/etc.sgimips/Makefile.inc and
> sys/arch/sgimips/stand/sgivol/sgivol.c.
>
> These diffs allow a complete release, including ISO image, to be cross-built
> for the NetBSD/sgimips port under FreeBSD 4.x and 5.x. These mods only affect
> the sgimips portion of build code and are unused by any other ports.
>
> Explanation of the diffs:
>
> etc/etc.sgimips/Makefile.inc:
>
> FreeBSD uses different 'vnode' device commands and devices than
> NetBSD. To complicate things further, FreeBSD 4.x differs from
> FreeBSD 5.x
>
> Under NetBSD, the vnconfig command is used:
> # vnconfig vnd0 imagefile.iso
> # sgivol -f -i vnd0
> # vnconfig -u vnd0
>
> Under FreeBSD 4.x, the necessary steps are:
> # vnconfig -s labels -c vn0 imagefile.iso
> # disklabel -w -r vn0 auto
> # vnconfig -u vn0
>
> While under FreeBSD 5.x, the necessary steps are:
> # mdconfig -a -t vnode -u md0 -f imagefile.iso
> # bsdlabel -m i386 -w -r md0 auto
> # sgivol -f -i md0
> # mdconfig -d -u md0
> The bsdlabel (aka disklabel) on FreeBSD 5.x requires "-m i386" to ensure
> that non-i386 platforms can access disk block 0 on the md0 device.
>
> sys/arch/sgimips/stand/sgivol/sgivol.c:
>
> Under NetBSD, access to the raw disk is via r${DEV}c (/dev/rvnd0d).
> Under FreeBSD, only the DEV is needed (/dev/vn0 or /dev/md0),
> without "r" (raw) or the "raw" partition letter. Furthermore,
> getrawpartition() is a NetBSD-only function.
>
> This mod detects whether NetBSD is the target host and compiles support
> accordingly.
>
> A slight bit of functionality change when running on a cross-build host:
> the device argument to sgivol.c should be the full device rather than
> just the device name (without "r" and partition letter). I.e. on FreeBSD
> 4.x you should supply "/dev/rda0c" instead of "da0" as you would expect
> on a NetBSD platform.
>
> I've attempted to code the scripting generically enough to accomodate other
> operating-system hosts. Surely there will be tweaking necessary for them,
> but at least FreeBSD and Mac OS X should be accomodated now.
>
> Please consider these mods for committal to the MAIN and 2-0 branches.
> They have been tested on FreeBSD 4.x/i386, FreeBSD 5.x/i386, FreeBSD 5.x/alpha,
> NetBSD 2.0/alpha, NetBSD 2.0/i386 and NetBSD 2.0/amd64. Target architectures
> tested have been alpha, i386, amd64, sparc, sparc64, sgimips and vax.
>
> I'm currently working on adding support for Solaris 8/9/10 and IRIX 6.5
> crossbuild release support for NetBSD/sgimips. I'm not sure if I'll succeed
> since neither OS has the disklabel capabilities we need, but perhaps sgivol(8)
> is enough to accomplish this.
>
> Thanks and regards,
> -scott
>
>
>
> Index: etc/etc.sgimips/Makefile.inc
> ===================================================================
> RCS file: /cvsroot/src/etc/etc.sgimips/Makefile.inc,v
> retrieving revision 1.9
> diff -r1.9 Makefile.inc
> 15a16,50
> > SGI.image= ${RELEASEDIR}/${MACHINE}/installation/cdrom/netbsd-sgimips.img
> >
> > THISHOSTSYS!= uname -s
> >
> > # Set up vnode/memory-disk port-specific stuff
> >
> > # Default to NetBSD
> > VDEV= vnd0
> > VDEVF= r${VDEV}d
> > VDEVCREATE= vnconfig ${VDEV} ${SGI.image}
> > VDEVDESTROY= vnconfig -u ${VDEV}
> > VDEVLABEL= :
> >
> > .if ${THISHOSTSYS} == "FreeBSD"
> > FREEBSDTYPE!= which mdconfig
> > .if ${FREEBSDTYPE} == ""
> > # FreeBSD 4.x and prior
> > VDEV= vn0
> > VDEVF= r${VDEV}c
> > VDEVCREATE= vnconfig -s labels -c ${VDEV} ${SGI.image}
> > VDEVLABEL= disklabel -w -r ${VDEV} auto
> > .else
> > # FreeBSD 5.x and later
> > VDEV= md0
> > VDEVF= ${VDEV}c
> > VDEVCREATE= mdconfig -a -t vnode -u ${VDEV} -f ${SGI.image}
> > VDEVDESTROY= mdconfig -d -u ${VDEV}
> > # FreeBSD 5 bsdlabel requires "-m i386" on platforms other than i386
> > # otherwise, disk block zero cannot be written to. On the alpha,
> > # FreeBSD's bsdlabel will even fail with a floating exception without
> > # it.
> > VDEVLABEL= bsdlabel -m i386 -w -r ${VDEV} auto
> > .endif
> > .endif
> >
> 22,23d56
> < SGI.image= ${RELEASEDIR}/${MACHINE}/installation/cdrom/netbsd-sgimips.img
> <
> 26,31c59,69
> < vnconfig vnd0 ${SGI.image}
> < ${TOOLDIR}/bin/nbsgivol -f -i vnd0
> < ${TOOLDIR}/bin/nbsgivol -f -w aoutboot ${DESTDIR}/usr/mdec/aoutboot vnd0
> < ${TOOLDIR}/bin/nbsgivol -f -w ip2xboot ${DESTDIR}/usr/mdec/ip2xboot vnd0
> < ${TOOLDIR}/bin/nbsgivol -f -w ip3xboot ${DESTDIR}/usr/mdec/ip3xboot vnd0
> < vnconfig -u vnd0
> ---
> >
> > ${VDEVCREATE}
> > ${VDEVLABEL}
> >
> > ${TOOLDIR}/bin/nbsgivol -f -i ${VDEVF}
> > ${TOOLDIR}/bin/nbsgivol -f -w aoutboot ${DESTDIR}/usr/mdec/aoutboot ${VDEVF}
> > ${TOOLDIR}/bin/nbsgivol -f -w ip2xboot ${DESTDIR}/usr/mdec/ip2xboot ${VDEVF}
> > ${TOOLDIR}/bin/nbsgivol -f -w ip3xboot ${DESTDIR}/usr/mdec/ip3xboot ${VDEVF}
> >
> > ${VDEVDESTROY}
> >
> Index: sys/arch/sgimips/stand/sgivol/sgivol.c
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/sgimips/stand/sgivol/sgivol.c,v
> retrieving revision 1.8
> diff -r1.8 sgivol.c
> 251a252
> > #ifdef __NetBSD__
> 252a254,256
> > #else
> > sprintf(buf, "/dev/%s", argv[0]);
> > #endif
>
--
James Lachlan Kanaley
phone: (02) 9517 3209
mobile: 0427 368 345
email: kanaley@student.usyd.edu.au
web: http://users.tpg.com.au/adslclfu