赞
踩
# sudo port selfupdate
# sudo port install netpbm
# pngtopnm MyLinux.png > logo_linux_clut.pnm
# pnmquant 224 logo_linux_clut.pnm > logo_linux_clut224.pnm
# pnmtoplainpnm logo_linux_clut224.pnm > logo_linux_clut224.ppm
# cp logo_linux_clut224.ppm /Volumes/android-kernel/source/goldfish/drivers/video/logo/
# cd /Volumes/android-kernel/source/goldfish
# vi arch/arm/configs/goldfish_armv7_defconfig
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_LOGO=y
# vi drivers/video/console/softcursor.c
- int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
- {
- /* struct fbcon_ops *ops = info->fbcon_par;
- unsigned int scan_align = info->pixmap.scan_align - 1;
- unsigned int buf_align = info->pixmap.buf_align - 1;
- unsigned int i, size, dsize, s_pitch, d_pitch;
- struct fb_image *image;
- u8 *src, *dst;
- ...
- fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height);
- image->data = dst;
- info->fbops->fb_imageblit(info, image);
- */ return 0;
- }
# export PATH=/Volumes/android/source/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7/bin/:$PATH
# make
# make -j16
...
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
# emulator -kernel arch/arm/boot/zImage
# vi /Volumes/android/source/system/core/init/init.c
- ...
- static int console_init_action(int nargs, char **args)
- {
- int fd;
-
- if (console[0]) {
- snprintf(console_name, sizeof(console_name), "/dev/%s", console);
- }
-
- fd = open(console_name, O_RDWR);
- if (fd >= 0)
- have_console = 1;
- close(fd);
-
- 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"
- " A N D R O I D ";
- write(fd, msg, strlen(msg));
- close(fd);
- }
- }
- return 0;
- }
- ...
- /* 565RLE image format: [count(2 bytes), rle(2 bytes)] */
-
- int load_565rle_image(char *fn)
- {
- struct FB fb;
- struct stat s;
- unsigned short *data, *bits, *ptr;
- unsigned count, max;
- int fd;
-
- if (vt_set_mode(1))
- return -1;
-
- fd = open(fn, O_RDONLY);
- if (fd < 0) {
- ERROR("cannot open '%s'\n", fn);
- goto fail_restore_text;
- }
-
- ...
-
- munmap(data, s.st_size);
- fb_update(&fb);
- fb_close(&fb);
- close(fd);
- unlink(fn);
- return 0;
-
- fail_unmap_data:
- munmap(data, s.st_size);
- fail_close_file:
- close(fd);
- fail_restore_text:
- vt_set_mode(0);
- return -1;
- }
# cd /Volumes/android/source
# vi system/core/init/logo.c
- ...
- /* 565RLE image format: [count(2 bytes), rle(2 bytes)] */
-
- int load_565rle_image(char *fn)
- {
- ...
- munmap(data, s.st_size);
- fb_update(&fb);
- fb_close(&fb);
- close(fd);
- unlink(fn);
- return 0;
-
- fail_unmap_data:
- munmap(data, s.st_size);
- fail_close_file:
- close(fd);
- fail_restore_text:
- /*vt_set_mode(0)*/;
- return -1;
- }
# make -j16
# sudo port install ImageMagick
# cd /Volumes/android/source/build/tools/rgb2565/
# gcc -O2 -Wall -Wno-unused-parameter -o rgb2565 to565.c
# cd initlogo.png目录
# convert -depth 8 initlogo.png rgb:initlogo.raw
# /Volumes/android/source/build/tools/rgb2565/rgb2565 -rle <initlogo.raw> initlogo.rle
# cp initlogo.rle /Volumes/android/source/out/target/product/generic/root/
# cd /Volumes/android/source
# rm out/target/product/generic/ramdisk.img
# make -j16
# cd /Volumes/android-kernel/source/golefish
# emulator -kernel arch/arm/boot/zImage
- desc.txt
- part0
- 0000.png
- 0001.png
- ...
- part1
- 0000.png
- 0001.png
- ...
part0,part1是两个存放动画帧系列图片的目录。desc.txt是一个文本文件,文件的内容如下:
320 480 30
p 1 0 part0
p 0 0 part1
第一行:320 480 30 表示播放分辨率为320*480,30表示每秒播放30帧图片。
# cd bootanimation所在目录
# zip -0 -r ../bootanimation.zip ./*
# cp ../bootanimation.zip /Volumes/android/source/out/target/product/generic/system/media/
# make snod
先CD进入bootanimation目录后,再执行zip压缩指令,保证不会将bootanimation目录打进包内。-0表示只存储,不压缩,-r 表示包括子目录
# cd /Volumes/android-kernel/source/golefish
# emulator -kernel arch/arm/boot/zImage
下面是(自上而下依次为内核Logo,启动Logo,启动动画):
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。