From 227ea88bac608b5c4418c883da901b78b7396d08 Mon Sep 17 00:00:00 2001 From: David Johnson Date: Thu, 8 May 2008 22:44:12 +0000 Subject: [PATCH] Support booting an arbitrary disk-based mfs via dongle partitions. --- tmcd/freebsd/cdboot/rc.cdboot | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tmcd/freebsd/cdboot/rc.cdboot b/tmcd/freebsd/cdboot/rc.cdboot index 3dbb9f6fa..5c633dda5 100755 --- a/tmcd/freebsd/cdboot/rc.cdboot +++ b/tmcd/freebsd/cdboot/rc.cdboot @@ -353,6 +353,31 @@ sub doboot() elsif ($mfs =~ /^freebsd.*$/) { goto mfs; } + elsif ($bootwhat =~ /^mfs:localhost:partition:(\d+)$/ || + $bootwhat =~ /^mfs:127\.0\.0\.1:partition:(\d+)$/) { + # + # In this case, we boot from an "alternate" mfs on the Nth + # partition of the default boot media. One mfs per partition. + # + my $part = $1 + 0; + if ($part < 1 || $part > 4) { + print("Invalid local mfs partition $part;" . + " falling back to default MFS boot\n"); + goto mfs; + } + # Boot from the bootloader device, and the specified partition + system("tbbootconfig -d -b 0xfe -k $part -c 0 -m 1 $bootdev"); + if ($?) { + print("Error running tbbootconfig;" . + "falling back to default MFS boot\n"); + goto mfs; + } + system("sync"); + BootNotify(0,"Bootinfo said to boot local partition" . + " $part on default boot device; rebooting."); + system("reboot"); + sleep(10000); + } else { # Default to FreeBSD MFS. goto mfs; -- GitLab