From d7b9445db33c1f0472a07ab6127b8d89103eff1e Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Sun, 21 Nov 2010 16:10:07 +0000 Subject: add hack to be able to use /dev/svnd0c as target device on MirBSD/OpenBSD Signed-off-by: Thorsten Glaser --- scripts/install.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'scripts/install.sh') diff --git a/scripts/install.sh b/scripts/install.sh index 7ade75c68..b8f21a0c6 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -224,18 +224,28 @@ if (( coreimgsz > 65024 )); then exit 1 fi (( coreendsec = (coreimgsz + 511) / 512 )) +if [[ $basedev = /dev/svnd+([0-9]) ]]; then + # BSD svnd0 mode: protect sector #1 + corestartsec=2 + (( ++coreendsec )) + corepatchofs=$((0x614)) +else + corestartsec=1 + corepatchofs=$((0x414)) +fi # partition offset: at least coreendsec+1 but aligned on a multiple of secs (( partofs = ((coreendsec / secs) + 1) * secs )) (( quiet )) || print Preparing MBR and GRUB2... dd if=/dev/zero of="$T/firsttrack" count=$partofs 2>/dev/null -echo 1 $coreendsec | mksh "$TOPDIR/scripts/bootgrub.mksh" \ +echo $corestartsec $coreendsec | mksh "$TOPDIR/scripts/bootgrub.mksh" \ -A -g $((cyls-cfgfs)):$heads:$secs -M 1:0x83 -O $partofs | \ dd of="$T/firsttrack" conv=notrunc 2>/dev/null -dd if="$T/core.img" of="$T/firsttrack" conv=notrunc seek=1 2>/dev/null +dd if="$T/core.img" of="$T/firsttrack" conv=notrunc seek=$corestartsec \ + 2>/dev/null # set partition where it can find /boot/grub print -n '\0\0\0\0' | \ - dd of="$T/firsttrack" conv=notrunc bs=1 seek=$((0x414)) 2>/dev/null + dd of="$T/firsttrack" conv=notrunc bs=1 seek=$corepatchofs 2>/dev/null # create cfgfs partition (mostly taken from bootgrub.mksh) set -A thecode @@ -283,6 +293,18 @@ print -n "$ostr" | \ (( quiet )) || print Writing MBR and GRUB2 to target device... dd if="$T/firsttrack" of="$tgt" +if [[ $basedev = /dev/svnd+([0-9]) ]]; then + print + fdisk -c $cyls -h $heads -s $secs ${basedev#/dev/} + print + print "This is a BSD vnd(4) device. You MUST now use" + print "\t\$ sudo disklabel -E svnd0" + print "to create a valid BSD disklabel on it. Make" + print "two slices i for the ext2fs partition and j" + print "for the cfgfs partition. Then press Enter." + read dummy +fi + (( quiet )) || print "Creating ext2fs on ${part}..." q= (( quiet )) && q=-q -- cgit v1.2.3