移植Android 遇到的问题

时间:2023-01-01 16:36:03
Failed to open eth0 这个错误引起的原因有很多,最终折腾一天后才发现是
uboot启动参数,ethaddr必须设置为host的mac地址。


错误:cannot open 'initlogo.rle'
vi system/core/init/init.c 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"
"\n"
" Happy Everyday! ";
write(fd, msg, strlen(msg));
close(fd);
}
}

从以上代码可以看出如果找不到initlogo.rle文件,就会显示Happy Everyday!(当然这个是我改了的).
vi system/core/init/logo.c
fd = open(fn, O_RDONLY);    if (fd < 0) {
ERROR("cannot open '%s'\n", fn);
goto fail_restore_text;
}
....
//unlink(fn);


从以上代码就可以知道为什么会打印前面所说的错误信息了.
为什么需要注释掉unlink?

因为unlink操作只要Android系统重启会删除initlogo.rle文件,我用的是nfs文件系统,有写权限,所以为了避免被删除,就暂时unlink掉,用mmm 命令编译下吧,然后把生成的init,copy到/nfsroot1/下。

制作initlogo.rle文件

sudo apt-get install imagemagick
convert -depth 8 ~/Desktop/initlogo.png rgb:initlogo.raw
./out/host/linux-x86/bin/rgb2565 -rle <initlogo.raw> initlogo.rle
如果/out/host/linux-x86/bin/下没有rgb2656那么就自己编译吧,cd到目录build/tools/rgb2565执行
gcc -O2 -Wall -Wno-unused-parameter -o rgb2565 to565.c 
cp /initlogo.rle /nfsroot1/
原始png图片我使用的是480*320的,这个根据自己的屏幕和横竖屏设置。

如果想改文件名只需要改system/core/init/init.h中的
#define INIT_IMAGE_FILE "/initlogo.rle"

 

ubuntu can't install jdk .

sudo ./jre-6u30-linux-i586.bin
Unpacking...
Checksumming...
Extracting...
./jre-6u30-linux-i586.bin: 86: ./ install.sfx.8648: not found
Failed to extract the files. Please refer to the Troubleshooting section of

the Installation Instructions on the download page for more information.

sudo apt-get install g++-multilib

then install jdk.can sucess.



make systemimage - system.img

make userdataimage - userdata.img

make ramdisk - ramdisk.img

make snod