Skip to content

Commit

Permalink
[pxe] Add startpxe and stoppxe commands
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Michael Brown committed Jun 28, 2009
1 parent 76c915d commit 546cc62
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/arch/i386/Makefile
Expand Up @@ -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.
Expand Down
33 changes: 33 additions & 0 deletions 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,
},
};
1 change: 1 addition & 0 deletions src/config/general.h
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/core/config.c
Expand Up @@ -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
Expand Down

0 comments on commit 546cc62

Please sign in to comment.