mirror of https://github.com/ipxe/ipxe.git
[autoboot] Add "netboot" command
Originally-implemented-by: michael-dev@fami-braun.de Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1/head
parent
6fd09b541f
commit
4448285142
|
@ -1,5 +1,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ipxe/command.h>
|
#include <ipxe/command.h>
|
||||||
|
#include <ipxe/netdevice.h>
|
||||||
#include <usr/autoboot.h>
|
#include <usr/autoboot.h>
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER );
|
FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
|
@ -21,7 +22,39 @@ static int autoboot_exec ( int argc, char **argv ) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct command autoboot_command __command = {
|
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",
|
.name = "autoboot",
|
||||||
.exec = autoboot_exec,
|
.exec = autoboot_exec,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "netboot",
|
||||||
|
.exec = netboot_exec,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct net_device;
|
||||||
|
|
||||||
extern int shutdown_exit_flags;
|
extern int shutdown_exit_flags;
|
||||||
|
|
||||||
|
extern int netboot ( struct net_device *netdev );
|
||||||
extern void autoboot ( void );
|
extern void autoboot ( void );
|
||||||
extern int boot_next_server_and_filename ( struct in_addr next_server,
|
extern int boot_next_server_and_filename ( struct in_addr next_server,
|
||||||
const char *filename );
|
const char *filename );
|
||||||
|
|
|
@ -220,7 +220,7 @@ int boot_root_path ( const char *root_path ) {
|
||||||
* @v netdev Network device
|
* @v netdev Network device
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int netboot ( struct net_device *netdev ) {
|
int netboot ( struct net_device *netdev ) {
|
||||||
struct setting vendor_class_id_setting
|
struct setting vendor_class_id_setting
|
||||||
= { .tag = DHCP_VENDOR_CLASS_ID };
|
= { .tag = DHCP_VENDOR_CLASS_ID };
|
||||||
struct setting pxe_discovery_control_setting
|
struct setting pxe_discovery_control_setting
|
||||||
|
|
Loading…
Reference in New Issue