1.uboot:
添加参数setenv logo_type "logo_type=0'',这里logo_type作为logo配置类型,
可任意设定,以供kernel获取。
2.logo脚本制作:将png图片转为kernel可识别的文件类型
vim mk_logo.sh
在mk_logo.sh中添加以下内容:
logo=$1
if [ -z ${logo} ];then
echo "err: no file"
exit
fi
sudo pngtopnm ${logo}.png > ${logo}.pnm
sudo pnmquant 224 ${logo}.pnm > ${logo}_clut224.pnm
sudo pnmtoplainpnm ${logo}_clut224.pnm > ${logo}_clut224.ppm
rm ${logo}.pnm
rm ${logo}_clut224.pnm
通过./mk_logo.sh logo_xxxxx生成logo_xxxxx.ppm,将logo_xxxxx.ppm拷贝到drivers/video/logo下。
3.kernel:
1)修改Kconfig
config LOGO_XXXXX
bool "xxxxx logo"
default y
2)修改Makefile
obj-$(CONFIG_LOGO_XXXXX) += logo_xxxxx.o
3)修改drivers/video/logo/logo.c
添加获取boot args logo_type的代码,
static int logo_type = 3;
static int __init logo_type_setup(char *str)
{
if (!strncmp(str, "0", 1))
{
logo_type = 0;
} else if (!strncmp(str, "1", 1))
{
logo_type = 1;
}
return 1;
}
__setup("logo_type=", logo_type_setup);
在fb_find_logo函数添加如下代码,
#ifdef CONFIG_LOGO_XXXXX
printk("[debug]:logo type = %d
", logo_type);
switch(logo_type)
{
case 0: logo = &logo_xxxxx_0; break;
case 1: logo = &logo_xxxxx_1; break;
case 2: logo = &logo_xxxxx_2; break;
//添加自己的logo
}
#endif
4.错误修改:显示logo时,由于分辨率的问题可能会导致报“fbcon_init: disable boot-logo (boot-logo bigger than screen)”错误
修改drivers/video/console/fbcon.c,
注销 ://logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height);
添加:logo_lines=(logo_height)/vc->vc_font.height;
5.总结,通过上述,就实现uboot配置kernel显示不同的logo,避免了更换logo时,kernel的不兼容问题。