Browse Source

[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 <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Dave Hansen 13 years ago
parent
commit
053d28688c
2 changed files with 27 additions and 6 deletions
  1. 10
    2
      src/include/ipxe/dhcp.h
  2. 17
    4
      src/usr/autoboot.c

+ 10
- 2
src/include/ipxe/dhcp.h View File

@@ -293,11 +293,19 @@ struct dhcp_client_uuid {
293 293
  *
294 294
  * If set to a non-zero value, iPXE will not detach any SAN drive
295 295
  * after failing to boot from it.  (This option is required in order
296
- * to perform a Windows Server 2008 installation direct to an iSCSI
297
- * target.)
296
+ * to perform an installation direct to an iSCSI target.)
298 297
  */
299 298
 #define DHCP_EB_KEEP_SAN DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x08 )
300 299
 
300
+/** Skip booting from SAN drive
301
+ *
302
+ * If set to a non-zero value, iPXE will skip booting from any SAN
303
+ * drive.  (This option is sometimes required in conjunction with @c
304
+ * DHCP_EB_KEEP_SAN in order to perform an installation direct to an
305
+ * iSCSI target.)
306
+ */
307
+#define DHCP_EB_SKIP_SAN_BOOT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x09 )
308
+
301 309
 /*
302 310
  * Tags in the range 0x10-0x7f are reserved for feature markers
303 311
  *

+ 17
- 4
src/usr/autoboot.c View File

@@ -136,6 +136,14 @@ struct setting keep_san_setting __setting = {
136 136
 	.type = &setting_type_int8,
137 137
 };
138 138
 
139
+/** The "skip-san-boot" setting */
140
+struct setting skip_san_boot_setting __setting = {
141
+	.name = "skip-san-boot",
142
+	.description = "Do not boot the SAN drive after connecting",
143
+	.tag = DHCP_EB_SKIP_SAN_BOOT,
144
+	.type = &setting_type_int8,
145
+};
146
+
139 147
 /**
140 148
  * Boot using root path
141 149
  *
@@ -171,10 +179,15 @@ int boot_root_path ( const char *root_path ) {
171 179
 		goto err_describe;
172 180
 	}
173 181
 
174
-	printf ( "Booting from SAN device %#02x\n", drive );
175
-	rc = san_boot ( drive );
176
-	printf ( "Boot from SAN device %#02x failed: %s\n",
177
-		 drive, strerror ( rc ) );
182
+	/* Boot from SAN device */
183
+	if ( fetch_intz_setting ( NULL, &skip_san_boot_setting) != 0 ) {
184
+		printf ( "Skipping boot from SAN device %#02x\n", drive );
185
+	} else {
186
+		printf ( "Booting from SAN device %#02x\n", drive );
187
+		rc = san_boot ( drive );
188
+		printf ( "Boot from SAN device %#02x failed: %s\n",
189
+			 drive, strerror ( rc ) );
190
+	}
178 191
 
179 192
 	/* Leave drive registered, if instructed to do so */
180 193
 	if ( fetch_intz_setting ( NULL, &keep_san_setting ) != 0 ) {

Loading…
Cancel
Save