Chinaunix首页 | 论坛 | 博客
  • 博客访问: 424330
  • 博文数量: 69
  • 博客积分: 957
  • 博客等级: 准尉
  • 技术积分: 1161
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-26 14:54
文章分类

全部博文(69)

文章存档

2013年(15)

2012年(12)

2011年(42)

分类: Android平台

2013-09-28 12:09:12

开机文字("A N D R I O D") 

一。简单替换法,适用于将第二屏更换为静态图片
     1. 通过Ubuntu的命令sudo apt-get install imagemagick安装imagemagick工具。
     2. 做好一张与屏的分辨率一样大小的开机logo.png PS1 目前只能用静态图片.png     
     3.  在虚拟机中用命令convert -depth 8 logo.png rgb:logo.raw
     4. 把生成的logo.raw放到文件系统的根目录下。
     5. 在文件系统根目录下运行命令
        out/host/linux-x86/bin/rgb2565 -rle initlogo.rle.bak
        即可生成文件initlogo.rle.bak.
     6. 把生成的该文件放到2818_gingerbread/out/target/product/sdkDemo/root目录下即可
     7. 在文件系统根目录下用命令#make firmwareinitlogo.rle打包进镜像重新烧录即可完成修改andriod字符串

二。原理分析

Android 系统启动后,init.c中main()调用load_565rle_image()函数读取/initlogo.rle(一张565 rle压缩的位图),如果读取成功,则在/dev/graphics/fb0显示Logo图片;如果读取失败,则将/dev/tty0设为TEXT模式,并打开/dev/tty0,输出文本“A N D R I O D”字样。 
      
定义加载图片文件名称 
       #define INIT_IMAGE_FILE "/initlogo.rle" 
       int load_565rle_image( char *file_name ); 
       #endif

init.c中main()加载/initlogo.rle文件:
     if( load_565rle_image(INIT_IMAGE_FILE) ) {//加载initlogo.rle文件
         fd = open("/dev/tty0", O_WRONLY);//将/dev/tty0设为text模式
          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);
          }
      }
相关代码:
    /system/core/init/init.c 
    /system/core/init/init.h
    /system/core/init/init.rc
    /system/core/init/logo.c

 *.rle文件的制作步骤:
        a. 使用GIMP或者Advanced Batch Converter软件,将图象转换为RAW格式;
        b. 使用android自带的rgb2565工具,将RAW格式文件转换为RLE格式
            (如:rgb2565 -rle < initlogo.raw > initlogo.rle)。

三。附加
1. 修改logo高度:    
   所在文件drivers/video/console/fbcon.c
 {{ logo_height = fb_prepare_logo(info, ops->rotate)+xxxxxxx; //在加减相应xxxxxxx从而实现高度调整。  
    logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); }}  

2. 如何将开机logo中的光标去除  
    在内核的当前目录进入到drivers/video/console/fbcon.c文件  
    static void fb_flashcursor(void *private)制成空函数如下    
386 static void fb_flashcursor(void *private)    
387 {    
388 #if 0 //modify by yejj for clear cursor of lcdc    
389 struct fb_info *info = private;    
390 struct fbcon_ops *ops = info->fbcon_par;    
391 struct display *p;    
392 struct vc_data *vc = NULL;    
393 int c;    
394 int mode;
395    
396 acquire_console_sem();    
397 if (ops && ops->currcon != -1)    
398 vc = vc_cons[ops->currcon].d;
399    
400 if (!vc || !CON_IS_VISIBLE(vc) ||    
401 registered_fb[con2fb_map[vc->vc_num]] != info ||    
402 vc->vc_deccm != 1) {    
403 release_console_sem();    
404 return;    
405 }
406    
407 p = &fb_display[vc->vc_num];    
408 c = scr_readw((u16 *) vc->vc_pos);    
409 mode = (!ops->cursor_flash || ops->cursor_state.enable) ?    
410 CM_ERASE : CM_DRAW;    
411 ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),    
412 get_color(vc, info, c, 0));    
413 release_console_sem();    
414 #endif    
415 }

 同样的方法将函数static void fbcon_cursor(struct vc_data *vc, int mode)用空函数替换如下   
1304 static void fbcon_cursor(struct vc_data *vc, int mode)   
1305 {    
1306 #if 0 //modify by yejj for clear cursor of lcdc   
1307 struct fb_info *info


另一种禁止光标的方法: drivers/video/console/Makefile
#obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o font.o softcursor.o obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o font.o 

 编译遇到一个soft_cursor没有定义的问题问题,注释代码:
 drivers/video/console/bitblit.c
//ABING //      if (err) //              soft_cursor(info, &cursor);
阅读(4680) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~