From patchwork Fri Oct 10 03:42:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 573 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1760067822; bh=XH7ChI9TXpEJCJKfpENtKB05zGATbyRmH4lSwFiXrYY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jkfIu7D4AXRtLa3HAJjsxQWh6DtD8EwX1CferpyQROuX8+U7Fe8NR1dp5OtZGHPBq rGVG+hWtlUfXpj1qBNhfGDugrPk6LsbqKRMEHpEAaxpHc0SuSv2gi5hqYSMyxhbxVw ftwgCWYlz6vwLP0NaQIKFua9LCGYHO+AnRtOaaqC0LGhGdOCs1TI54LoONxZw3coY7 ep05oYo4NQWwRCjw85NDr8UOXIiNwAfNWYVhcFnK6kt/QiL9Ccu6a+3MJ4z27OMo8m tO7dpkg+Qb+B1N1LeCycX0tM7MBidfrzDQiS+lmXG2TDCC9duitQ7NO3PByHikpATj +oiaUvCLFTObA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8959868080 for ; Thu, 9 Oct 2025 21:43:42 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id shrsaQp2UO9W for ; Thu, 9 Oct 2025 21:43:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1760067822; bh=XH7ChI9TXpEJCJKfpENtKB05zGATbyRmH4lSwFiXrYY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jkfIu7D4AXRtLa3HAJjsxQWh6DtD8EwX1CferpyQROuX8+U7Fe8NR1dp5OtZGHPBq rGVG+hWtlUfXpj1qBNhfGDugrPk6LsbqKRMEHpEAaxpHc0SuSv2gi5hqYSMyxhbxVw ftwgCWYlz6vwLP0NaQIKFua9LCGYHO+AnRtOaaqC0LGhGdOCs1TI54LoONxZw3coY7 ep05oYo4NQWwRCjw85NDr8UOXIiNwAfNWYVhcFnK6kt/QiL9Ccu6a+3MJ4z27OMo8m tO7dpkg+Qb+B1N1LeCycX0tM7MBidfrzDQiS+lmXG2TDCC9duitQ7NO3PByHikpATj +oiaUvCLFTObA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 778D76806E for ; Thu, 9 Oct 2025 21:43:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1760067820; bh=sgNUPiP1P35/GvW0IcPywU/FwYhLOI9uMdQrBFHPork=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nZle91lwBNVnbrhhiaix9gXkm/KndF4C2/tl913g16ivLOJ8XVjpdgkoTwxZNddFy YysA4DuO9xfceB4DfRukdBuacMiQH3z3VOZn5eqCLWN5ZdriG+zZw2jduZ/BB2xdvO rg69tC5eXyD0nkSymG+DjCUdCEKN9eucP05h7GtGidZvzAnpkKD6rouC9za159bEAn pCWTNEt4BApKd+uwD47E1jV9X1gSNw6fkZI3ZXsJAQZBZ/2wzwQiwVwIvWmnEWDUI3 1QkVEpGwYX1odeeEeabQTOerPLoFcSIiPdrWXyVmI0yB24Fdh/lI+3wuhFZgTpI9dc mpUKkBYPU2lig== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 230EB67F7F; Thu, 9 Oct 2025 21:43:40 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id hH4f7NNrJWcM; Thu, 9 Oct 2025 21:43:40 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1760067815; bh=nsCEdhtQrNLMLit7C7IwCmuag0xhC57X8kKdChah1Kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ghk8I5D1Lt7dA9sst9kZRzC6Os3TqSWxIyRQ/xhQT/pVQoV9zUPo+wHs9ZO5S508D pklFB6xZdG86TvglaZMqe/3G47Ig/b0DiV0WB9ujBxPuDVE70nUfcFWCgpFGPxsibW dHU/gRAXuH2B7X39SOiXcSL1HfnaY7XGFh3T/fkFBq67KZSPhvCR3XqXk6ExBb+SuH fb076NVi576jNgFxkLpj0FS68hw857gYmyTvrrhnkXu+Bezze0zTc+ruhf2T4UK52v 3GYDV1Iuy6y0yo8yYq90wMCwmRZIHJLZk/hj2sbb9t4Vb0DyaP7+1KlgTHwo49NcCk aIa90XNwcpG5A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C204E6807C; Thu, 9 Oct 2025 21:43:34 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 9 Oct 2025 21:42:35 -0600 Message-ID: <20251010034255.1099728-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251010034255.1099728-1-sjg@u-boot.org> References: <20251010034255.1099728-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2KOFV5IFWSXS7POTSJETEVWDZIHDSIXZ X-Message-ID-Hash: 2KOFV5IFWSXS7POTSJETEVWDZIHDSIXZ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/18] expo: Provide a command to dump a cedit expo List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a new 'cedit dump' command which dumps the contents of an expo for debugging. Co-developed-by: Claude Signed-off-by: Simon Glass --- cmd/Kconfig | 9 +++ cmd/cedit.c | 38 +++++++++++ doc/usage/cmd/cedit.rst | 141 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 188 insertions(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index 0c6d1c4b185..224d5a83987 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -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 diff --git a/cmd/cedit.c b/cmd/cedit.c index 6db5806e851..e446f61b3ba 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -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 - 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), ); diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index e54ea204b9f..0eb8f09dc2c 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -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 ''