mirror of
https://github.com/xcat2/xNBA.git
synced 2025-02-17 02:58:14 +00:00
[autoboot] Add "netboot" command
Originally-implemented-by: michael-dev@fami-braun.de Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
6fd09b541f
commit
4448285142
@ -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,
|
||||
},
|
||||
};
|
||||
|
@ -14,6 +14,7 @@ struct net_device;
|
||||
|
||||
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 );
|
||||
|
@ -220,7 +220,7 @@ int boot_root_path ( const char *root_path ) {
|
||||
* @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
|
||||
|
Loading…
x
Reference in New Issue
Block a user