1. The picture is processed in BMP format
PS make direct use of a screen pixel size image (for example: 480*272
)
or prepare a jpeg image via the command line treatment for the 8bit BMP
picture, namedmylogo.bmp
vim to_bmp.sh
chmod 777 to_bmp.sh
./to_bmp.sh [待处理的JPG图片名] [输出文件名]
to_bmp.sh
#!/bin/sh
#install Netpbm first
jpegtopnm $1 | ppmquant 31 | ppmtobmp -bpp 8 > $2
2. Modify the boot LOGO
- Uboot's boot logo
CONFIG_VIDEO_LOGO
is the penguin logo by default (only defined ). This is a header file (include/video_logo.h
orbmp_logo.h
) that exists in the uboot code . This is a huge structure that holds the color data of each pixel of the picture. - The bmp files
mylogo.bmp
intouboot/tools/logos
and modify / tools / underMakefile
- bmp files are
tools/bmp_logo.c
tools compile thebmp_logo
made intoinclude/bmp_logo.h
# Generated LCD/video logo
LOGO_H = $(objtree)/include/bmp_logo.h
LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H)
LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H)
# Generic logo
ifeq ($(LOGO_BMP),)
# LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp
LOGO_BMP= $(srctree)/$(src)/logos/mylogo.bmp # 修改此处的logo
# Use board logo and fallback to vendor
ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),)
LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp
else
ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),)
LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp
endif
endif
endif # !LOGO_BMP
Add LOGO display configuration:
In include/configs/sun8i.h
adding two macro definitions:
/*
* Include common sunxi configuration where most the settings are
*/
#include <configs/sunxi-common.h>
#define CONFIG_VIDEO_LOGO
#define CONFIG_VIDEO_BMP_LOGO
#endif /* __CONFIG_H */
Custom macros CONFIG_VIDEO_LOGO
relevant to execute code drivers/video/cfb_console.c
under:
#ifdef CONFIG_VIDEO_LOGO
/* Plot the logo and get start point of console */
debug("Video: Drawing the logo ...\n");
video_console_address = video_logo();
Third, the logo is centered
Modify drivers/video/cfb_console.c
, modify in the function static void *video_logo(void)
:
static void *video_logo(void)
{
...
splash_get_pos(&video_logo_xpos, &video_logo_ypos);
/*
*增加代码,设置图片居中显示
*/
if(video_logo_xpos && video_logo_ypos)
{
video_logo_xpos= (VIDEO_VISIBLE_COLS - BMP_LOGO_WIDTH)>>1;
video_logo_ypos= (VIDEO_VISIBLE_ROWS - BMP_LOGO_HEIGHT)>>1;
}
#ifdef CONFIG_SPLASH_SCREEN
Fourth, the version information of the uboot startup interface is hidden
drivers/video/cfb_console.c
Comment out #ifndef CONFIG_HIDE_LOGO_VERSION
the code below to hide the version information of uboot.
#ifndef CONFIG_HIDE_LOGO_VERSION
// space = (VIDEO_LINE_LEN / 2 - VIDEO_INFO_X) / VIDEO_FONT_WIDTH;
// len = strlen(info);
// if (len > space) {
// video_drawchars(VIDEO_INFO_X, VIDEO_INFO_Y,
// (uchar *) info, space);
// video_drawchars(VIDEO_INFO_X + VIDEO_FONT_WIDTH,
// VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
// (uchar *) info + space, len - space);
// y_off = 1;
// } else
// video_drawstring(VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *) info);
#ifdef CONFIG_CONSOLE_EXTRA_INFO