mirror of
https://github.com/xcat2/xNBA.git
synced 2024-11-22 17:41:55 +00:00
[sanboot] Quick and dirty hack to make SAN boot protocols selectable
This commit is contained in:
parent
d4e152e766
commit
54c024e0af
@ -22,4 +22,7 @@
|
||||
#define IMAGE_BZIMAGE /* Linux bzImage image support */
|
||||
#define IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */
|
||||
|
||||
#define SANBOOT_PROTO_ISCSI /* iSCSI protocol */
|
||||
#define SANBOOT_PROTO_AOE /* AoE protocol */
|
||||
|
||||
#endif /* CONFIG_DEFAULTS_PCBIOS_H */
|
||||
|
@ -37,6 +37,14 @@
|
||||
#undef DOWNLOAD_PROTO_SLAM /* Scalable Local Area Multicast */
|
||||
#undef DOWNLOAD_PROTO_FSP /* FSP? */
|
||||
|
||||
/*
|
||||
* SAN boot protocols
|
||||
*
|
||||
*/
|
||||
|
||||
//#undef SANBOOT_PROTO_ISCSI /* iSCSI protocol */
|
||||
//#undef SANBOOT_PROTO_AOE /* AoE protocol */
|
||||
|
||||
/*
|
||||
* Name resolution modules
|
||||
*
|
||||
|
@ -94,6 +94,17 @@ REQUIRE_OBJECT ( tftm );
|
||||
REQUIRE_OBJECT ( slam );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Drag in all requested SAN boot protocols
|
||||
*
|
||||
*/
|
||||
#ifdef SANBOOT_PROTO_ISCSI
|
||||
REQUIRE_OBJECT ( iscsiboot );
|
||||
#endif
|
||||
#ifdef SANBOOT_PROTO_AOE
|
||||
REQUIRE_OBJECT ( aoeboot );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Drag in all requested resolvers
|
||||
*
|
||||
|
14
src/include/gpxe/sanboot.h
Normal file
14
src/include/gpxe/sanboot.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef _GPXE_SANBOOT_H
|
||||
#define _GPXE_SANBOOT_H
|
||||
|
||||
#include <gpxe/tables.h>
|
||||
|
||||
struct sanboot_protocol {
|
||||
const char *prefix;
|
||||
int ( * boot ) ( const char *root_path );
|
||||
};
|
||||
|
||||
#define __sanboot_protocol \
|
||||
__table ( struct sanboot_protocol, sanboot_protocols, 01 )
|
||||
|
||||
#endif /* _GPXE_SANBOOT_H */
|
@ -1,6 +0,0 @@
|
||||
#ifndef _USR_AOEBOOT_H
|
||||
#define _USR_AOEBOOT_H
|
||||
|
||||
extern int aoeboot ( const char *root_path );
|
||||
|
||||
#endif /* _USR_AOEBOOT_H */
|
@ -1,6 +0,0 @@
|
||||
#ifndef _USR_ISCSIBOOT_H
|
||||
#define _USR_ISCSIBOOT_H
|
||||
|
||||
extern int iscsiboot ( const char *root_path );
|
||||
|
||||
#endif /* _USR_ISCSIBOOT_H */
|
@ -6,9 +6,9 @@
|
||||
#include <gpxe/ata.h>
|
||||
#include <gpxe/netdevice.h>
|
||||
#include <gpxe/settings.h>
|
||||
#include <gpxe/sanboot.h>
|
||||
#include <gpxe/abft.h>
|
||||
#include <int13.h>
|
||||
#include <usr/aoeboot.h>
|
||||
|
||||
/**
|
||||
* Guess boot network device
|
||||
@ -26,7 +26,7 @@ static struct net_device * guess_boot_netdev ( void ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int aoeboot ( const char *root_path ) {
|
||||
static int aoeboot ( const char *root_path ) {
|
||||
struct ata_device ata;
|
||||
struct int13_drive drive;
|
||||
int rc;
|
||||
@ -71,3 +71,8 @@ int aoeboot ( const char *root_path ) {
|
||||
error_attach:
|
||||
return rc;
|
||||
}
|
||||
|
||||
struct sanboot_protocol aoe_sanboot_protocol __sanboot_protocol = {
|
||||
.prefix = "aoe:",
|
||||
.boot = aoeboot,
|
||||
};
|
||||
|
@ -24,13 +24,12 @@
|
||||
#include <gpxe/settings.h>
|
||||
#include <gpxe/image.h>
|
||||
#include <gpxe/embedded.h>
|
||||
#include <gpxe/sanboot.h>
|
||||
#include <gpxe/uri.h>
|
||||
#include <usr/ifmgmt.h>
|
||||
#include <usr/route.h>
|
||||
#include <usr/dhcpmgmt.h>
|
||||
#include <usr/imgmgmt.h>
|
||||
#include <usr/iscsiboot.h>
|
||||
#include <usr/aoeboot.h>
|
||||
#include <usr/autoboot.h>
|
||||
|
||||
/** @file
|
||||
@ -45,6 +44,12 @@
|
||||
/** Shutdown flags for exit */
|
||||
int shutdown_exit_flags = 0;
|
||||
|
||||
/* SAN boot protocols */
|
||||
static struct sanboot_protocol sanboot_protocols[0] \
|
||||
__table_start ( struct sanboot_protocol, sanboot_protocols );
|
||||
static struct sanboot_protocol sanboot_protocols_end[0] \
|
||||
__table_end ( struct sanboot_protocol, sanboot_protocols );
|
||||
|
||||
/**
|
||||
* Identify the boot network device
|
||||
*
|
||||
@ -141,12 +146,15 @@ static int boot_next_server_and_filename ( struct in_addr next_server,
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int boot_root_path ( const char *root_path ) {
|
||||
struct sanboot_protocol *sanboot;
|
||||
|
||||
/* Quick hack */
|
||||
if ( strncmp ( root_path, "iscsi:", 6 ) == 0 ) {
|
||||
return iscsiboot ( root_path );
|
||||
} else if ( strncmp ( root_path, "aoe:", 4 ) == 0 ) {
|
||||
return aoeboot ( root_path );
|
||||
for ( sanboot = sanboot_protocols ;
|
||||
sanboot < sanboot_protocols_end ; sanboot++ ) {
|
||||
if ( strncmp ( root_path, sanboot->prefix,
|
||||
strlen ( sanboot->prefix ) ) == 0 ) {
|
||||
return sanboot->boot ( root_path );
|
||||
}
|
||||
}
|
||||
|
||||
return -ENOTSUP;
|
||||
|
@ -9,9 +9,9 @@
|
||||
#include <gpxe/netdevice.h>
|
||||
#include <gpxe/ibft.h>
|
||||
#include <gpxe/init.h>
|
||||
#include <gpxe/sanboot.h>
|
||||
#include <int13.h>
|
||||
#include <usr/autoboot.h>
|
||||
#include <usr/iscsiboot.h>
|
||||
|
||||
struct setting keep_san_setting __setting = {
|
||||
.name = "keep-san",
|
||||
@ -36,7 +36,7 @@ static struct net_device * guess_boot_netdev ( void ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int iscsiboot ( const char *root_path ) {
|
||||
static int iscsiboot ( const char *root_path ) {
|
||||
struct scsi_device *scsi;
|
||||
struct int13_drive *drive;
|
||||
int keep_san;
|
||||
@ -100,3 +100,8 @@ int iscsiboot ( const char *root_path ) {
|
||||
err_alloc_scsi:
|
||||
return rc;
|
||||
}
|
||||
|
||||
struct sanboot_protocol iscsi_sanboot_protocol __sanboot_protocol = {
|
||||
.prefix = "iscsi:",
|
||||
.boot = iscsiboot,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user