Thank you.  This helped me to figure out that installboot was clobbering
the MBR on the vnd images because of the type in the disklabel.  

After reviewing arch/i386/stand/installboot/installboot.c I realized
that installboot assumes any vnd device is the same as a floppy and just
starts writing the boot blocks at the first block.  This assumption
makes sense for using installboot to create, say, OpenBSD boot floppies.

For any disklabel that has a type other than vnd or floppy, installboot 
lseek()s past the MBR before it writes.  So, just adding echo "type: ESDI" >> $T
is sufficient to make installboot behave properly with vnd images destined
for non-floppy media.

Thomas B??rnert [EMAIL PROTECTED] wrote:
> Hi List,
> 
> the problem is solved with the following patch for the
> flashdisk.sh
> 
> ---snip---
> --- flashdist.sh        Mon Nov 13 04:15:50 2006
> +++ flashdist-new.sh    Wed Aug  1 13:37:49 2007
> @@ -473,6 +473,24 @@
> 
>  # Here we setup an 'a' partition that takes up the whole flash media
>  # and a 'b' partition of minimal size which can be used with mount_mfs
> +echo "type: SCSI" >> $T
> +echo "disk: vnd device" >> $T
> +echo "label: fictitious" >> $T
> +echo "flags:" >> $T
> +echo "bytes/sector: ${bytessec}" >> $T
> +echo "sectors/track: ${sectorstrack}" >> $T
> +echo "tracks/cylinder: ${trackscylinder}" >> $T
> +echo "sectors/cylinder: ${sectorscylinder}" >> $T
> +echo "cylinders: ${cylinders}" >> $T
> +echo "total sectors: ${totalsize}" >> $T
> +echo "rpm: 3600" >> $T
> +echo "interleave: 1" >> $T
> +echo "trackskew: 0" >> $T
> +echo "cylinderskew: 0" >> $T
> +echo "headswitch: 0           " >> $T
> +echo "track-to-track seek: 0  " >> $T
> +echo "drivedata: 0 " >> $
> +echo "" >> $T
>  echo "a: $asize        $sectorstrack   4.2BSD  1024    8192    16" >> $T
>  echo "b: 1             $offset swap" >> $T
>  echo "c: $totalsize    0       unused  0       0" >> $T
> ---snip---
> 
> Thomas
> 
> > Hi List,
> >
> > i've probleme with flashdist and OpenBSD 4.1. 4.0 works
> > fine but on 4.1 i've problems with the partiontables.
> >
> > here my setup procedure
> > ---------------------------------------------------------------------
> >
> > # dd if=/dev/zero of=flashimg bs=512 count=250368
> > 250368+0 records in
> > 250368+0 records out
> > 128188416 bytes transferred in 2.593 secs (49432122 bytes/sec)
> > # vnconfig -c svnd0 flashimg
> > # sh flashdist.sh svnd0 flashsmall.txt bsd /
> > flashdist.sh 20061112 [EMAIL PROTECTED]
> > Using disk device: svnd0
> > Using distfile: flashsmall.txt
> > Copying kernel from: bsd
> >
> > You did not specify -d and you did not specify a manual geometry.
> > Please enter Cylinders/Heads/SectorsPerTrack.
> >
> > Cylinders: 978
> > Tracks Per Cylinder(Heads): 8
> > Sectors Per Track: 32
> >
> > Please pay attention to any error messages that you may
> > receive from the commands this script is using. If you
> > end up having problems, they could explain why.
> >
> > WARNING: This will erase ALL DATA on the svnd0 disk device!
> > Press enter key to continue or Control-C to abort...
> >
> > Updating MBR and partition table...
> > fdisk: sysctl(machdep.bios.diskinfo): Device not configured
> > Note, you may ignore "sysctl(machdep.bios.diskinfo)" errors if present.
> >
> > Setting up disklabel...
> > # Inside MBR partition 3: type A6 start 32 size 250336
> >
> > The install script is using the following parameters:
> > Total size of media: 250368 sectors (128188416 bytes)
> > Bytes/Sector: 512
> > Sectors/Track: 32
> > Sectors/Cylinder: 256
> > Tracks/Cylinder (heads): 8
> > Cylinders: 978
> >
> > Press enter key to continue or Control-C to abort...
> >
> > Checking distribution list...
> >
> > Installing disklabel...
> > # Inside MBR partition 3: type A6 start 32 size 250336
> >
> > Creating new filesystem...
> > /dev/rsvnd0a:   250080 sectors in 977 cylinders of 8 tracks, 32 sectors
> >         122.1MB in 4 cyl groups (285 c/g, 35.62MB/g, 9088 i/g)
> >
> > Mounting destination to /tmp/flashdist.iXZgI9414...
> > Checking free space on svnd0...
> > Copying OpenBSD distribution to media...
> > Copying bsd kernel, boot blocks, /etc/resolv.conf...
> > Installing boot blocks...
> > Running MAKEDEV...done
> > Setting up directories and links...
> > Changing any instance of /bin/csh
> > in /tmp/flashdist.iXZgI9414/etc/master.passwd to /bin/ksh
> > Generating new RSA host key... done
> > Generating new RSA1 host key... done
> > Generating new DSA host key... done
> >
> > Please assign a root password...
> > Password:
> > Verify:
> > Passwords don't match or password was empty.  Try again.
> > Password:
> > Verify:
> >
> > Copying configuration files to /etc... ttys fstab rc syslog.conf boot.conf
> > nshrc
> >
> > Please enter the hostname or IP address of the central log host which will
> > receive udp syslog packets from this installation. (Press enter for none,
> > and syslog will log to ramdisk)
> >
> > Loghost:
> >
> > Installation finished.
> > Unmounting filesystem...done!
> > ------------------------------------------------------------------
> >
> > # fdisk svnd0
> > fdisk: sysctl(machdep.bios.diskinfo): Device not configured
> > Disk: svnd0     geometry: 978/8/32 [250368 Sectors]
> > Offset: 0       Signature: 0xAA55
> >          Starting       Ending       LBA Info:
> >  #: id    C   H  S -    C   H  S [       start:      size   ]
> > ------------------------------------------------------------------------
> >  0: E8 963667   7 23 - 14415919   1  7 [   246698998:  3443776305 ]
> > <Unknown ID>
> >  1: 01    0   0  1 - 16777215   7 32 [           0:           0 ] DOS
> > FAT-12 2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
> > 3: 3F    0   0  1 - 16777215   7 32 [           0:           0 ] <Unknown
> > ID>
> >
> >
> > # disklabel svnd0
> > # /dev/rsvnd0c:
> > type: vnd
> > disk: vnd device
> > label: fictitious
> > flags:
> > bytes/sector: 512
> > sectors/track: 32
> > tracks/cylinder: 8
> > sectors/cylinder: 256
> > cylinders: 978
> > total sectors: 250368
> > rpm: 3600
> > interleave: 1
> > trackskew: 0
> > cylinderskew: 0
> > headswitch: 0           # microseconds
> > track-to-track seek: 0  # microseconds
> > drivedata: 0
> >
> > 16 partitions:
> > #             size        offset  fstype [fsize bsize  cpg]
> >   a:        250080            32  4.2BSD   1024  8192  285 # Cyl     0*-  
> > 976 b:             1        250112    swap                   # Cyl   977 -
> > 977*
> >   c:        250368             0  unused      0     0      # Cyl     0 -  
> > 977
> >
> >
> > after unmounting and mounting the image
> >
> > # disklabel svnd0
> > # /dev/rsvnd0c:
> > type: vnd
> > disk: vnd device
> > label: fictitious
> > flags:
> > bytes/sector: 512
> > sectors/track: 100
> > tracks/cylinder: 1
> > sectors/cylinder: 100
> > cylinders: 2503
> > total sectors: 250368
> > rpm: 3600
> > interleave: 1
> > trackskew: 0
> > cylinderskew: 0
> > headswitch: 0           # microseconds
> > track-to-track seek: 0  # microseconds
> > drivedata: 0
> >
> > 16 partitions:
> > #             size        offset  fstype [fsize bsize  cpg]
> >   c:        250368             0  unused      0     0      # Cyl     0 -
> > 2503*
> >   i:        250368             0   MSDOS                   # Cyl     0 -
> > 2503*
> >
> >
> > it seems very strange ....
> >
> > have you anyone an idea ?
> >
> > with openbsd 4.0 no problem ....
> >
> > Thanks
> >
> > Thomas

-- 
Those who can, do.
Those who can't, sue.

Reply via email to