嵌入式Linux是直接在FrameBuffer的基础上。直接显示一个ppm格式的图象,它由kernel/drivers/video/fbcon.c中的fbcon_show_logo()完成,最大颜 {MOD}支持224 {MOD}而不常见的255 {MOD}。默认的logo文件是 drivers/video/logo/logo_linux_clut224.ppm.
由于linux内核默认的开机logo是从内核文件(如zImage)中读取的,因此要想实现应用层修改内核开机logo就必须要将logo放在内核文件外引导。
1.首先修改driver/video/logo下的Kconfig文件,添加如下代码
config LOGO_LINUX_CUSTOM_CLUT224
bool "Custom 224-color Linux logo"
default y
内核源码路径下make menuconfig,将其他logo选项去掉。
2.修改driver/video/logo/logo.c,添加如下代码
#ifdef CONFIG_LOGO_LINUX_CUSTOM_CLUT224
volatile static unsigned char* remapped_area;
static unsigned char clut[224*3];
static unsigned char data[800*480];
struct linux_logo logo_buf = {
.type = LINUX_LOGO_CLUT224, //LINUX_LOGO_CLUT224,
.width = 800,
.height = 480,
.clutsize = 224,
.clut = clut,
.data = data
};
#endif // CONFIG_LOGO_LINUX_CUSTOM_CLUT224
在函数const struct linux_logo * __init_refok fb_find_logo(int depth)中添加如下代码
#ifdef CONFIG_LOGO_LINUX_CUSTOM_CLUT224
logo = &logo_buf;
remapped_area = __phys_to_virt(0x85800000);
memcpy( &logo->width, remapped_area, 4);
memcpy( &logo->height, remapped_area + 4, 4);
memcpy( &logo->clutsize, remapped_area + 8, 4);
memcpy( logo->clut, remapped_area + 12, logo->clutsize * 3);
memcpy( logo->data, remapped_area + 12 + logo->clutsize * 3, logo->width * logo->height);
#endif // CONFIG_LOGO_LINUX_CUSTOM_CLUT224
这样就实现了内核logo数据不再从内核中文件中读取数据,而是读取内存中固定地址位置数据;其中remapped_area = __phys_to_virt(0x85800000);中的地址0x85800000对应于uboot中的
#define ENV_LOGO
"loadlogo=nand read.e ${splashimage} logo