1. 制作 initlogo.rle
# 使用ImageMagick自带的convert命令,进行raw格式转换
convert -depth 8 logo.png rgb:logo.raw
# android自带的rgb2565工具,对raw文件进行rle565格式转换
$out/host/linux-x86/bin/rgb2565 -rle <logo.raw >initlogo.rle
#然后将initlogo.rle拷贝到android系统根目录,也就是root目录底下
cp initlogo.rle out/target/product/Demo/root/
2. 相关的实现代码,摘自 Android 2.1
// 启动时载入图像,如果没有找 INIT_IMAGE_FILE 到这个文件名的图片,
// 则打印 A N D R O I D 字样。
if( load_565rle_image(INIT_IMAGE_FILE) ) {
fd = open("/dev/tty0", O_WRONLY);
if (fd >= 0) {
const char *msg;
msg = "\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n" // console is 40 cols x 30 lines
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
" A N D R O I D ";
write(fd, msg, strlen(msg));
close(fd);
}
}
//"system/core/init/init.c" 1039 行 --86%--
3. 图像文件名的指定
// 图像文件名宏的定义 INIT_IMAGE_FILE
void queue_all_property_triggers();
#define INIT_IMAGE_FILE "/initlogo.rle"
int load_565rle_image( char *file_name );
// "system/core/init/init.h" 179 行 --100%--
来源:oschina
链接:https://my.oschina.net/u/110982/blog/11637