Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1675998
  • 博文数量: 311
  • 博客积分: 7778
  • 博客等级: 少将
  • 技术积分: 4186
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-09 19:59
个人简介

蓝点工坊(http://www.bluedrum.cn) 创始人,App和嵌入式产品开发。同时也做相应培训和外包工作。 详细介绍 http://pan.baidu.com/s/1y2g88

文章存档

2012年(3)

2011年(115)

2010年(170)

2009年(23)

分类: 嵌入式

2011-09-12 00:41:01

Andrew Huang  转载请注明作者及出处



一.准备工作
 
  有一个  可以参考,这是G4的.

  内核下载 
  现在HTC将开发网站由 http://developer.htc.com 从定向到http://htcdev.com/ 了。
  对于HTC G8可以选择HTC Wildfire – Froyo MR – 2.6.32 kernel source code ,最终下载的文件是
  

  关于编译器,从原理上讲一般的eabi的ARM 编译器应该都可以。我先用我的arm-linux-gcc 4.2.2 先试一下。
 
 解压内核
   tar xvf buzz-MR-2.6.32-g8f75634.tar.gz
   mv buzz-MR-2.6.32-g8f75634 g8-buzz-2.6.32

 取配置文件
 这个内核是没有配置好的内核文件备份,因此必须要从一台激活的HTC G8手机取得配置文件。
  
  直接用如下命令 
     adb pull /proc/config.gz 

   取得当前内核配置,将其解压
    gunzip config.gz

    cp config g8-buzz-2.6.32/.config

二.编译内核

  修改内核编译器,即内核的Makefile
   原来是  CROSS_COMPILE  ?= arm-eabi- 将其修改成我当前的编译器
    CROSS_COMPILE   ?= arm-linux-
  


  make menuconfig 可以查看其CPU的的类型
   
 
export LANG=en_US.UTF-8
make
第一次编译报错
  1. arch/arm/kernel/unwind.c:34:2: error: #warning Your compiler is too buggy; it is known to not compile ARM unwind support.
  2. arch/arm/kernel/unwind.c:35:2: error: #warning Change compiler or disable ARM _UNWIND option.

因此准备换一个编译版本较高的编译器,换成4.5.1
有编译错误

  1. cc1: warnings being treated as errors
  2. init/main.c: In function 'do_one_initcall':
  3. init/main.c:706:10: error: 'calltime.tv64' may be used uninitialized in this function
 
这是未初始化三个变量
         ktime_t calltime, delta, rettime;
参考这里说明
 
 将代码更新成
  
  1. /* ktime_t calltime, delta, rettime;*/
  2.     707 DEFINE_KTIME(calltime);
  3.     708 DEFINE_KTIME(delta);
  4.     709 DEFINE_KTIME(rettime);

修正后又碰如下错误
  1. arch/arm/mm/alignment.c:716:21: error: 'offset.un' may be used uninitialized in this function
  union offset_union offset; 
将其修改为
  716         union offset_union offset = { .un = 0};   

结果又碰到

  1. kernel/async.c: In function 'async_thread':
  2. kernel/async.c:126:10: error: 'calltime.tv64' may be used uninitialized in this function
  3. kernel/async.c:126:10: note: 'calltime.tv64' was declared here
  4. kernel/async.c: In function 'async_synchronize_cookie_domain':
  5. kernel/async.c:282:10: error: 'starttime.tv64' may be used uninitialized in this function
原因同前,一样修改

又碰到leds
  1. drivers/leds/leds-microp.c: In function 'microp_led_jogball_brightness_set':
  2. drivers/leds/leds-microp.c:117:2: error: case value '1' not in enumerated type 'enum led_brightness'
  3. drivers/leds/leds-microp.c:121:2: error: case value '3' not in enumerated type 'enum led_brightness'
  4. drivers/leds/leds-microp.c:125:2: error: case value '7' not in enumerated type 'enum led_brightness'
  5. drivers/leds/leds-microp.c: In function 'microp_led_wimax_brightness_set':
  6. drivers/leds/leds-microp.c:163:2: error: case value '1' not in enumerated type 'enum led_brightness'
  7. drivers/leds/leds-microp.c:164:2: error: case value '2' not in enumerated type 'enum led_brightness'
  8. drivers/leds/leds-microp.c:165:2: error: case value '3' not in enumerated type 'enum led_brightness'
  9. drivers/leds/leds-microp.c:166:2: error: case value '4' not in enumerated type 'enum led_brightness'
  10. drivers/leds/leds-microp.c:167:2: error: case value '5' not in enumerated type 'enum led_brightness'
  11. drivers/leds/leds-microp.c:168:2: error: case value '129' not in enumerated type 'enum led_brightness'
  12. drivers/leds/leds-microp.c:169:2: error: case value '130' not in enumerated type 'enum led_brightness'
  13. drivers/leds/leds-microp.c:170:2: error: case value '131' not in enumerated type 'enum led_brightness'

查看include/linux/leds.h 只有如下定义
  1. enum led_brightness {
  2.     LED_OFF        = 0,
  3.     LED_HALF    = 127,
  4.     LED_FULL    = 255,
  5. };

增加定义

又碰到
  1. cc1: warnings being treated as errors
  2. drivers/md/dm.c: In function 'split_bvec':
  3. drivers/md/dm.c:1032:3: error: statement with no effect
  4. drivers/md/dm.c: In function 'clone_bio':
  5. drivers/md/dm.c:1060:3: error: statement with no effect
错误实在太多了,没办法只能将-Werror 选项去掉,
即将.config中的 注释掉
   CONFIG_FORCE_WARNING_AS_ERROR=y

  1. LD vmlinux
  2. SYSMAP System.map
  3. SYSMAP .tmp_System.map
  4. OBJCOPY arch/arm/boot/Image
  5. Kernel: arch/arm/boot/Image is ready
  6. AS arch/arm/boot/compressed/head.o
  7. GZIP arch/arm/boot/compressed/piggy.gz
  8. AS arch/arm/boot/compressed/piggy.o
  9. CC arch/arm/boot/compressed/misc.o
  10. LD arch/arm/boot/compressed/vmlinux
  11. OBJCOPY arch/arm/boot/zImage
  12. Kernel: arch/arm/boot/zImage is ready
  13. Building modules, stage 2.
  14. MODPOST 1 modules
  15. CC drivers/net/wireless/bcm4329_204/bcm4329.mod.o
  16. LD [M] drivers/net/wireless/bcm4329_204/bcm4329.ko
  17. [root@gz g8-buzz-2.6.32]# vi .config
  18. [root@gz g8-buzz-2.6.32]# vim Makefile
  19. [root@gz g8-buzz-2.6.32]# vim .config
  20. [root@gz g8-buzz-2.6.32]# vim Makefile
 
阅读(2469) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~