diff options
author | Michael Brown <mcb30@ipxe.org> | 2010-11-20 17:20:03 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2010-11-20 17:20:03 +0000 |
commit | 44482851427e26ba6f77485064ef7217b632daac (patch) | |
tree | 09103b15661deba88b6d926867404c0487d0122f /src/hci/commands/autoboot_cmd.c | |
parent | 6fd09b541fbc426057661c7e0da4f39000b6803e (diff) | |
download | ipxe-44482851427e26ba6f77485064ef7217b632daac.tar.gz |
[autoboot] Add "netboot" command
Originally-implemented-by: michael-dev@fami-braun.de
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci/commands/autoboot_cmd.c')
-rw-r--r-- | src/hci/commands/autoboot_cmd.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/hci/commands/autoboot_cmd.c b/src/hci/commands/autoboot_cmd.c index 51ba6f1fd..17bd6bcfc 100644 --- a/src/hci/commands/autoboot_cmd.c +++ b/src/hci/commands/autoboot_cmd.c @@ -1,5 +1,6 @@ #include <stdio.h> #include <ipxe/command.h> +#include <ipxe/netdevice.h> #include <usr/autoboot.h> FILE_LICENCE ( GPL2_OR_LATER ); @@ -21,7 +22,39 @@ static int autoboot_exec ( int argc, char **argv ) { return 1; } -struct command autoboot_command __command = { - .name = "autoboot", - .exec = autoboot_exec, +static int netboot_exec ( int argc, char **argv ) { + const char *netdev_name; + struct net_device *netdev; + + if ( argc != 2 ) { + printf ( "Usage:\n" + " %s <interface>\n" + "\n" + "Attempts to boot the system from <interface>\n", + argv[0] ); + return 1; + } + netdev_name = argv[1]; + + netdev = find_netdev ( netdev_name ); + if ( ! netdev ) { + printf ( "%s: no such interface\n", netdev_name ); + return 1; + } + + netboot ( netdev ); + + /* Can never return success by definition */ + return 1; +} + +struct command autoboot_commands[] __command = { + { + .name = "autoboot", + .exec = autoboot_exec, + }, + { + .name = "netboot", + .exec = netboot_exec, + }, }; |