[gPXE] [PATCH 2/2] introduce 'boot-san' option

Dave Hansen dave at sr71.net
Fri Oct 15 19:05:55 EDT 2010


I've had a problem with some Windows SAN installs.  The Windows
installer needs for gpxe to boot, register the SAN device, then
fall back to the CD-ROM (or USB drive) to start the install.

If you start with a completely blank SAN disk, this works fine.
The sanboot fails.  But, with some devices, Windows can't update
its partition table during the install.  It writes it, then
does a reboot so it can re-read it.  That's where the problem
starts.

I evidently have a dumb BIOS, or something.  After Windows writes
just about any old gunk to the partition table, my BIOS tries to
boot it.  So, instead of sanboot failing (like it should), it
boots the disk and freezes instead of reloading the installer.

The only way I've seen around this is to hack the san booting out
of gpxe.  This provides a mechanism for me to actually perform
the installs without hacking my copy of gpxe every time.
---
 src/arch/i386/interface/pcbios/keepsan.c |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/arch/i386/interface/pcbios/keepsan.c b/src/arch/i386/interface/pcbios/keepsan.c
index 22ba4b5..ce80e26 100644
--- a/src/arch/i386/interface/pcbios/keepsan.c
+++ b/src/arch/i386/interface/pcbios/keepsan.c
@@ -26,6 +26,24 @@ static int keep_san ( void ) {
 	return 1;
 }
 
+struct setting boot_san_setting __setting = {
+	.name = "boot-san",
+	.description = "Boot the SAN drive after connecting",
+	.type = &setting_type_int8,
+};
+
+static int boot_san ( void ) {
+	int setting_len;
+	long boot_san;
+
+	setting_len = fetch_int_setting ( NULL, &boot_san_setting, &boot_san );
+	if ( setting_len )
+		return boot_san;
+
+	/* If the option is unset, preserve compatability, boot */
+	return 1;
+}
+
 /**
  * Register an INT 13 drive with the BIOS, and possibly boot it
  *
@@ -36,13 +54,15 @@ static int keep_san ( void ) {
  * this function will never return.
  */
 int register_and_boot_drive ( struct int13_drive *drive ) {
-	int rc;
+	int rc = 0;
 
 	register_int13_drive ( drive );
 	printf ( "Registered as BIOS drive %#02x\n", drive->drive );
-	printf ( "Booting from BIOS drive %#02x\n", drive->drive );
-	rc = int13_boot ( drive->drive );
-	printf ( "Boot failed\n" );
+	if ( boot_san() ) {
+		printf ( "Booting from BIOS drive %#02x\n", drive->drive );
+		rc = int13_boot ( drive->drive );
+		printf ( "Boot failed\n" );
+	}
 
 	/* Leave drive registered, if instructed to do so */
 	if ( !keep_san() ) {
-- 
1.7.1.rc2



More information about the gPXE mailing list