diff options
author | Michael Brown <mcb30@etherboot.org> | 2009-06-28 20:50:23 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2009-06-28 20:50:23 +0100 |
commit | 546cc62394e12aa04eb16da8a47edd7d93869023 (patch) | |
tree | e44baa3af9d1977f5d0646c57e6ffca05726c03b | |
parent | 76c915d5bdfc9873ca4d05cad80b3c6e260c500e (diff) | |
download | ipxe-546cc62394e12aa04eb16da8a47edd7d93869023.tar.gz |
[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.
-rw-r--r-- | src/arch/i386/Makefile | 1 | ||||
-rw-r--r-- | src/arch/i386/hci/commands/pxe_cmd.c | 33 | ||||
-rw-r--r-- | src/config/general.h | 1 | ||||
-rw-r--r-- | src/core/config.c | 3 |
4 files changed, 38 insertions, 0 deletions
diff --git a/src/arch/i386/Makefile b/src/arch/i386/Makefile index 1ca77347f..8f6c97e61 100644 --- a/src/arch/i386/Makefile +++ b/src/arch/i386/Makefile @@ -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 index 000000000..b5df2d1b0 --- /dev/null +++ b/src/arch/i386/hci/commands/pxe_cmd.c @@ -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, + }, +}; diff --git a/src/config/general.h b/src/config/general.h index dfc87007c..170ad33a0 100644 --- a/src/config/general.h +++ b/src/config/general.h @@ -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 diff --git a/src/core/config.c b/src/core/config.c index ecaf781fc..4562e3a49 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -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 |