From c8a7285bc6af6c180138dfbbf42521de0eba4cf7 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 11 Nov 2010 19:59:07 +0000 Subject: [PATCH] -iPXE refresh of the 'iscsi' patch, now with generic sanboot goodness Former-commit-id: 9de8ae2da476058b6db907b0e41a00c554be392f --- gpxe/ipxe-registersan.patch | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 gpxe/ipxe-registersan.patch diff --git a/gpxe/ipxe-registersan.patch b/gpxe/ipxe-registersan.patch new file mode 100644 index 0000000..bebe120 --- /dev/null +++ b/gpxe/ipxe-registersan.patch @@ -0,0 +1,53 @@ +diff -urN ipxe/src/usr/autoboot.c ipxe-registersan/src/usr/autoboot.c +--- ipxe/src/usr/autoboot.c 2010-11-11 14:09:48.142334824 -0500 ++++ ipxe-registersan/src/usr/autoboot.c 2010-11-11 14:52:39.403583954 -0500 +@@ -150,6 +150,37 @@ + * @v root_path Root path + * @ret rc Return status code + */ ++int reg_root_path ( const char *root_path ) { ++ struct uri *uri; ++ int drive; ++ int rc; ++ ++ /* Parse URI */ ++ uri = parse_uri ( root_path ); ++ if ( ! uri ) { ++ return 0; // Not necessarily an error in this case, since this is PXE and FreeBSD may have it's own thing to say, as an example ++ } ++ if ( ( drive = san_hook ( uri, 0 ) ) < 0 ) { ++ rc = drive; ++ printf ( "Could not open SAN device: %s\n", ++ strerror ( rc ) ); ++ uri_put ( uri ); ++ return 0; ++ } ++ printf ( "Registered as SAN device %#02x\n", drive ); ++ /* Describe SAN device */ ++ if ( ( rc = san_describe ( drive ) ) != 0 ) { ++ printf ( "Could not describe SAN device %#02x: %s\n", ++ drive, strerror ( rc ) ); ++ uri_put(uri); ++ return 0; ++ } ++ //If still in function, we registered fine. ++ //Unclear whether uri should have it's refcnt decremented in this case ++ //in boot_root_path, it would not be, so matching that behavior for now ++ return rc; ++ ++} + int boot_root_path ( const char *root_path ) { + struct uri *uri; + int drive; +@@ -259,6 +290,11 @@ + fetch_ipv4_setting ( NULL, &next_server_setting, &next_server ); + fetch_string_setting ( NULL, &filename_setting, buf, sizeof ( buf ) ); + if ( buf[0] ) { ++ fetch_string_setting ( NULL, &root_path_setting, buf, sizeof ( buf ) ); ++ if ( buf[0] ) { ++ printf ( "SAN registering from root path \"%s\"\n", buf ); ++ reg_root_path ( buf ); ++ } + printf ( "Booting from filename \"%s\"\n", buf ); + return boot_next_server_and_filename ( next_server, buf ); + }