From 2140694397c262c79ede4b6e3bb08bc2e5f82865 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Sat, 20 Nov 2010 22:19:06 +0000 Subject: convert to UUID; make panic-reboot-time a flag; prevent automatic fsck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit note: uuid.patch currently still panics ☹ Signed-off-by: Thorsten Glaser --- scripts/install.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/install.sh b/scripts/install.sh index c7ab63eaa..7ade75c68 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -73,22 +73,28 @@ cfgfs=1 quiet=0 serial=0 speed=115200 +panicreboot=10 function usage { cat >&2 < 5 )); then print -u2 "$me: -c $OPTARG out of bounds" exit 1 fi ;; (h) usage 0 ;; + (p) if (( (panicreboot = OPTARG) < 0 || panicreboot > 300 )); then + print -u2 "$me: -p $OPTARG out of bounds" + exit 1 + fi ;; (q) quiet=1 ;; (+q) quiet=0 ;; (s) if [[ $OPTARG != @(96|192|384|576|1152)00 ]]; then @@ -281,7 +287,8 @@ dd if="$T/firsttrack" of="$tgt" q= (( quiet )) && q=-q mke2fs $q "$part" -#partuuid=$(tune2fs -l /dev/sd0i | sed -n '/^Filesystem UUID:[ ]*/s///p') +partuuid=$(tune2fs -l "$part" | sed -n '/^Filesystem UUID:[ ]*/s///p') +tune2fs -c 0 -i 0 "$part" (( quiet )) || print Extracting installation archive... mount_ext2fs "$part" "$T" @@ -311,8 +318,9 @@ mkdir -p boot/grub fi print print 'menuentry "GNU/Linux (OpenADK)" {' -# print "\tlinux /boot/vmlinuz-adk root=UUID=$partuuid $consargs panic=10" - print "\tlinux /boot/vmlinuz-adk $consargs panic=10" + linuxargs="root=UUID=$partuuid $consargs" + (( panicreboot )) && linuxargs="$linuxargs panic=$panicreboot" + print "\tlinux /boot/vmlinuz-adk $linuxargs" print '}' ) >boot/grub/grub.cfg set -A grubfiles -- cgit v1.2.3 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') 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 From 60f67d3883bc11f93419a97a7ae1d5103ca7efc2 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Sun, 21 Nov 2010 16:45:25 +0000 Subject: automate BSD disklabel creation; display UUID at end of the script Signed-off-by: Thorsten Glaser --- scripts/install.sh | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/install.sh b/scripts/install.sh index b8f21a0c6..ab9c4f2cf 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -294,15 +294,37 @@ print -n "$ostr" | \ 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 + (( quiet )) || print "Creating BSD disklabel on target device..." + # c: whole device (must be so) + # i: ext2fs (matching first partition) + # j: cfgfs (matching second partition) + # p: MBR and GRUB2 area (by tradition) + cat >"$T/bsdlabel" <<-EOF + type: vnd + disk: vnd device + label: OpenADK + flags: + bytes/sector: 512 + sectors/track: $secs + tracks/cylinder: $heads + sectors/cylinder: $((heads * secs)) + cylinders: $cyls + total sectors: $((cyls * heads * secs)) + rpm: 3600 + interleave: 1 + trackskew: 0 + cylinderskew: 0 + headswitch: 0 + track-to-track seek: 0 + drivedata: 0 + + 16 partitions: + c: $((cyls * heads * secs)) 0 unused + i: $(((cyls - cfgfs) * heads * secs - partofs)) $partofs ext2fs + j: $((cfgfs * heads * secs)) $(((cyls - cfgfs) * heads * secs)) unknown + p: $partofs 0 unknown +EOF + disklabel -R ${basedev#/dev/} "$T/bsdlabel" fi (( quiet )) || print "Creating ext2fs on ${part}..." @@ -355,5 +377,7 @@ cp "${grubfiles[@]}" boot/grub/ cd "$TOPDIR" umount "$T" +(( quiet )) || print "\nNote: the rootfs UUID is: $partuuid" + rm -rf "$T" exit 0 -- cgit v1.2.3