Subject: Re: ZIP drive problems
To: None <port-hp300@NetBSD.ORG, port-sparc@NetBSD.ORG>
From: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
List: port-sparc
Date: 01/09/1997 10:26:45
[I've added port-sparc bceause this is a sparc/hp300 cross-port issue.]

> yesterday I tried to use my ZIP drive ( SCSI of course ) to bring the
> NetBSD-1.2 dist. home to my hp.  I thought about disklabeling it on
> the hp and then later at the university use it on a SPARC IPX running
> netbsd 1.1.  first thing: the sparc didn't see the disklabel.

Yeah, NetBSD/sparc - at least last time I looked at the code - doesn't
understand native NetBSD disklabels, only SunOS-style disklabels.  IMO
this is a lose (you need a SunOS-style label on your boot disk, but not
on any others, unless they're shared with non-NetBSD OSes).

> Is the disklabel-part platform-dependent ?

Yes.

> I know, the sparc port uses sunos disklabels, but what uses the hp ?
> I thought it were sunos ones too, since I never found anything hp/ux
> like...

Heavens no.  The hp300 port uses a weird setup apparently invented by
HP, one I assume it's compelled to use for compatability with HP's boot
ROMs.  Under HP-UX there's this thing called LIF, I'm not sure what it
stands for, but it's basically a really rudimentary filesystem.  The
NetBSD/hp300 bootblocks are really LIF images, constructed "by hand" by
mkboot when "make install" is run in /sys/arch/hp300/stand.  See
mkboot.c in that directory for full details.

Or at least that's true of a 1.2 source tree; I think thorpej has been
working on bringing the hp300 port into a more modern state.  I don't
know whether any of this has been touched (though I don't recall seeing
any source-changes mail about changing anything bootblock-related), nor
whether it will be.

> can anyone tell me how I could make the hp writing directly to the
> zip disk ?

Can't help you there; my hp300 has no SCSI. :-(

> or how to make a filesystem on it that both, the hp and the sparc can
> read ?

This is probably possible, but it would be a bit ugly.  (Note: I
haven't tried any of this; this is pure speculation at present.)

Disklabel the disk on the HP.  This will write a LIF header into the
first 40 bytes of the first sector and dump a bunch more stuff into
later sectors, per the comments in mkboot.c.

The SunOS label always lives in the first sector.  Fortunately, the
first 40 bytes are part of the "ascii label string" field, so they can
be anything you want.  Construct your desired SunOS disklabel any way
you please - disklabel a scratch disk and dd it off, use sunlabel on a
file, anything.  Then take the SunOS-style disklabel, which will be 512
bytes, and replace its first 40 bytes with the first 40 bytes of the
hp300-created disklabel.  This will render the checksum incorrect, so
you'll have to fix it; the way I'd do this is to run "sunlabel -fixsum"
on it, but you can do it by hand (write me if you want the checksum
algorithm).  Replace the first sector of the hp300-labeled disk with
the result and you should be off and running.

Be careful when laying out your partitions to avoid using the beginning
of the disk.  The first 8K (16 sectors) are left untouched anyway, but
this isn't always enough for the hp300 port.  If you want the disk to
be bootable on the HP, you have to avoid stomping on the whole LIF
"filesystem"; check out the size of the thing installed by installboot
to see how much space you have to avoid using - or just skip the first
meg or so.  With a SunOS-style label, your partitions have to begin on
what the label thinks are cylinder boundaries anyway; if (as I would
recommend) you label the zip disk with one-meg cylinders, skipping the
first "cylinder" loses you only a little over 1% of the available
space (not exactly 1% - iomega calls them 100-meg, but that's a lie;
they're 96 megs).  It may be that if you don't want the disk bootable
on the HP, you can get away with just doing the first-16-sectors thing,
in which case you don't need to reserve any space unless you expect to
copy stuff directly into raw disk partitions.

Since the sparc and the hp300 are both big-endian, you should be able
to mkfs on either and have the other use the filesystem, once you get
disklabels that agree on where the partitions are.  (Be careful about
this, because the hp300 disklabel and the sparc disklabel are stored in
different places on the disk and in different formats even, so if you
change one you must change the other to match, or you will get Very
Confused (tm).)

It occurs to me that given how hp300 mkboot lays out the beginning of
the disk, you could probably create a disk that would be bootable on
either the hp300 or the sparc, but it would require some very careful
juggling to fit the sparc boot program into the unused spaces in the
hp300 layout - definitely not something for the faint of heart.
(Besides, the sparc and the hp300 can't share binaries, and a zip disk
is barely big enough for a bootable system for _one_ architecture.)

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B