]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[pxe] Add startpxe and stoppxe commands
authorMichael Brown <mcb30@etherboot.org>
Sun, 28 Jun 2009 19:50:23 +0000 (20:50 +0100)
committerMichael Brown <mcb30@etherboot.org>
Sun, 28 Jun 2009 19:50:23 +0000 (20:50 +0100)
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.

src/arch/i386/Makefile
src/arch/i386/hci/commands/pxe_cmd.c [new file with mode: 0644]
src/config/general.h
src/core/config.c

index 1ca77347fa21054a509e0a76c92badad61ea18ad..8f6c97e6116e0180a7e0e025ded3f5de8fa68ac4 100644 (file)
@@ -81,6 +81,7 @@ SRCDIRS               += arch/i386/drivers/net
 SRCDIRS                += arch/i386/interface/pcbios
 SRCDIRS                += arch/i386/interface/pxe
 SRCDIRS        += arch/i386/interface/syslinux
+SRCDIRS                += arch/i386/hci/commands
 
 # The various xxx_loader.c files are #included into core/loader.c and
 # should not be compiled directly.
diff --git a/src/arch/i386/hci/commands/pxe_cmd.c b/src/arch/i386/hci/commands/pxe_cmd.c
new file mode 100644 (file)
index 0000000..b5df2d1
--- /dev/null
@@ -0,0 +1,33 @@
+#include <gpxe/netdevice.h>
+#include <gpxe/command.h>
+#include <hci/ifmgmt_cmd.h>
+#include <pxe_call.h>
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+static int startpxe_payload ( struct net_device *netdev ) {
+       if ( netdev->state & NETDEV_OPEN )
+               pxe_activate ( netdev );
+       return 0;
+}
+
+static int startpxe_exec ( int argc, char **argv ) {
+       return ifcommon_exec ( argc, argv, startpxe_payload,
+                              "Activate PXE on" );
+}
+
+static int stoppxe_exec ( int argc __unused, char **argv __unused ) {
+       pxe_deactivate();
+       return 0;
+}
+
+struct command pxe_commands[] __command = {
+       {
+               .name = "startpxe",
+               .exec = startpxe_exec,
+       },
+       {
+               .name = "stoppxe",
+               .exec = stoppxe_exec,
+       },
+};
index dfc87007c6aeca5143dab38bcc2177477b5bf0bd..170ad33a019643b13de7988e8ac405a2895c2041 100644 (file)
@@ -105,6 +105,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #define LOGIN_CMD              /* Login command */
 #undef TIME_CMD                /* Time commands */
 #undef DIGEST_CMD              /* Image crypto digest commands */
+#define        PXE_CMD                 /* PXE commands */
 
 /*
  * Obscure configuration options
index ecaf781fc3738c4df951cbf9940d91243c194c15..4562e3a49b90d0b72165cb98349b242ca03907d2 100644 (file)
@@ -204,6 +204,9 @@ REQUIRE_OBJECT ( time_cmd );
 #ifdef DIGEST_CMD
 REQUIRE_OBJECT ( digest_cmd );
 #endif
+#ifdef PXE_CMD
+REQUIRE_OBJECT ( pxe_cmd );
+#endif
 
 /*
  * Drag in miscellaneous objects