Bladeren bron

[sanboot] Quick and dirty hack to make SAN boot protocols selectable

tags/v0.9.6
Michael Brown 15 jaren geleden
bovenliggende
commit
54c024e0af

+ 3
- 0
src/config/defaults/pcbios.h Bestand weergeven

22
 #define IMAGE_BZIMAGE		/* Linux bzImage image support */
22
 #define IMAGE_BZIMAGE		/* Linux bzImage image support */
23
 #define IMAGE_COMBOOT		/* SYSLINUX COMBOOT image support */
23
 #define IMAGE_COMBOOT		/* SYSLINUX COMBOOT image support */
24
 
24
 
25
+#define	SANBOOT_PROTO_ISCSI	/* iSCSI protocol */
26
+#define	SANBOOT_PROTO_AOE	/* AoE protocol */
27
+
25
 #endif /* CONFIG_DEFAULTS_PCBIOS_H */
28
 #endif /* CONFIG_DEFAULTS_PCBIOS_H */

+ 8
- 0
src/config/general.h Bestand weergeven

37
 #undef	DOWNLOAD_PROTO_SLAM	/* Scalable Local Area Multicast */
37
 #undef	DOWNLOAD_PROTO_SLAM	/* Scalable Local Area Multicast */
38
 #undef	DOWNLOAD_PROTO_FSP	/* FSP? */
38
 #undef	DOWNLOAD_PROTO_FSP	/* FSP? */
39
 
39
 
40
+/*
41
+ * SAN boot protocols
42
+ *
43
+ */
44
+
45
+//#undef	SANBOOT_PROTO_ISCSI	/* iSCSI protocol */
46
+//#undef	SANBOOT_PROTO_AOE	/* AoE protocol */
47
+
40
 /*
48
 /*
41
  * Name resolution modules
49
  * Name resolution modules
42
  *
50
  *

+ 11
- 0
src/core/config.c Bestand weergeven

94
 REQUIRE_OBJECT ( slam );
94
 REQUIRE_OBJECT ( slam );
95
 #endif
95
 #endif
96
 
96
 
97
+/*
98
+ * Drag in all requested SAN boot protocols
99
+ *
100
+ */
101
+#ifdef SANBOOT_PROTO_ISCSI
102
+REQUIRE_OBJECT ( iscsiboot );
103
+#endif
104
+#ifdef SANBOOT_PROTO_AOE
105
+REQUIRE_OBJECT ( aoeboot );
106
+#endif
107
+
97
 /*
108
 /*
98
  * Drag in all requested resolvers
109
  * Drag in all requested resolvers
99
  *
110
  *

+ 14
- 0
src/include/gpxe/sanboot.h Bestand weergeven

1
+#ifndef _GPXE_SANBOOT_H
2
+#define _GPXE_SANBOOT_H
3
+
4
+#include <gpxe/tables.h>
5
+
6
+struct sanboot_protocol {
7
+	const char *prefix;
8
+	int ( * boot ) ( const char *root_path );
9
+};
10
+
11
+#define __sanboot_protocol \
12
+	__table ( struct sanboot_protocol, sanboot_protocols, 01 )
13
+
14
+#endif /* _GPXE_SANBOOT_H */

+ 0
- 6
src/include/usr/aoeboot.h Bestand weergeven

1
-#ifndef _USR_AOEBOOT_H
2
-#define _USR_AOEBOOT_H
3
-
4
-extern int aoeboot ( const char *root_path );
5
-
6
-#endif /* _USR_AOEBOOT_H */

+ 0
- 6
src/include/usr/iscsiboot.h Bestand weergeven

1
-#ifndef _USR_ISCSIBOOT_H
2
-#define _USR_ISCSIBOOT_H
3
-
4
-extern int iscsiboot ( const char *root_path );
5
-
6
-#endif /* _USR_ISCSIBOOT_H */

+ 7
- 2
src/usr/aoeboot.c Bestand weergeven

6
 #include <gpxe/ata.h>
6
 #include <gpxe/ata.h>
7
 #include <gpxe/netdevice.h>
7
 #include <gpxe/netdevice.h>
8
 #include <gpxe/settings.h>
8
 #include <gpxe/settings.h>
9
+#include <gpxe/sanboot.h>
9
 #include <gpxe/abft.h>
10
 #include <gpxe/abft.h>
10
 #include <int13.h>
11
 #include <int13.h>
11
-#include <usr/aoeboot.h>
12
 
12
 
