這裡我們是在ubuntu下進行操作我是用root使用者登陸的,首先安裝netpbm庫
執行:apt-get install netpbm
對於Android系統最開始顯示logo是在核心當中,所以首先我們要修改核心中的logo.
一.核心中相關修改
編譯linux核心logo製作指令碼mklogo.sh,內容如下:
[python]
#!/bin/sh
pngtopnm logo.png > linuxlogo.pnm
pnmquant 224 linuxlogo.pnm > linuxlogo224.pnm
pnmtoplainpnm linuxlogo224.pnm > logo_linux_gzsd_clut224.ppm
rm linuxlogo.pnm linuxlogo224.pnm
#!/bin/sh
pngtopnm logo.png > linuxlogo.pnm
pnmquant 224 linuxlogo.pnm > linuxlogo224.pnm
pnmtoplainpnm linuxlogo224.pnm > logo_linux_gzsd_clut224.ppm
rm linuxlogo.pnm linuxlogo224.pnm
將你選好的logo轉換成png格式,命名為logo.png並與mklogo.sh放在同一路徑下.
執行./mklogo.sh最後產生logo_linux_gzsd_clut224.ppm
這個命名可以自由更改,但是必須遵循logo_yourname_type這種命名方式,這裡僅列舉*_clut224.ppm的命名方式,其它格式的命名方式請查看drivers/video/logo/Makefile檔案.
將logo_linux_gzsd_clut224.ppm檔案放到核心源碼下的drivers/video/logo/目錄下
進入drivers/video/logo目錄
1.修改Kconfig檔案
增加:在endif #LOGO之前
[plain]
config LOGO_LINUX_GZSD
bool "gzsd logo"
default n
config LOGO_LINUX_GZSD
bool "gzsd logo"
default n2.修改Makefile檔案
增加:
obj-$(CONFIG_LOGO_LINUX_GZSD) += logo_linux_gzsd_clut224.o
3.logo.c中函數fb_find_logo中的 if (depth >= 8)下面增加:
#ifdef CONFIG_LOGO_LINUX_GZSD
logo = &logo_linux_gzsd_clut224;
#endif
4.核心源碼目錄下的include/linux/linux_logo.h中增加
extern const struct linux_logo logo_linux_gzsd_clut224;
5.在終端執行make menuconfig,選上.
Device Drivers ---> Graphics support --->Bootup logo --->gzsd logo
儲存退出後編譯即可
6.禁止LCD控制台的游標
在核心源碼目錄下drivers/video/console/fbcon.c中
注釋掉函數:fb_flashcursor和fbcon_cursor內的所有內容
7.讓logo中螢幕中間顯示:
drivers/video/fbmem.c
修改函數fb_do_show_logo如下
[cpp]
static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
int rotate, unsigned int num)
{
unsigned int x;
int xoff,yoff;
/**for central logo**/
xoff = (info->var.xres - num * (fb_logo.logo->width + 8))>>1; //得到中間x座標
yoff = (info->var.yres - num * (fb_logo.logo->height + 8))>>1; //得到中間y座標
if (rotate == FB_ROTATE_UR) {
for (x = 0; x < num && image->dx + image->width <= info->var.xres; x++) {
image->dx = xoff;
image->dy = yoff;
info->fbops->fb_imageblit(info, image);
image->dx += image->width + 8;
}
}
else if (rotate == FB_ROTATE_UD) {
for (x = 0; x < num && image->dx >= 0; x++) {
info->fbops->fb_imageblit(info, image);
image->dx -= image->width + 8;
}
}
else if (rotate == FB_ROTATE_CW) {
for (x = 0; x < num && image->dy + image->height <= info->var.yres; x++) {
info->fbops->fb_imageblit(info, image);
image->dy += image->height + 8;
}
}
else if (rotate == FB_ROTATE_CCW) {
for (x = 0; x < num && image->dy >= 0; x++) {
info->fbops->fb_imageblit(info, image);
image->dy -= image->height + 8;
}
}
}
static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
int rotate, unsigned int num)
{
unsigned int x;
int xoff,yoff;
/**for central logo**/
xoff = (info->var.xres - num * (fb_logo.logo->width + 8))>>1; //得到中間x座標
yoff = (info->var.yres - num * (fb_logo.logo->height + 8))>>1; //得到中間y座標
if (rotate == FB_ROTATE_UR) {
for (x = 0; x < num && image->dx + image->width <= info->var.xres; x++) {
image->dx = xoff;
image->dy = yoff;
info->fbops->fb_imageblit(info, image);
image->dx += image->width + 8;
}
}
else if (rotate == FB_ROTATE_UD) {
for (x = 0; x < num && image->dx >= 0; x++) {
info->fbops->fb_imageblit(info, image);
image->dx -= image->width + 8;
}
}
else if (rotate == FB_ROTATE_CW) {
for (x = 0; x < num && image->dy + image->height <= info->var.yres; x++) {
info->fbops->fb_imageblit(info, image);
image->dy += image->height + 8;
}
}
else if (rotate == FB_ROTATE_CCW) {
for (x = 0; x < num && image->dy >= 0; x++) {
info->fbops->fb_imageblit(info, image);
image->dy -= image->height + 8;
}
}
}重新編譯即可
二.android啟動後閃動畫面修改:
路徑:檔案系統源碼下的frameworks/base/core/res/assets/images/下有兩張圖片
android-logo-mask.png
android-logo-shine.png
修改這兩張圖片即可,注意請將原來的儲存。