From 053d28688c3bd8f5c4948528a05b8d4a13d726cc Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Thu, 21 Oct 2010 15:03:42 -0700 Subject: [PATCH] [autoboot] Introduce "skip-san-boot" option For some install-to-SAN scenarios, the OS needs to be able to reboot to reread the partition table. On this second boot attempt, the SAN disk will not be empty and so iPXE will attempt to boot from it, rather than falling back to the OS' installation media. Work around this problem by introducing the "skip-san-boot" option, similar in spirit to "keep-san". Modified-by: Michael Brown Signed-off-by: Michael Brown --- src/include/ipxe/dhcp.h | 12 ++++++++++-- src/usr/autoboot.c | 21 +++++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/include/ipxe/dhcp.h b/src/include/ipxe/dhcp.h index d07da378..aac79b29 100644 --- a/src/include/ipxe/dhcp.h +++ b/src/include/ipxe/dhcp.h @@ -293,11 +293,19 @@ struct dhcp_client_uuid { * * If set to a non-zero value, iPXE will not detach any SAN drive * after failing to boot from it. (This option is required in order - * to perform a Windows Server 2008 installation direct to an iSCSI - * target.) + * to perform an installation direct to an iSCSI target.) */ #define DHCP_EB_KEEP_SAN DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x08 ) +/** Skip booting from SAN drive + * + * If set to a non-zero value, iPXE will skip booting from any SAN + * drive. (This option is sometimes required in conjunction with @c + * DHCP_EB_KEEP_SAN in order to perform an installation direct to an + * iSCSI target.) + */ +#define DHCP_EB_SKIP_SAN_BOOT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x09 ) + /* * Tags in the range 0x10-0x7f are reserved for feature markers * diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c index 3d441167..4e8db60e 100644 --- a/src/usr/autoboot.c +++ b/src/usr/autoboot.c @@ -136,6 +136,14 @@ struct setting keep_san_setting __setting = { .type = &setting_type_int8, }; +/** The "skip-san-boot" setting */ +struct setting skip_san_boot_setting __setting = { + .name = "skip-san-boot", + .description = "Do not boot the SAN drive after connecting", + .tag = DHCP_EB_SKIP_SAN_BOOT, + .type = &setting_type_int8, +}; + /** * Boot using root path * @@ -171,10 +179,15 @@ int boot_root_path ( const char *root_path ) { goto err_describe; } - printf ( "Booting from SAN device %#02x\n", drive ); - rc = san_boot ( drive ); - printf ( "Boot from SAN device %#02x failed: %s\n", - drive, strerror ( rc ) ); + /* Boot from SAN device */ + if ( fetch_intz_setting ( NULL, &skip_san_boot_setting) != 0 ) { + printf ( "Skipping boot from SAN device %#02x\n", drive ); + } else { + printf ( "Booting from SAN device %#02x\n", drive ); + rc = san_boot ( drive ); + printf ( "Boot from SAN device %#02x failed: %s\n", + drive, strerror ( rc ) ); + } /* Leave drive registered, if instructed to do so */ if ( fetch_intz_setting ( NULL, &keep_san_setting ) != 0 ) {