2017年4月1日 星期六

[u-boot] logo background color setting

此logo背景色在圖中所使用比例最高
再由 bmp_logo_bitmap 判定0x24為背景色
在對應至 bmp_logo_palette 可得知0x24 is 0x0FFF
out/uboot/include/bmp_logo_data.h
unsigned short bmp_logo_palette[] = {
0x0000,  0x0FFF,  0x0666,  0x0666,  0x0FFF,  0x0666,  0x0666,  0x0F00,
0x0F00,  0x0FFF,  0x0FFF,  0x0F00,  0x0666,  0x0666,  0x0000,  0x0F00,
0x0666,  0x0666,  0x0E11,  0x0F00,  0x0FFF,  0x0FFF,  0x0F00,  0x0FFF,
...
}
unsigned char bmp_logo_bitmap[] = {
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
...
}

經過下列運算,可得知背景色為 0xf0

uboot-imx/drivers/video/cfb_console.c
for (i = 0; i < VIDEO_LOGO_COLORS; i++) {
logo_red[i] = (bmp_logo_palette[i] & 0x0f00) >> 4;
logo_green[i] = (bmp_logo_palette[i] & 0x00f0);
logo_blue[i] = (bmp_logo_palette[i] & 0x000f) << 4;
}

在此處如果 *CONFIG_SYS_CONSOLE_FG_COL* & *CONFIG_SYS_CONSOLE_BG_COL*
皆有定義,則會使用所定義之 背景/前景 顏色填入
uboot-imx/include/video_fb.h
#if defined(CONFIG_SYS_CONSOLE_FG_COL) && defined(CONFIG_SYS_CONSOLE_BG_COL)
#define CONSOLE_BG_COL            CONFIG_SYS_CONSOLE_BG_COL
#define CONSOLE_FG_COL            CONFIG_SYS_CONSOLE_FG_COL
#else
#define CONSOLE_BG_COL            0x00
#define CONSOLE_FG_COL            0xa0
#endif

因此我在project.h加入下方的定義,來完成背景色的填充
#define CONFIG_SYS_CONSOLE_FG_COL 0xa0
#define CONFIG_SYS_CONSOLE_BG_COL 0xf0


1 則留言: