Subject: Re: ERR_NOOS in stand/mbr/mbr.S
To: David Laight <david@l8s.co.uk>
From: Brian A. Seklecki <lavalamp@spiritual-machines.org>
List: port-i386
Date: 04/27/2006 17:06:03
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-1349577973-1146169753=:71150
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; FORMAT=flowed
Content-ID: <20060427163152.F71150@arbitor.digitalfreaks.org>

On Thu, 27 Apr 2006, Brian A. Seklecki wrote:

> On Thu, 27 Apr 2006, David Laight wrote:
>
>> On Thu, Apr 27, 2006 at 03:32:10PM +1000, Malcolm Herbert wrote:
>>> On Wed, Apr 26, 2006 at 10:09:23PM +0100, David Laight wrote:
>>> |I usually run 'hd -C -n 512 /dev/wd0a' to check the contents....

Alright interesting results.  If I diff(1) out the hexdump(1) -C -n 512 of 
/dev/rwd0d (CF in ATA adapter):

wd0 at atabus0 drive 0: <LEXAR ATA FLASH>
wd0: drive supports 4-sector PIO transfers, LBA addressing
wd0: 983 MB, 1999 cyl, 16 head, 63 sec, 512 bytes/sect x 2014992 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4
wd0(piixide0:0:0): using PIO mode 4

I have very few differences (see attachment).  I suspect this may be a 
fdisk(8) usage issue....

When sysinst create a partition on this CF->WD disk (after having wiped it 
with dd(1) if=/dev/zero), it looks like:

Partition table:
0: NetBSD (sysid 169)
     start 63, size 2014929 (984 MB, Cyls 0-999/16/1), Active

However, when I create the partition, it looks like:

Partition table:
0: NetBSD (sysid 169)
     start 63, size 2014929 (984 MB, Cyls 0/1/32-983/56/17), Active

The catch here is that this what it looks like as a vnd(4).  When I write 
image it looks different on the destination media.  vnd(4) also shows a 
different virtual disk geoemtry than wd(4):

Disk: /dev/rvnd0d
NetBSD disklabel disk geometry:
cylinders: 983, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 2014992

983/64/32 is same geometry that this exact same CF card probes as when I 
connect the card to a USB->CF adapter.  Here the total sectors are correct 
but the geometry provided doesn't match up.

983/64/32 should actually be: 2013184 , not 2014992.  See my comments at:
http://lists.soekris.com/pipermail/soekris-tech/2006-April/010363.html


Finally, I'm creating this fdisk in a shell script.  It has to run in 
non-interactive mode:

# fdisk -b 1999/16/63 -v -f -u -s 169/63/2014929 -i -a -0 \
-c ./cf_root/usr/mdec/mbr vnd0

*) 199/16/63 is the geometry provided by rwd0d
*) 169/63/2014929 is a NetBSD partition starting 1 track away from the
    beginning of the disk with a size of $(total sectors -
    1x(sectors/track))

My disklabel(5) then respectivly offsets by 63:

16 partitions:
#    size    offset     fstype [fsize bsize cpg/sgs]
  a:  516096 63     4.2BSD 1024 8192 43008  # (Cyl.  0*- 512*)
  b: 1498770 516159 4.2BSD 1024 8192 44088  # (Cyl.  512*- 1998*)

I'm really just guessing on all of this cocktail of flags at this point, 
though.  I haven't looked too closely at the sysinst source code to see 
how it goes about it.  I'm trying to port cf_image.sh which is 
OpenBSD-specific(1).

So my thouhts at this point are:

a) Maybe some magic is getting lost during the dd(1) transfer from a file 
to a raw device

b) I'm using fdisk(8) wrong.


1. http://256.com/gray/docs/soekris_openbsd_diskless/


>
>
> That's interesting because the system I'm working with are vnd(4) created 
> images for CF Boot.
>
--0-1349577973-1146169753=:71150
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME=rvnd0d_rwd0d_diff.txt
Content-Transfer-Encoding: BASE64
Content-ID: <20060427162913.L71150@arbitor.digitalfreaks.org>
Content-Description: 
Content-Disposition: ATTACHMENT; FILENAME=rvnd0d_rwd0d_diff.txt

LS0tIHJ2bmQwZAlUaHUgQXByIDI3IDE2OjE0OjA0IDIwMDYNCisrKyByd2Qw
ZAlUaHUgQXByIDI3IDE2OjEyOjUwIDIwMDYNCkBAIC0yMywxMiArMjMsMTEg
QEANCiAwMDAwMDE2MCAgNzMgNzkgNzMgNzQgNjUgNmQgMDAgNDkgIDZlIDc2
IDYxIDZjIDY5IDY0IDIwIDQzICB8c3lzdGVtL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