|
@@ -21,6 +21,7 @@
|
21
|
21
|
#include <ipxe/command.h>
|
22
|
22
|
#include <ipxe/parseopt.h>
|
23
|
23
|
#include <ipxe/netdevice.h>
|
|
24
|
+#include <hci/ifmgmt_cmd.h>
|
24
|
25
|
#include <usr/autoboot.h>
|
25
|
26
|
|
26
|
27
|
FILE_LICENCE ( GPL2_OR_LATER );
|
|
@@ -31,17 +32,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
31
|
32
|
*
|
32
|
33
|
*/
|
33
|
34
|
|
34
|
|
-/** "autoboot" options */
|
35
|
|
-struct autoboot_options {};
|
36
|
|
-
|
37
|
|
-/** "autoboot" option list */
|
38
|
|
-static struct option_descriptor autoboot_opts[] = {};
|
39
|
|
-
|
40
|
35
|
/** "autoboot" command descriptor */
|
41
|
36
|
static struct command_descriptor autoboot_cmd =
|
42
|
|
- COMMAND_DESC ( struct autoboot_options, autoboot_opts, 0, 0,
|
43
|
|
- "",
|
44
|
|
- "Attempt to boot the system" );
|
|
37
|
+ COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
|
|
38
|
+ "[<interface>...]", "Attempt to boot the system" );
|
45
|
39
|
|
46
|
40
|
/**
|
47
|
41
|
* "autoboot" command
|
|
@@ -51,57 +45,7 @@ static struct command_descriptor autoboot_cmd =
|
51
|
45
|
* @ret rc Return status code
|
52
|
46
|
*/
|
53
|
47
|
static int autoboot_exec ( int argc, char **argv ) {
|
54
|
|
- struct autoboot_options opts;
|
55
|
|
- int rc;
|
56
|
|
-
|
57
|
|
- /* Parse options */
|
58
|
|
- if ( ( rc = parse_options ( argc, argv, &autoboot_cmd, &opts ) ) != 0 )
|
59
|
|
- return rc;
|
60
|
|
-
|
61
|
|
- /* Try to boot */
|
62
|
|
- if ( ( rc = autoboot() ) != 0 )
|
63
|
|
- return rc;
|
64
|
|
-
|
65
|
|
- return 0;
|
66
|
|
-}
|
67
|
|
-
|
68
|
|
-/** "netboot" options */
|
69
|
|
-struct netboot_options {};
|
70
|
|
-
|
71
|
|
-/** "netboot" option list */
|
72
|
|
-static struct option_descriptor netboot_opts[] = {};
|
73
|
|
-
|
74
|
|
-/** "netboot" command descriptor */
|
75
|
|
-static struct command_descriptor netboot_cmd =
|
76
|
|
- COMMAND_DESC ( struct netboot_options, netboot_opts, 1, 1,
|
77
|
|
- "<interface>",
|
78
|
|
- "Attempt to boot the system from <interface>" );
|
79
|
|
-
|
80
|
|
-/**
|
81
|
|
- * "netboot" command
|
82
|
|
- *
|
83
|
|
- * @v argc Argument count
|
84
|
|
- * @v argv Argument list
|
85
|
|
- * @ret rc Return status code
|
86
|
|
- */
|
87
|
|
-static int netboot_exec ( int argc, char **argv ) {
|
88
|
|
- struct netboot_options opts;
|
89
|
|
- struct net_device *netdev;
|
90
|
|
- int rc;
|
91
|
|
-
|
92
|
|
- /* Parse options */
|
93
|
|
- if ( ( rc = parse_options ( argc, argv, &netboot_cmd, &opts ) ) != 0 )
|
94
|
|
- return rc;
|
95
|
|
-
|
96
|
|
- /* Parse interface */
|
97
|
|
- if ( ( rc = parse_netdev ( argv[optind], &netdev ) ) != 0 )
|
98
|
|
- return rc;
|
99
|
|
-
|
100
|
|
- /* Try to boot */
|
101
|
|
- if ( ( rc = netboot ( netdev ) ) != 0 )
|
102
|
|
- return rc;
|
103
|
|
-
|
104
|
|
- return 0;
|
|
48
|
+ return ifcommon_exec ( argc, argv, &autoboot_cmd, netboot, 0 );
|
105
|
49
|
}
|
106
|
50
|
|
107
|
51
|
/** Booting commands */
|
|
@@ -110,8 +54,4 @@ struct command autoboot_commands[] __command = {
|
110
|
54
|
.name = "autoboot",
|
111
|
55
|
.exec = autoboot_exec,
|
112
|
56
|
},
|
113
|
|
- {
|
114
|
|
- .name = "netboot",
|
115
|
|
- .exec = netboot_exec,
|
116
|
|
- },
|
117
|
57
|
};
|