소스 검색

[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 15 년 전
부모
커밋
546cc62394
4개의 변경된 파일38개의 추가작업 그리고 0개의 파일을 삭제
  1. 1
    0
      src/arch/i386/Makefile
  2. 33
    0
      src/arch/i386/hci/commands/pxe_cmd.c
  3. 1
    0
      src/config/general.h
  4. 3
    0
      src/core/config.c

+ 1
- 0
src/arch/i386/Makefile 파일 보기

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

+ 33
- 0
src/arch/i386/hci/commands/pxe_cmd.c 파일 보기

@@ -0,0 +1,33 @@
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 파일 보기

@@ -105,6 +105,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
105 105
 #define LOGIN_CMD		/* Login command */
106 106
 #undef	TIME_CMD		/* Time commands */
107 107
 #undef	DIGEST_CMD		/* Image crypto digest commands */
108
+#define	PXE_CMD			/* PXE commands */
108 109
 
109 110
 /*
110 111
  * Obscure configuration options

+ 3
- 0
src/core/config.c 파일 보기

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

Loading…
취소
저장