summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2006-12-20 06:37:33 +0100
committerMichael Brown2006-12-20 06:37:33 +0100
commit8f9336e0c12827b77b82a5ab30897f12b2a2ac71 (patch)
tree13b5f4b77df81ad2a38e977b5e0f38222f41715d /src
parentAdd instruction row, and save option (diff)
downloadipxe-8f9336e0c12827b77b82a5ab30897f12b2a2ac71.tar.gz
ipxe-8f9336e0c12827b77b82a5ab30897f12b2a2ac71.tar.xz
ipxe-8f9336e0c12827b77b82a5ab30897f12b2a2ac71.zip
Add "config" command to access config UI
Diffstat (limited to 'src')
-rw-r--r--src/config.h1
-rw-r--r--src/core/config.c3
-rw-r--r--src/hci/commands/config_cmd.c35
-rw-r--r--src/include/gpxe/settings_ui.h14
4 files changed, 53 insertions, 0 deletions
diff --git a/src/config.h b/src/config.h
index cedd68bc..088d448a 100644
--- a/src/config.h
+++ b/src/config.h
@@ -116,6 +116,7 @@
*
*/
#define NVO_CMD /* Non-volatile option storage commands */
+#define CONFIG_CMD /* Option configuration console */
/* @END general.h */
diff --git a/src/core/config.c b/src/core/config.c
index fa3a4b0f..c8ec9362 100644
--- a/src/core/config.c
+++ b/src/core/config.c
@@ -146,6 +146,9 @@ REQUIRE_OBJECT ( pxe );
#ifdef NVO_CMD
REQUIRE_OBJECT ( nvo_cmd );
#endif
+#ifdef CONFIG_CMD
+REQUIRE_OBJECT ( config_cmd );
+#endif
/*
* Drag in miscellaneous objects
diff --git a/src/hci/commands/config_cmd.c b/src/hci/commands/config_cmd.c
new file mode 100644
index 00000000..fc21c67f
--- /dev/null
+++ b/src/hci/commands/config_cmd.c
@@ -0,0 +1,35 @@
+#include <string.h>
+#include <vsprintf.h>
+#include <gpxe/command.h>
+#include <gpxe/settings.h>
+#include <gpxe/settings_ui.h>
+
+
+#include <gpxe/nvo.h>
+extern struct nvo_block *ugly_nvo_hack;
+
+
+static int config_exec ( int argc, char **argv ) {
+ struct config_context dummy_context;
+
+ if ( argc != 1 ) {
+ printf ( "Usage: %s\n"
+ "Opens the option configuration console\n", argv[0] );
+ return 1;
+ }
+
+ if ( ! ugly_nvo_hack ) {
+ printf ( "No non-volatile option storage available\n" );
+ return 1;
+ }
+
+ dummy_context.options = ugly_nvo_hack->options;
+ settings_ui ( &dummy_context );
+
+ return 0;
+}
+
+struct command config_command __command = {
+ .name = "config",
+ .exec = config_exec,
+};
diff --git a/src/include/gpxe/settings_ui.h b/src/include/gpxe/settings_ui.h
new file mode 100644
index 00000000..59fc3cbd
--- /dev/null
+++ b/src/include/gpxe/settings_ui.h
@@ -0,0 +1,14 @@
+#ifndef _GPXE_SETTINGS_UI_H
+#define _GPXE_SETTINGS_UI_H
+
+/** @file
+ *
+ * Option configuration console
+ *
+ */
+
+struct config_context;
+
+extern void settings_ui ( struct config_context *context );
+
+#endif /* _GPXE_SETTINGS_UI_H */