2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-21 17:11:45 +00:00

-Fix iSCSI in xNBA 1.0.0

Former-commit-id: 8e5650a6b919c106759d702af507b8267fed613e
This commit is contained in:
jbjohnso 2010-03-11 19:22:27 +00:00
parent 7ab2b134ea
commit 3a598f085f
3 changed files with 130 additions and 4 deletions

View File

@ -0,0 +1,126 @@
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 ) {

View File

@ -1,6 +1,6 @@
Name: xnba-kvm
Version: 1.0.0
Release: 2
Release: 3
Summary: xNBA loader for virtual guests
Obsoletes: etherboot-zroms-kvm
Provides: etherboot-zroms-kvm
@ -21,7 +21,7 @@ ExclusiveArch: i386 x86_64
Source0: gpxe-%{version}.tar.bz2
Patch0: gpxe-0.9.7-branding.patch
Patch1: gpxe-0.9.9-registeriscsionpxe.patch
Patch1: gpxe-1.0.0-registeriscsionpxe.patch
Patch2: gpxe-1.0.0-config.patch
Patch3: gpxe-0.9.7-ignorepackets.patch
Patch4: gpxe-0.9.7-kvmworkaround.patch

View File

@ -1,6 +1,6 @@
Name: xnba-undi
Version: 1.0.0
Release: 2
Release: 3
Summary: xCAT Network Boot Agent for x86 PXE hosts
Obsoletes: gpxe-undi
@ -17,7 +17,7 @@ BuildArch: noarch
Source0: gpxe-%{version}.tar.bz2
Patch0: gpxe-0.9.7-branding.patch
Patch1: gpxe-0.9.9-registeriscsionpxe.patch
Patch1: gpxe-1.0.0-registeriscsionpxe.patch
Patch2: gpxe-1.0.0-config.patch
Patch3: gpxe-0.9.7-ignorepackets.patch
Patch4: gpxe-0.9.7-kvmworkaround.patch