修改开机LOGO指南

对于我们来说,开机logo总是会不那么喜欢,所以我自己摸索出一份可以修改开机logo的相应程序,大家可以参考一下。
1 修改u-boot中的LOGO
1 更换logo

替换 u-boot-imx/2015.04-r0/git/tools/logos/目录下的freescale.bmp,注意这里要替换的图片一定是256色的位图,如果是24位色的图片转换可能会出错,造成图片显示不正常。
我们也可以,直接把自己需要显示的文件不命名为freescale.bmp,那就需要自己修改u-boot-imx/2015.04-r0/git/tools/Makefile文件,将LOGO_BMP=后面的路径设置为自己的图片的名称。
编译的时候,bmp_logo会将我们指定的图片转换为数组文件,保存在/u-boot-imx/2015.04-r0/git/mx6qsabresd_config/include/目录下的bmp_logo.h、bmp_logo_data.h中

2 将图片居中显示

修改 u-boot-imx/2015.04-r0/git/drivers/video/cfb_console.c
在函数static void *video_logo(void)中修改
splash_get_pos(&video_logo_xpos, &video_logo_ypos);
     if(video_logo_xpos==0&&video_logo_ypos==0)//这里是增加的代码,设置图片居中显示
    {
            video_logo_xpos= (VIDEO_VISIBLE_COLS - BMP_LOGO_WIDTH)>>1;
            video_logo_ypos= (VIDEO_VISIBLE_ROWS - BMP_LOGO_HEIGHT)>>1;
    }

3 去掉编译信息

在函数static void *video_logo(void)函数中注释掉下面的代码
sprintf(info, " %s", version_string);
      space = (VIDEO_COLS - VIDEO_INFO_X) / VIDEO_FONT_WIDTH;
    len = strlen(info);

if (len > space) {

            int xx = VIDEO_INFO_X, yy = VIDEO_INFO_Y;
            uchar *p = (uchar *) info;
            while (len) {
                    if (len > space) {
                            video_drawchars(xx, yy, p, space);
                            len -= space;

p = (uchar *) p + if (!y_off) {

                                    xx += VIDEO_FONT_WIDTH;
                                    space--;
                            }
                            yy += VIDEO_FONT_HEIGHT; y_off++; } else {video_drawchars(xx, yy, p, len); len} else
            video_drawstring(VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *) info);
            

2 修改Linux启动的logo
1 生成logo文件

生成logo文件,我们需要用png图片来转换
在terminal中运行下面的命令
pngtopnm car.png > car.pnm         #转换png成pnm格式
    pnmquant 224 car.pnm > car224.pnm       #转换像素数为224
    pnmtoplainpnm car224.pnm > logo_car_clut224.ppm

2 将logo_car_clut224.ppm拷贝到/kernel-source/drivers/video/logo/目录下

3 在/kernel-source/drivers/video/logo/Kconfig下增加

config LOGO_CAR224
    bool "Standard car logo"
    default y
    
在/kernel-source/drivers/video/logo/Makefile下增加
obj-$(CONFIG_LOGO_CAR224)                        += logo_car_clut224.o

4 执行bitbake -c menuconfig -v linux-imx

在menuconfig中选择Standard car logo

5 在/kernel-source/drivers/video/logo/logo.c中的

const struct linux_logo * __init_refok fb_find_logo(int depth)函数中
if (depth >= 8) {
。。。。。。。
}
里面添加
#ifdef CONFIG_LOGO_CAR224
            /* Generic car logo */
            logo = &logo_car_clut224;
#endif

在/kernel-source/include/linux/linux_logo.h
中添加extern const struct linux_logo logo_car_clut224;

6 去掉根据CPU的数目显示logo,只显示一个logo

将/kernel-source/drivers/video/fbmem.c
中函数int fb_show_logo(struct fb_info *info, int rotate)
将y = fb_show_logo_line(info, rotate, fb_logo.logo, 0,
                          num_online_cpus());
    改为
    y = fb_show_logo_line(info, rotate, fb_logo.logo, 0,
                          /*num_online_cpus()*/1);
                          

7 设置logo居中显示

修改 /kernel-source/drivers/video/fbmem.c中的
static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
                        int rotate, unsigned int num)函数
代码如下:
unsigned int x;
    unsigned int xoff,yoff; 
    //添加的代码 ,设置logo居中显示
    xoff = (info->var.xres - num * (fb_logo.logo->width ))>>1; 

yoff = (info->var.yres - (fb_logo.logo->height ))>>1;

    ////////////////////////////////////////////////////////////
    if (rotate == FB_ROTATE_UR) {
            //添加的代码,设置logo居中显示 
            image->dx = xoff ;
            image->dy = yoff ;
            ///////////////////////////////
            for (x = 0;
                 x < num && image->dx + image->width <= info->var.xres;
                 x++) {
                    info->fbops->fb_imageblit(info, image);
                    printk(KERN_ALERT"end\n" );
                    image->dx += image->width + 8;
            }
    } 
    

修改函数int fb_prepare_logo(struct fb_info *info, int rotate)

    在函数的结尾
    return fb_prepare_extra_logos(info, fb_logo.logo->height, yres);
    改为
    return fb_prepare_extra_logos(info, fb_logo.logo->height, ​

你可能感兴趣的:(修改开机LOGO指南)