浏览代码

Add "config" command to access config UI

tags/v0.9.3
Michael Brown 18 年前
父节点
当前提交
8f9336e0c1
共有 4 个文件被更改,包括 53 次插入0 次删除
  1. 1
    0
      src/config.h
  2. 3
    0
      src/core/config.c
  3. 35
    0
      src/hci/commands/config_cmd.c
  4. 14
    0
      src/include/gpxe/settings_ui.h

+ 1
- 0
src/config.h 查看文件

@@ -116,6 +116,7 @@
116 116
  *
117 117
  */
118 118
 #define	NVO_CMD			/* Non-volatile option storage commands */
119
+#define CONFIG_CMD		/* Option configuration console */
119 120
 
120 121
 /* @END general.h */ 
121 122
 

+ 3
- 0
src/core/config.c 查看文件

@@ -146,6 +146,9 @@ REQUIRE_OBJECT ( pxe );
146 146
 #ifdef NVO_CMD
147 147
 REQUIRE_OBJECT ( nvo_cmd );
148 148
 #endif
149
+#ifdef CONFIG_CMD
150
+REQUIRE_OBJECT ( config_cmd );
151
+#endif
149 152
 
150 153
 /*
151 154
  * Drag in miscellaneous objects

+ 35
- 0
src/hci/commands/config_cmd.c 查看文件

@@ -0,0 +1,35 @@
1
+#include <string.h>
2
+#include <vsprintf.h>
3
+#include <gpxe/command.h>
4
+#include <gpxe/settings.h>
5
+#include <gpxe/settings_ui.h>
6
+
7
+
8
+#include <gpxe/nvo.h>
9
+extern struct nvo_block *ugly_nvo_hack;
10
+
11
+
12
+static int config_exec ( int argc, char **argv ) {
13
+	struct config_context dummy_context;
14
+
15
+	if ( argc != 1 ) {
16
+		printf ( "Usage: %s\n"
17
+			 "Opens the option configuration console\n", argv[0] );
18
+		return 1;
19
+	}
20
+
21
+	if ( ! ugly_nvo_hack ) {
22
+		printf ( "No non-volatile option storage available\n" );
23
+		return 1;
24
+	}
25
+
26
+	dummy_context.options = ugly_nvo_hack->options;
27
+	settings_ui ( &dummy_context );
28
+
29
+	return 0;
30
+}
31
+
32
+struct command config_command __command = {
33
+	.name = "config",
34
+	.exec = config_exec,
35
+};

+ 14
- 0
src/include/gpxe/settings_ui.h 查看文件

@@ -0,0 +1,14 @@
1
+#ifndef _GPXE_SETTINGS_UI_H
2
+#define _GPXE_SETTINGS_UI_H
3
+
4
+/** @file
5
+ *
6
+ * Option configuration console
7
+ *
8
+ */
9
+
10
+struct config_context;
11
+
12
+extern void settings_ui ( struct config_context *context );
13
+
14
+#endif /* _GPXE_SETTINGS_UI_H */

正在加载...
取消
保存