13
 /**
13
 /**
14
  * Guess boot network device
14
  * Guess boot network device
26
 	return NULL;
26
 	return NULL;
27
 }
27
 }
28
 
28
 
29
-int aoeboot ( const char *root_path ) {
29
+static int aoeboot ( const char *root_path ) {
30
 	struct ata_device ata;
30
 	struct ata_device ata;
31
 	struct int13_drive drive;
31
 	struct int13_drive drive;
32
 	int rc;
32
 	int rc;
71
  error_attach:
71
  error_attach:
72
 	return rc;
72
 	return rc;
73
 }
73
 }
74
+
75
+struct sanboot_protocol aoe_sanboot_protocol __sanboot_protocol = {
76
+	.prefix = "aoe:",
77
+	.boot = aoeboot,
78
+};

+ 14
- 6
src/usr/autoboot.c Bestand weergeven

24
 #include <gpxe/settings.h>
24
 #include <gpxe/settings.h>
25
 #include <gpxe/image.h>
25
 #include <gpxe/image.h>
26
 #include <gpxe/embedded.h>
26
 #include <gpxe/embedded.h>
27
+#include <gpxe/sanboot.h>
27
 #include <gpxe/uri.h>
28
 #include <gpxe/uri.h>
28
 #include <usr/ifmgmt.h>
29
 #include <usr/ifmgmt.h>
29
 #include <usr/route.h>
30
 #include <usr/route.h>
30
 #include <usr/dhcpmgmt.h>
31
 #include <usr/dhcpmgmt.h>
31
 #include <usr/imgmgmt.h>
32
 #include <usr/imgmgmt.h>
32
-#include <usr/iscsiboot.h>
33
-#include <usr/aoeboot.h>
34
 #include <usr/autoboot.h>
33
 #include <usr/autoboot.h>
35
 
34
 
36
 /** @file
35
 /** @file
45
 /** Shutdown flags for exit */
44
 /** Shutdown flags for exit */
46
 int shutdown_exit_flags = 0;
45
 int shutdown_exit_flags = 0;
47
 
46
 
47
+/* SAN boot protocols */
48
+static struct sanboot_protocol sanboot_protocols[0] \
49
+	__table_start ( struct sanboot_protocol, sanboot_protocols );
50
+static struct sanboot_protocol sanboot_protocols_end[0] \
51
+	__table_end ( struct sanboot_protocol, sanboot_protocols );
52
+
48
 /**
53
 /**
49
  * Identify the boot network device
54
  * Identify the boot network device
50
  *
55
  *
141
  * @ret rc		Return status code
146
  * @ret rc		Return status code
142
  */
147
  */
143
 int boot_root_path ( const char *root_path ) {
148
 int boot_root_path ( const char *root_path ) {
149
+	struct sanboot_protocol *sanboot;
144
 
150
 
145
 	/* Quick hack */
151
 	/* Quick hack */
146
-	if ( strncmp ( root_path, "iscsi:", 6 ) == 0 ) {
147
-		return iscsiboot ( root_path );
148
-	} else if ( strncmp ( root_path, "aoe:", 4 ) == 0 ) {
149
-		return aoeboot ( root_path );
152
+	for ( sanboot = sanboot_protocols ;
153
+	      sanboot < sanboot_protocols_end ; sanboot++ ) {
154
+		if ( strncmp ( root_path, sanboot->prefix,
155
+			       strlen ( sanboot->prefix ) ) == 0 ) {
156
+			return sanboot->boot ( root_path );
157
+		}
150
 	}
158
 	}
151
 
159
 
152
 	return -ENOTSUP;
160
 	return -ENOTSUP;

+ 7
- 2
src/usr/iscsiboot.c Bestand weergeven

9
 #include <gpxe/netdevice.h>
9
 #include <gpxe/netdevice.h>
10
 #include <gpxe/ibft.h>
10
 #include <gpxe/ibft.h>
11
 #include <gpxe/init.h>
11
 #include <gpxe/init.h>
12
+#include <gpxe/sanboot.h>
12
 #include <int13.h>
13
 #include <int13.h>
13
 #include <usr/autoboot.h>
14
 #include <usr/autoboot.h>
14
-#include <usr/iscsiboot.h>
15
 
15
 
16
 struct setting keep_san_setting __setting = {
16
 struct setting keep_san_setting __setting = {
17
 	.name = "keep-san",
17
 	.name = "keep-san",
36
 	return NULL;
36
 	return NULL;
37
 }
37
 }
38
 
38
 
39
-int iscsiboot ( const char *root_path ) {
39
+static int iscsiboot ( const char *root_path ) {
40
 	struct scsi_device *scsi;
40
 	struct scsi_device *scsi;
41
 	struct int13_drive *drive;
41
 	struct int13_drive *drive;
42
 	int keep_san;
42
 	int keep_san;
100
  err_alloc_scsi:
100
  err_alloc_scsi:
101
 	return rc;
101
 	return rc;
102
 }
102
 }
103
+
104
+struct sanboot_protocol iscsi_sanboot_protocol __sanboot_protocol = {
105
+	.prefix = "iscsi:",
106
+	.boot = iscsiboot,
107
+};

Laden…
Annuleren
Opslaan