
From: Simon Glass <sjg@chromium.org> Add a new 'video images' command which lists the graphical images that are compiled into U-Boot. Generally the only one is the logo. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- (no changes since v1) cmd/video.c | 30 ++++++++++++++++++++++++++++-- doc/usage/cmd/video.rst | 21 ++++++++++++++++++++- test/dm/video.c | 16 ++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/cmd/video.c b/cmd/video.c index 503433b9a63..4f00ffa2f77 100644 --- a/cmd/video.c +++ b/cmd/video.c @@ -8,6 +8,7 @@ #include <command.h> #include <dm.h> +#include <linker_lists.h> #include <video.h> #include <video_console.h> @@ -100,6 +101,29 @@ static int do_video_write(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_video_images(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct video_image *image; + int count, i; + + image = ll_entry_start(struct video_image, video_image); + count = ll_entry_count(struct video_image, video_image); + + printf("%-20s %10s\n", "Name", "Size"); + printf("%-20s %10s\n", "--------------------", "----------"); + + for (i = 0; i < count; i++, image++) { + ulong size = (ulong)image->end - (ulong)image->begin; + + printf("%-20s %10lu\n", image->name, size); + } + + printf("\nTotal images: %d\n", count); + + return 0; +} + U_BOOT_CMD( setcurs, 3, 1, do_video_setcursor, "set cursor position within screen", @@ -116,9 +140,11 @@ U_BOOT_LONGHELP(video, "setcursor <col> <row> - Set cursor position\n" "video puts <string> - Write string at current position\n" "video write [-p] [<col>:<row> <string>]... - Write strings at specified positions\n" - " -p: Use pixel coordinates instead of character positions"); + " -p: Use pixel coordinates instead of character positions\n" + "video images - List images compiled into U-Boot"); U_BOOT_CMD_WITH_SUBCMDS(video, "Video commands", video_help_text, U_BOOT_SUBCMD_MKENT(setcursor, 3, 1, do_video_setcursor), U_BOOT_SUBCMD_MKENT(puts, 2, 1, do_video_puts), - U_BOOT_SUBCMD_MKENT(write, CONFIG_SYS_MAXARGS, 1, do_video_write)); + U_BOOT_SUBCMD_MKENT(write, CONFIG_SYS_MAXARGS, 1, do_video_write), + U_BOOT_SUBCMD_MKENT(images, 1, 1, do_video_images)); diff --git a/doc/usage/cmd/video.rst b/doc/usage/cmd/video.rst index 288260bd979..81433e486ac 100644 --- a/doc/usage/cmd/video.rst +++ b/doc/usage/cmd/video.rst @@ -13,7 +13,8 @@ Synopsis video setcursor <col> <row> video puts <string> - video write [<col>:<row> <string>]... + video write [-p] [<col>:<row> <string>]... + video images Description ----------- @@ -66,6 +67,15 @@ locations in a single command. string Text string to display at the specified position +video images +~~~~~~~~~~~~ + + video images + +List all images that are compiled into U-Boot. This shows the name and size +of each image that was built from .bmp files in the drivers/video/images +directory. + Examples -------- @@ -90,6 +100,15 @@ Write text using pixel coordinates:: => video write -p 0:0 "Top left corner" a0:80 "Pixel position" +List compiled-in images:: + + => video images + Name Size + -------------------- ---------- + u_boot 6932 + + Total images: 1 + Configuration ------------- diff --git a/test/dm/video.c b/test/dm/video.c index 598e71411f5..b1bf08a99f7 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1114,3 +1114,19 @@ static int dm_test_video_cmd(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* video images command */ +static int dm_test_video_images(struct unit_test_state *uts) +{ + ut_assertok(run_command("video images", 0)); + ut_assert_nextline("Name Size"); + ut_assert_nextline("-------------------- ----------"); + ut_assert_nextline("bgrt 43926"); + ut_assert_nextline("u_boot 6932"); + ut_assert_skip_to_line(""); + ut_assert_nextline("Total images: 2"); + ut_assert_console_end(); + + return 0; +} +DM_TEST(dm_test_video_images, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE); -- 2.43.0