expo: Provide a command to dump a cedit expo
Add a new 'cedit dump' command which dumps the contents of an expo for debugging. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -485,6 +485,15 @@ config CMD_CEDIT
|
||||
providing a UI for the user to adjust settings. Subcommands allow
|
||||
loading and saving of configuration as well as showing an editor.
|
||||
|
||||
config CMD_CEDIT_DUMP
|
||||
bool "Allow dumping the contents of a cedit expo"
|
||||
depends on CMD_CEDIT && EXPO_DUMP
|
||||
default y
|
||||
help
|
||||
Provides a 'cedit dump' command to dump the expo in a human-readable
|
||||
format. This can be useful for debugging or for checking that the
|
||||
expo contains the expected objects.
|
||||
|
||||
config CMD_ELF
|
||||
bool "bootelf"
|
||||
default y
|
||||
|
||||
38
cmd/cedit.c
38
cmd/cedit.c
@@ -14,6 +14,7 @@
|
||||
#include <fs_legacy.h>
|
||||
#include <malloc.h>
|
||||
#include <mapmem.h>
|
||||
#include <membuf.h>
|
||||
#include <dm/ofnode.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
@@ -291,6 +292,37 @@ static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CMD_EDIT_DUMP
|
||||
static int do_cedit_dump(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
struct membuf mb;
|
||||
char buf[256];
|
||||
int len;
|
||||
|
||||
if (check_cur_expo())
|
||||
return CMD_RET_FAILURE;
|
||||
|
||||
if (membuf_new(&mb, 131072)) {
|
||||
printf("Failed to allocate membuf\n");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
expo_dump(cur_exp, &mb);
|
||||
|
||||
/* Output the data in chunks */
|
||||
do {
|
||||
len = membuf_get(&mb, buf, sizeof(buf) - 1);
|
||||
buf[len] = '\0';
|
||||
puts(buf);
|
||||
} while (len);
|
||||
|
||||
membuf_dispose(&mb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_CMD_EDIT_DUMP */
|
||||
|
||||
U_BOOT_LONGHELP(cedit,
|
||||
"load <interface> <dev[:part]> <filename> - load config editor\n"
|
||||
#ifdef CONFIG_COREBOOT_SYSINFO
|
||||
@@ -302,6 +334,9 @@ U_BOOT_LONGHELP(cedit,
|
||||
"cedit write_env [-v] - write settings to env vars\n"
|
||||
"cedit read_cmos [-v] [dev] - read settings from CMOS RAM\n"
|
||||
"cedit write_cmos [-v] [dev] - write settings to CMOS RAM\n"
|
||||
#ifdef CONFIG_CMD_EDIT_DUMP
|
||||
"cedit dump - dump expo structure\n"
|
||||
#endif
|
||||
"cedit run - run config editor");
|
||||
|
||||
U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text,
|
||||
@@ -315,5 +350,8 @@ U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text,
|
||||
U_BOOT_SUBCMD_MKENT(write_env, 2, 1, do_cedit_write_env),
|
||||
U_BOOT_SUBCMD_MKENT(read_cmos, 2, 1, do_cedit_read_cmos),
|
||||
U_BOOT_SUBCMD_MKENT(write_cmos, 2, 1, do_cedit_write_cmos),
|
||||
#ifdef CONFIG_CMD_EDIT_DUMP
|
||||
U_BOOT_SUBCMD_MKENT(dump, 1, 1, do_cedit_dump),
|
||||
#endif
|
||||
U_BOOT_SUBCMD_MKENT(run, 1, 1, do_cedit_run),
|
||||
);
|
||||
|
||||
@@ -19,6 +19,7 @@ Synopsis
|
||||
cedit read_env [-v]
|
||||
cedit write_cmos [-v] [dev]
|
||||
cedit cb_load
|
||||
cedit dump
|
||||
|
||||
Description
|
||||
-----------
|
||||
@@ -101,6 +102,20 @@ cedit cb_load
|
||||
This is supported only on x86 devices booted from coreboot. It creates a new
|
||||
configuration editor which can be used to edit CMOS settings.
|
||||
|
||||
cedit dump
|
||||
~~~~~~~~~~
|
||||
|
||||
Dumps the current expo structure to the console. This shows the expo, its
|
||||
scenes, objects, and their properties in a human-readable format. This is useful
|
||||
for debugging and understanding the structure of the configuration editor.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
The cedit command is only available if CONFIG_CMD_CEDIT=y.
|
||||
|
||||
The 'cedit dump' subcommand is only available if CONFIG_CMD_CEDIT_DUMP=y.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
@@ -234,3 +249,129 @@ Update the checksum in CMOS RAM::
|
||||
Checksum 7100 written
|
||||
=> cbcmos check
|
||||
=>
|
||||
|
||||
This shows dumping the cedit::
|
||||
|
||||
Expo: name 'name'
|
||||
display (null)
|
||||
cons (none)
|
||||
mouse (none)
|
||||
scene_id 0
|
||||
next_id 42
|
||||
req_width 0
|
||||
req_height 0
|
||||
text_mode 0
|
||||
popup 0
|
||||
show_highlight 0
|
||||
mouse_enabled 0
|
||||
mouse_ptr 0000000000000000
|
||||
mouse_size 0x0
|
||||
mouse_pos (0,0)
|
||||
damage (0,0)-(0,0)
|
||||
done 0
|
||||
save 0
|
||||
last_key_ms 271450936
|
||||
Theme:
|
||||
font_size 0
|
||||
white_on_black 0
|
||||
menu_inset 0
|
||||
menuitem_gap_y 0
|
||||
|
||||
Scenes:
|
||||
Scene 6: name 'main'
|
||||
title_id 19 (title)
|
||||
highlight_id 0 ((none))
|
||||
Object 19 (title): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 20 font_name '(default)' font_size 0
|
||||
str 'Test Configuration'
|
||||
Object 21 (prompt): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 22 font_name '(default)' font_size 0
|
||||
str 'UP and DOWN to choose, ENTER to select'
|
||||
Object 8 (cpu-speed): type menu
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Menu: pointer_id 0 title_id 23 manual 0
|
||||
Item 10: name '00' label_id 25 desc_id 0
|
||||
Item 11: name '01' label_id 27 desc_id 0
|
||||
Item 12: name '02' label_id 29 desc_id 0
|
||||
Object 23 (title): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 24 font_name '(default)' font_size 0
|
||||
str 'CPU speed'
|
||||
Object 25 (item-label): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 26 font_name '(default)' font_size 0
|
||||
str '2 GHz'
|
||||
Object 27 (item-label): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 28 font_name '(default)' font_size 0
|
||||
str '2.5 GHz'
|
||||
Object 29 (item-label): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 30 font_name '(default)' font_size 0
|
||||
str '3 GHz'
|
||||
Object 13 (power-loss): type menu
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Menu: pointer_id 0 title_id 31 manual 0
|
||||
Item 14: name '00' label_id 33 desc_id 0
|
||||
Item 15: name '01' label_id 35 desc_id 0
|
||||
Item 16: name '02' label_id 37 desc_id 0
|
||||
Object 31 (title): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 32 font_name '(default)' font_size 0
|
||||
str 'AC Power'
|
||||
Object 33 (item-label): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 34 font_name '(default)' font_size 0
|
||||
str 'Always Off'
|
||||
Object 35 (item-label): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 36 font_name '(default)' font_size 0
|
||||
str 'Always On'
|
||||
Object 37 (item-label): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 38 font_name '(default)' font_size 0
|
||||
str 'Memory'
|
||||
Object 17 (machine-name): type textline
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Textline: label_id 39 edit_id 18
|
||||
max_chars 20 pos 20
|
||||
Object 39 (title): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 40 font_name '(default)' font_size 0
|
||||
str 'Machine name'
|
||||
Object 18 (edit): type text
|
||||
flags
|
||||
bbox: (0,0)-(0,0)
|
||||
dims: 0x0
|
||||
Text: str_id 41 font_name '(default)' font_size 0
|
||||
str ''
|
||||
|
||||
Reference in New Issue
Block a user