mirror of
https://github.com/xcat2/xcat-dep.git
synced 2025-08-28 13:58:15 +00:00
127 lines
3.8 KiB
Diff
127 lines
3.8 KiB
Diff
diff -urN gpxe-1.0.0/src/arch/i386/interface/pcbios/iscsiboot.c gpxe-1.0.0-iscsireg/src/arch/i386/interface/pcbios/iscsiboot.c
|
|
--- gpxe-1.0.0/src/arch/i386/interface/pcbios/iscsiboot.c 2010-02-02 11:12:44.000000000 -0500
|
|
+++ gpxe-1.0.0-iscsireg/src/arch/i386/interface/pcbios/iscsiboot.c 2010-03-11 14:19:05.000000000 -0500
|
|
@@ -11,6 +11,56 @@
|
|
|
|
FILE_LICENCE ( GPL2_OR_LATER );
|
|
|
|
+static int iscsireg ( const char *root_path ) {
|
|
+ struct scsi_device *scsi;
|
|
+ struct int13_drive *drive;
|
|
+ int rc;
|
|
+
|
|
+ scsi = zalloc ( sizeof ( *scsi ) );
|
|
+ if ( ! scsi ) {
|
|
+ rc = -ENOMEM;
|
|
+ goto regerr_alloc_scsi;
|
|
+ }
|
|
+ drive = zalloc ( sizeof ( *drive ) );
|
|
+ if ( ! drive ) {
|
|
+ rc = -ENOMEM;
|
|
+ goto regerr_alloc_drive;
|
|
+ }
|
|
+
|
|
+ printf ( "Configuring iSCSI at %s\n", root_path );
|
|
+
|
|
+ if ( ( rc = iscsi_attach ( scsi, root_path ) ) != 0 ) {
|
|
+ printf ( "Could not attach iSCSI device: %s\n",
|
|
+ strerror ( rc ) );
|
|
+ goto regerr_attach;
|
|
+ }
|
|
+ if ( ( rc = init_scsidev ( scsi ) ) != 0 ) {
|
|
+ printf ( "Could not initialise iSCSI device: %s\n",
|
|
+ strerror ( rc ) );
|
|
+ goto regerr_init;
|
|
+ }
|
|
+
|
|
+ drive->blockdev = &scsi->blockdev;
|
|
+
|
|
+ /* FIXME: ugly, ugly hack */
|
|
+ struct net_device *netdev = last_opened_netdev();
|
|
+ struct iscsi_session *iscsi =
|
|
+ container_of ( scsi->backend, struct iscsi_session, refcnt );
|
|
+ ibft_fill_data ( netdev, iscsi );
|
|
+
|
|
+ register_int13_drive ( drive );
|
|
+ printf ( "Registered as BIOS drive %#02x\n", drive->drive );
|
|
+ return 0;
|
|
+ regerr_init:
|
|
+ iscsi_detach ( scsi );
|
|
+ regerr_attach:
|
|
+ free ( drive );
|
|
+ regerr_alloc_drive:
|
|
+ free ( scsi );
|
|
+ regerr_alloc_scsi:
|
|
+ return rc;
|
|
+}
|
|
+
|
|
static int iscsiboot ( const char *root_path ) {
|
|
struct scsi_device *scsi;
|
|
struct int13_drive *drive;
|
|
@@ -72,4 +122,5 @@
|
|
struct sanboot_protocol iscsi_sanboot_protocol __sanboot_protocol = {
|
|
.prefix = "iscsi:",
|
|
.boot = iscsiboot,
|
|
+ .reg = iscsireg,
|
|
};
|
|
diff -urN gpxe-1.0.0/src/include/gpxe/sanboot.h gpxe-1.0.0-iscsireg/src/include/gpxe/sanboot.h
|
|
--- gpxe-1.0.0/src/include/gpxe/sanboot.h 2010-02-02 11:12:44.000000000 -0500
|
|
+++ gpxe-1.0.0-iscsireg/src/include/gpxe/sanboot.h 2010-03-11 14:19:05.000000000 -0500
|
|
@@ -8,6 +8,7 @@
|
|
struct sanboot_protocol {
|
|
const char *prefix;
|
|
int ( * boot ) ( const char *root_path );
|
|
+ int ( * reg ) ( const char *root_path );
|
|
};
|
|
|
|
#define SANBOOT_PROTOCOLS \
|
|
diff -urN gpxe-1.0.0/src/usr/autoboot.c gpxe-1.0.0-iscsireg/src/usr/autoboot.c
|
|
--- gpxe-1.0.0/src/usr/autoboot.c 2010-02-02 11:12:44.000000000 -0500
|
|
+++ gpxe-1.0.0-iscsireg/src/usr/autoboot.c 2010-03-11 14:19:36.000000000 -0500
|
|
@@ -103,6 +103,25 @@
|
|
}
|
|
|
|
/**
|
|
+ * Register a drive in BIOS, but don't boot
|
|
+ *
|
|
+ * @v root_path Root path
|
|
+ * @ret rc Return status code
|
|
+ */
|
|
+int reg_root_path ( const char *root_path ) {
|
|
+ struct sanboot_protocol *sanboot;
|
|
+
|
|
+ /* Quick hack */
|
|
+ for_each_table_entry ( sanboot, SANBOOT_PROTOCOLS ) {
|
|
+ if ( strncmp ( root_path, sanboot->prefix,
|
|
+ strlen ( sanboot->prefix ) ) == 0 ) {
|
|
+ return sanboot->reg ( root_path );
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return -ENOTSUP;
|
|
+}
|
|
+/**
|
|
* Boot using root path
|
|
*
|
|
* @v root_path Root path
|
|
@@ -136,6 +155,7 @@
|
|
struct setting pxe_boot_menu_setting
|
|
= { .tag = DHCP_PXE_BOOT_MENU };
|
|
char buf[256];
|
|
+ char ruf[256];
|
|
struct in_addr next_server;
|
|
unsigned int pxe_discovery_control;
|
|
int rc;
|
|
@@ -167,6 +187,11 @@
|
|
fetch_ipv4_setting ( NULL, &next_server_setting, &next_server );
|
|
fetch_string_setting ( NULL, &filename_setting, buf, sizeof ( buf ) );
|
|
if ( buf[0] ) {
|
|
+ /* Going to PXE, but set up iBFT if applicable first */
|
|
+ fetch_string_setting(NULL, &root_path_setting,ruf,sizeof(ruf));
|
|
+ if (ruf[0]) {
|
|
+ reg_root_path ( ruf );
|
|
+ }
|
|
printf ( "Booting from filename \"%s\"\n", buf );
|
|
if ( ( rc = boot_next_server_and_filename ( next_server,
|
|
buf ) ) != 0 ) {
|