Pārlūkot izejas kodu

[pxe] Add startpxe and stoppxe commands

These commands can be used to activate or deactivate the PXE API (on a
specifiable network interface).

This is currently of limited use, since most image formats will call
shutdown() before booting the image, meaning that the underlying net
device gets shut down during remove_devices() anyway.
tags/v0.9.8
Michael Brown 16 gadus atpakaļ
vecāks
revīzija
546cc62394

+ 1
- 0
src/arch/i386/Makefile Parādīt failu

81
 SRCDIRS		+= arch/i386/interface/pcbios
81
 SRCDIRS		+= arch/i386/interface/pcbios
82
 SRCDIRS		+= arch/i386/interface/pxe
82
 SRCDIRS		+= arch/i386/interface/pxe
83
 SRCDIRS 	+= arch/i386/interface/syslinux
83
 SRCDIRS 	+= arch/i386/interface/syslinux
84
+SRCDIRS		+= arch/i386/hci/commands
84
 
85
 
85
 # The various xxx_loader.c files are #included into core/loader.c and
86
 # The various xxx_loader.c files are #included into core/loader.c and
86
 # should not be compiled directly.
87
 # should not be compiled directly.

+ 33
- 0
src/arch/i386/hci/commands/pxe_cmd.c Parādīt failu

1
+#include <gpxe/netdevice.h>
2
+#include <gpxe/command.h>
3
+#include <hci/ifmgmt_cmd.h>
4
+#include <pxe_call.h>
5
+
6
+FILE_LICENCE ( GPL2_OR_LATER );
7
+
8
+static int startpxe_payload ( struct net_device *netdev ) {
9
+	if ( netdev->state & NETDEV_OPEN )
10
+		pxe_activate ( netdev );
11
+	return 0;
12
+}
13
+
14
+static int startpxe_exec ( int argc, char **argv ) {
15
+	return ifcommon_exec ( argc, argv, startpxe_payload,
16
+			       "Activate PXE on" );
17
+}
18
+
19
+static int stoppxe_exec ( int argc __unused, char **argv __unused ) {
20
+	pxe_deactivate();
21
+	return 0;
22
+}
23
+
24
+struct command pxe_commands[] __command = {
25
+	{
26
+		.name = "startpxe",
27
+		.exec = startpxe_exec,
28
+	},
29
+	{
30
+		.name = "stoppxe",
31
+		.exec = stoppxe_exec,
32
+	},
33
+};

+ 1
- 0
src/config/general.h Parādīt failu

105
 #define LOGIN_CMD		/* Login command */
105
 #define LOGIN_CMD		/* Login command */
106
 #undef	TIME_CMD		/* Time commands */
106
 #undef	TIME_CMD		/* Time commands */
107
 #undef	DIGEST_CMD		/* Image crypto digest commands */
107
 #undef	DIGEST_CMD		/* Image crypto digest commands */
108
+#define	PXE_CMD			/* PXE commands */
108
 
109
 
109
 /*
110
 /*
110
  * Obscure configuration options
111
  * Obscure configuration options

+ 3
- 0
src/core/config.c Parādīt failu

204
 #ifdef DIGEST_CMD
204
 #ifdef DIGEST_CMD
205
 REQUIRE_OBJECT ( digest_cmd );
205
 REQUIRE_OBJECT ( digest_cmd );
206
 #endif
206
 #endif
207
+#ifdef PXE_CMD
208
+REQUIRE_OBJECT ( pxe_cmd );
209
+#endif
207
 
210
 
208
 /*
211
 /*
209
  * Drag in miscellaneous objects
212
  * Drag in miscellaneous objects

Notiek ielāde…
Atcelt
Saglabāt