2007-01-19 01:13:12 +00:00
|
|
|
#include <stdio.h>
|
2010-04-19 20:16:01 +01:00
|
|
|
#include <ipxe/command.h>
|
2010-11-20 17:20:03 +00:00
|
|
|
#include <ipxe/netdevice.h>
|
2007-01-10 02:03:20 +00:00
|
|
|
#include <usr/autoboot.h>
|
2006-12-20 07:04:08 +00:00
|
|
|
|
2009-05-01 15:41:06 +01:00
|
|
|
FILE_LICENCE ( GPL2_OR_LATER );
|
|
|
|
|
|
2007-01-14 00:06:23 +00:00
|
|
|
static int autoboot_exec ( int argc, char **argv ) {
|
2006-12-20 07:04:08 +00:00
|
|
|
|
|
|
|
|
if ( argc != 1 ) {
|
2007-01-10 02:03:20 +00:00
|
|
|
printf ( "Usage:\n"
|
|
|
|
|
" %s\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"Attempts to boot the system\n",
|
|
|
|
|
argv[0] );
|
2006-12-20 07:04:08 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
autoboot();
|
|
|
|
|
|
2007-01-10 02:03:20 +00:00
|
|
|
/* Can never return success by definition */
|
|
|
|
|
return 1;
|
2006-12-20 07:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
2010-11-20 17:20:03 +00:00
|
|
|
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,
|
|
|
|
|
},
|
2006-12-20 07:04:08 +00:00
|
|
|
};
|