A Cursor Comes to the U-Boot Console

For a long time, editing commands in the U-Boot video console has been an exercise in memory. Without a visible cursor, it was often difficult to know your exact position in a long command line. A new 41-patch series changes that by introducing comprehensive cursor support for U-Boot’s video consoles.
This update brings a familiar (but so far non-blinking!) cursor to the command line, making editing commands a much more intuitive process.
How It Works
The new cursor functionality is designed to be efficient and visually clean.
- Idle Display: The cursor is only drawn when U-Boot is idle and waiting for input. As soon as you begin typing or a command is executed, the cursor is hidden.
- Save and Restore: To prevent visual artifacts, the video driver now saves the framebuffer pixels that are underneath the cursor’s position before it is drawn. When the cursor needs to be hidden, these saved pixels are restored, ensuring that the original display content is perfectly preserved.
- Broad Support: This functionality is not limited to one type of console. The new cursor is supported on both the standard bitmap-font console (
console_normal
) and the more advancedconsole_truetype
.
Related Improvements
This series goes beyond just adding a cursor and includes several related enhancements that improve the overall console experience:
- Truetype Console Upgrades: The truetype console receives two major improvements. First, it can now render standard bitmap fonts, making it more versatile. Second, a long-standing issue has been fixed where using arrow keys to edit commands would corrupt the displayed text. Command-line editing with truetype fonts is now much more reliable.
- Expo on Standard Consoles: The
expo
toolkit’s line-editing feature, previously dependent on the truetype console, now works with the standard bitmap-font console as well. This is made possible by the new console state-tracking implemented for the cursor. - Thoroughly Tested: The series includes a new set of tests specifically for the cursor functionality, verifying backspace behavior and ensuring there are no visual artifacts left behind after editing.
This work represents a significant quality-of-life improvement for anyone who works regularly with the U-Boot command line without a serial UART. To enable it on your board, simply add CONFIG_CURSOR=y
to your configuration.