现在的LCD屏大部分都是mipi cmd模式的了, 对于静态画面, mipi主控只需要刷新一次就可以了,因此现在大部分手机的boot logo的第一画面应该是放在lk下吧.
那么如何修改呢
1 首先得拿到图片,这个图片一般是从公司负责GUI 的那边获取到,格式要求是png, 色深8bit, 且不带alpha(透明色)通道的
2 将 png文件转换成raw文件
convert android.png -depth 8 rgb:android.raw
3 对于某些屏(只支持RGB565才需要此步骤),将raw文件转换成565格式的raw文件, Android 自带了一个这样的工具,在out/host/linux-x86/bin
./rgb2565 android.raw android.raw565
4 将android.raw或android.raw565转换成原始数组
xxd -i android.raw565 > android_logo.h
xxd -i android.raw > android_logo.h
然后用生成的数组替换掉splash.h中的imageBuffer_rgb888数组即可.
如下代码展示了如何在屏幕上面显示两个不同的小图片
\bootable\bootloader\lk\pla\msm_shared\include\splash.h
<span style="font-size:14px;">#define SPLASH_IMAGE_GIGASET_WIDTH 680
#define SPLASH_IMAGE_GIGASET_HEIGHT 210
#define SPLASH_IMAGE_GIGASET_H_OFFSET 200
#define SPLASH_IMAGE_GIGASET_V_OFFSET 568
#define SPLASH_IMAGE_ANDROID_WIDTH 432
#define SPLASH_IMAGE_ANDROID_HEIGHT 118
#define SPLASH_IMAGE_ANDROID_H_OFFSET 324
#define SPLASH_IMAGE_ANDROID_V_OFFSET 1724
static char imageBufferGigaset_rgb888[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
.....
};
//york.zhang@swdp.system 2015/05/29 added for modify LK logo
static char imageBufferAndroid_rgb888[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, .....
};
</span>
bootable\bootloader\lk\dev\fbcon\fbcon.c
<span style="font-size:14px;">#ifdef GIGASET_EDIT
void fbcon_putGigset(struct fbimage *fbimg)
{
unsigned i = 0;
unsigned bytes_per_bpp;
unsigned image_base;
unsigned width = 0;
unsigned pitch = 0;
unsigned height = 0;
unsigned char *logo_base = NULL;
struct logo_img_header *header;
if (!config) {
dprintf(CRITICAL,"NULL configuration, image cannot be displayed\n");
return;
}
if(fbimg) {
header = &fbimg->header;
width = pitch = header->width;
height = header->height;
logo_base = (unsigned char *)fbimg->image;
}
bytes_per_bpp = ((config->bpp) / 8);
if(bytes_per_bpp == 3)
{
image_base = (SPLASH_IMAGE_GIGASET_V_OFFSET ) * (config->width) + (config->width-width)/2;
for (i = 0; i < height; i++) {
memcpy (config->base + ((image_base + (i * (config->width))) * bytes_per_bpp),
logo_base + (i * pitch * bytes_per_bpp), width * bytes_per_bpp);
}
}
}
void fbcon_putAndroid(struct fbimage *fbimg)
{
unsigned i = 0;
unsigned bytes_per_bpp;
unsigned image_base;
unsigned width = 0;
unsigned pitch = 0;
unsigned height = 0;
unsigned char *logo_base = NULL;
struct logo_img_header *header;
if (!config) {
dprintf(CRITICAL,"NULL configuration, image cannot be displayed\n");
return;
}
if(fbimg) {
header = &fbimg->header;
width = pitch = header->width;
height = header->height;
logo_base = (unsigned char *)fbimg->image;
}
bytes_per_bpp = ((config->bpp) / 8);
if(bytes_per_bpp == 3)
{
image_base = (SPLASH_IMAGE_ANDROID_V_OFFSET) * (config->width) + (config->width- width)/2;
for (i = 0; i < height; i++) {
memcpy (config->base + ((image_base + (i * (config->width))) * bytes_per_bpp),
logo_base + (i * pitch * bytes_per_bpp), width * bytes_per_bpp);
}
arch_clean_invalidate_cache_range((addr_t) config->base, ((config->width) * (config->height) * bytes_per_bpp));
}
fbcon_flush();
}
#endif
void display_image_on_screen()
{
struct fbimage default_fbimg, *fbimg;
bool flag = true;
fbcon_clear();
fbimg = fetch_image_from_partition();
if(!fbimg) {
flag = false;
fbimg = &default_fbimg;
//york.zhang@swdp.system 2015/05/29 deleted for modify oem panel logo
#ifndef GIGASET_EDIT
fbimg->header.width = SPLASH_IMAGE_WIDTH;
fbimg->header.height = SPLASH_IMAGE_HEIGHT;
#endif
#if DISPLAY_TYPE_MIPI
//york.zhang@swdp.system 2015/05/29 modified for modify oem panel logo
#ifdef GIGASET_EDIT
fbimg->header.width = SPLASH_IMAGE_GIGASET_WIDTH;
fbimg->header.height = SPLASH_IMAGE_GIGASET_HEIGHT;
fbimg->image = (unsigned char *)imageBufferGigaset_rgb888;
fbcon_putGigset(fbimg);
fbimg->header.width = SPLASH_IMAGE_ANDROID_WIDTH;
fbimg->header.height = SPLASH_IMAGE_ANDROID_HEIGHT;
fbimg->image = (unsigned char *)imageBufferAndroid_rgb888;
fbcon_putAndroid(fbimg);
#else
fbimg->image = (unsigned char *)imageBuffer_rgb888;
#endif
#else
fbimg->image = (unsigned char *)imageBuffer;
#endif
}
//york.zhang@swdp.system 2015/05/29 deleted for modify oem panel logo
#ifndef GIGASET_EDIT
fbcon_putImage(fbimg, flag);
#endif
if (flag)
free(fbimg);
}</span>