|
@@ -1,5 +1,6 @@
|
1
|
1
|
#include <stdio.h>
|
2
|
2
|
#include <ipxe/command.h>
|
|
3
|
+#include <ipxe/netdevice.h>
|
3
|
4
|
#include <usr/autoboot.h>
|
4
|
5
|
|
5
|
6
|
FILE_LICENCE ( GPL2_OR_LATER );
|
|
@@ -21,7 +22,39 @@ static int autoboot_exec ( int argc, char **argv ) {
|
21
|
22
|
return 1;
|
22
|
23
|
}
|
23
|
24
|
|
24
|
|
-struct command autoboot_command __command = {
|
25
|
|
- .name = "autoboot",
|
26
|
|
- .exec = autoboot_exec,
|
|
25
|
+static int netboot_exec ( int argc, char **argv ) {
|
|
26
|
+ const char *netdev_name;
|
|
27
|
+ struct net_device *netdev;
|
|
28
|
+
|
|
29
|
+ if ( argc != 2 ) {
|
|
30
|
+ printf ( "Usage:\n"
|
|
31
|
+ " %s <interface>\n"
|
|
32
|
+ "\n"
|
|
33
|
+ "Attempts to boot the system from <interface>\n",
|
|
34
|
+ argv[0] );
|
|
35
|
+ return 1;
|
|
36
|
+ }
|
|
37
|
+ netdev_name = argv[1];
|
|
38
|
+
|
|
39
|
+ netdev = find_netdev ( netdev_name );
|
|
40
|
+ if ( ! netdev ) {
|
|
41
|
+ printf ( "%s: no such interface\n", netdev_name );
|
|
42
|
+ return 1;
|
|
43
|
+ }
|
|
44
|
+
|
|
45
|
+ netboot ( netdev );
|
|
46
|
+
|
|
47
|
+ /* Can never return success by definition */
|
|
48
|
+ return 1;
|
|
49
|
+}
|
|
50
|
+
|
|
51
|
+struct command autoboot_commands[] __command = {
|
|
52
|
+ {
|
|
53
|
+ .name = "autoboot",
|
|
54
|
+ .exec = autoboot_exec,
|
|
55
|
+ },
|
|
56
|
+ {
|
|
57
|
+ .name = "netboot",
|
|
58
|
+ .exec = netboot_exec,
|
|
59
|
+ },
|
27
|
60
|
};
|