How to enable USB keyboard and video console (HDMI display) of U-Boot

The aim of this document is to show the steps to enable USB keyboard and video console (HDMI display) on SP7021 platforms. To enable them, you need to first change your current directory to boot/uboot directory, and then run make menuconfig command (or run make uconfig in project top folder.). Second, when “U-Boot 2019.04 Configuration” menu pops up, move cursor to select and enable necessary supports or drivers of U-Boot. The last, modify board-specified C header file, 'pentagram_common.h'. Please follow the following steps to enable USB keyboard and video console of U-Boot.

Source files of SP7021 can be got from GitHub. Refer to https://github.com/sunplus-plus1/SP7021 or 2. HOW TO GET SOURCE FILE AND PACKAGE.

1. Enable USB keyboard support

Run make uconfig in project top directory. When “U-Boot 2019.04 Configuration” menu pops up, use arrow key to move cursor down to “Device Drivers” and press <Enter> to enter “Device Driver” sub-menu. Then, move cursor down to “Enable driver model keyboard support” and press <Y> to enable it. Refer to screenshot below:

Continue to move cursor down to “USB support” and press <Enter> to enter “USB support” sub-menu. Next, move cursor down to “OHCI HCD (USB 1.1) support” and press <Y> to enable it. Refer to screenshot below:

Continue to move cursor down to “USB Keyboard support” and enable it. Refer to screenshot below:

2. Enable video console (HDMI display) support

Press <ESC> twice to back to “Device Driver” sub-menu. Next, move cursor to “Graphic support” and press <Enter> to enter “Graphic support” sub-menu. Next, move cursor to “Enable driver model support for LCD/video” and press <Y> to enable it. In the same way, please also enable “Support 8-bit-per-pixel displays”, “Support 16-bit-per-pixel displays”, “Support 32-bit-per-pixel displays”, “Support ANSI escape sequences in video console”, “Support a simple text console”, “Support rotated displays” and “Display console as white on a black background”. Refer to screenshot below:

Continue to move cursor down to “Enable SP7021 video support” and enable it. Refer to screenshot below:

Press <Enter> to enter “Enable SP7021 video support” sub-menu. Refer to screenshot below, “Maximum horizontal resolution” is set to 720. “Maximum vertical resolution” is set 480. “Maximum bits per pixel is set” to 8. “Console Text Rotate Angle Setting” is set to 0 degree. “Enable SP7021 Update Palette for 8BPP” is enabled. Note that “Enable SP7021 video LOGO support” should be disabled in video console mode so that you can break boot sequence and enter console mode of U-Boot.

Use arrow key to select <Save> and save the settings. Finally, press <Esc> key till exit menuconfig.

3. Modify C header file pentagram_common.h

Use text editor to modify SP7021-specified C header file of U-Boot, ‘include/configs/pentagram_common.h’. Add string usbkbd to environment variable stdin and string vidconsole to environment variable stdout, respectively. For example:

stdin=usbkbd,serial stdout=vidconsole,serial

This means standard input can be from either USB keyboard or serial port and standard outputs are sent to both video console (HDMI display) and serial port.

Besides, define the following constants for USB keyboard:

#define CONFIG_USB_OHCI_NEW 1 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 #define CONFIG_PREBOOT "usb start" #define CONFIG_BOOTDELAY 1

where CONFIG_BOOTDELAY is defined to 1 (second) so that you can easily press a key to break boot sequence.

Define the following constants for video console (HDMI display):

#define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_VIDEO_BMP_GZIP #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (2<<20) #define CONFIG_BMP_16BPP #define CONFIG_BMP_24BPP #define CONFIG_BMP_32BPP

4. Build Linux image

Go to top folder. Run make all to build U-Boot and Linux image.

5. Boot system

Boot system with the built image.