浏览代码

[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 14 年前
父节点
当前提交
053d28688c
共有 2 个文件被更改,包括 27 次插入6 次删除
  1. 10
    2
      src/include/ipxe/dhcp.h
  2. 17
    4
      src/usr/autoboot.c

+ 10
- 2
src/include/ipxe/dhcp.h 查看文件

293
  *
293
  *
294
  * If set to a non-zero value, iPXE will not detach any SAN drive
294
  * If set to a non-zero value, iPXE will not detach any SAN drive
295
  * after failing to boot from it.  (This option is required in order
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
 #define DHCP_EB_KEEP_SAN DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x08 )
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
  * Tags in the range 0x10-0x7f are reserved for feature markers
310
  * Tags in the range 0x10-0x7f are reserved for feature markers
303
  *
311
  *

+ 17
- 4
src/usr/autoboot.c 查看文件

136
 	.type = &setting_type_int8,
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
  * Boot using root path
148
  * Boot using root path
141
  *
149
  *
171
 		goto err_describe;
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
 	/* Leave drive registered, if instructed to do so */
192
 	/* Leave drive registered, if instructed to do so */
180
 	if ( fetch_intz_setting ( NULL, &keep_san_setting ) != 0 ) {
193
 	if ( fetch_intz_setting ( NULL, &keep_san_setting ) != 0 ) {

正在加载...
取消
保存