#include <stdio.h>
#include <ipxe/command.h>
+#include <ipxe/netdevice.h>
#include <usr/autoboot.h>
FILE_LICENCE ( GPL2_OR_LATER );
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,
+ },
};
extern int shutdown_exit_flags;
+extern int netboot ( struct net_device *netdev );
extern void autoboot ( void );
extern int boot_next_server_and_filename ( struct in_addr next_server,
const char *filename );
* @v netdev Network device
* @ret rc Return status code
*/
-static int netboot ( struct net_device *netdev ) {
+int netboot ( struct net_device *netdev ) {
struct setting vendor_class_id_setting
= { .tag = DHCP_VENDOR_CLASS_ID };
struct setting pxe_discovery_control_setting