
U-Boot has long supported embedding a graphical image directly into the binary – like the boot logo and the recently added BGRT (Boot Graphics Resource Table) image for EFI systems. But the way these images were handled was a bit of a mixed bag, with different patterns for different images and custom boilerplate for each one.
A new 6-patch series cleans this up, introducing a unified infrastructure for embedded images along with new commands to work with them.
What’s new
Unified image infrastructure
Previously, images were handled through ad-hoc Makefile rules that looked for specific patterns like _logo.bmp
or _image.bmp
. Each image required custom accessor macros and boilerplate code.
The new approach moves all embedded images into a single drivers/video/images/
directory and automatically generates linker list entries for them. This makes it trivial to add new images – just add obj-y += myimage.o
to the Makefile and reference it using video_image_get(myimage, &size)
or video_image_getptr(myimage)
.
The linker list infrastructure ensures that all images are discoverable at runtime, which enables the new video images
command described below.
New video command
A new video
command has been added with four subcommands:
video setcursor <col> <row>
– Set cursor position (equivalent to existingsetcurs
command)video puts <string>
– Write string at current position (equivalent to existinglcdputs
command)video write -p [<col>:<row> <string>...]
– Write string at a given position, either a character or a pixel positionvideo images
– List all images compiled into U-Boot
The existing standalone setcurs
and lcdputs
commands remain available for backward compatibility.
Example usage
=> video images
Name Size
-------------------- ----------
bgrt 43926
u_boot 6932
Total images: 2
=> video setcursor 10 5
=> video puts "Hello U-Boot!"
=> video write -p a3:34 "Pixels"
The payoff
This series removes 46 lines of duplicate accessor code while adding about 500 lines total (mostly documentation and tests). But the real win is in maintainability:
- Simpler to extend: Adding a new embedded image now requires just a single line in a Makefile
- Discoverable: The
video images
command shows what’s available at runtime - Better organized: All images live in
drivers/video/images/
rather than scattered across the tree - Consistent API: One pair of macros works for all images
The series also brings comprehensive documentation for the video commands (which previously had none) and adds tests to ensure everything works correctly.
If you’ve ever wanted to add a custom boot logo or wondered what images are built into your U-Boot binary, this series makes both much easier!