Chinaunix首页 | 论坛 | 博客
  • 博客访问: 109203
  • 博文数量: 29
  • 博客积分: 447
  • 博客等级: 下士
  • 技术积分: 414
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-05 23:03
个人简介

整天捣鼓嵌入式,兼职搞搞iOS,这么折腾为了啥?都是为了俺的娃!

文章分类

分类: 嵌入式

2011-09-22 23:34:04

Target: at91sam9260开发板
编译工具: arm-linux-4.3.2  (arm-linux-3.4.1无法编译成功)
uboot版本:u-boot-2011.09-rc1
 
1.先进行清理u-boot编译过程文件:
  make unconfig
  make clean
  make clobber

2.删除无关文件
  ./arch/arm下与目标体系不相关文件夹,只留下自己目标体系的。这里我只留arm926ejs文件夹.
 ./board下只留下atmel文件夹
 
3.配置基本编译文件
3.1.根目录下mkconfig文件856行添加:
at91sam9260ek_config : unconfig
 @$(MKCONFIG) -n $@ -t $@ at91sam9260ek arm arm926ejs $(@:_config=) atmel at91sam9260ek
   ###  说明    target        arch cpu        vendor  board
#####这些都对应相关目录,target即mkconfig下的伪目标at91sam9260ek_config
#####arch对应arch下目录名,cpu对应arch/arm/cpu下目录名
######vendor和board对应board下目录
#######配置后生成include/config.mk文件,然后生成include/config.h

3.2.尝试编译
make at91sam9260ek_config
make
报错:在at91sam9260ek.h下找不到asm/hardware.h,原因是在include/asm下生成的arch链接损坏,可以手工创建
   cd include/asm
 rm -rf arch
 ln -s arch-at91 arch

3.3继续make,报错
In file included from /home/cblock/u-boot-2011.09-rc1/include/asm/hardware.h:16,
                 from /home/cblock/u-boot-2011.09-rc1/include/configs/at91sam9260ek.h:34,
                 from /home/cblock/u-boot-2011.09-rc1/include/config.h:7,
                 from /home/cblock/u-boot-2011.09-rc1/include/common.h:37,
                 from lib/asm-offsets.c:18:
/home/cblock/u-boot-2011.09-rc1/include/asm/arch/hardware.h:45:3: error: #error "Unsupported AT91 processor"
原因是没有定义CONFIG_at91sam9260ek。在hardware.h Line27添加defined(CONFIG_at91sam9260ek),如下
#elif defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9G20) || \
 defined(CONFIG_AT91SAM9XE)  || defined(CONFIG_at91sam9260ek)

3.4继续make,报错
make -C arch/arm/cpu/arm926ejs/at91sam9260ek/
make[1]: Entering directory `/home/cblock/u-boot-2011.09-rc1/arch/arm/cpu/arm926ejs/at91sam9260ek'
make[1]: *** 没有指明目标并且找不到 makefile。 停止。
make[1]: Leaving directory `/home/cblock/u-boot-2011.09-rc1/arch/arm/cpu/arm926ejs/at91sam9260ek'
make: *** [arch/arm/cpu/arm926ejs/at91sam9260ek/libat91sam9260ek.o] 错误 2
原因是最新的u-boot目录结构改变了,在at91sam9260ek没有makefile来构建目标t91sam9260ek.o,复制at91目录下所有文件到
at91sam9260ek目录,并修改makefile 29行添加
COBJS-$(CONFIG_at91sam9260ek) += at91sam9260_devices.o
 
3.5继续make,报错
cpu.c: In function 'print_cpuinfo':
cpu.c:63: error: 'ATMEL_CPU_NAME' undeclared (first use in this function)
cpu.c:63: error: (Each undeclared identifier is reported only once
cpu.c:63: error: for each function it appears in.)
make[1]: *** [cpu.o] 错误 1
make[1]: Leaving directory `/home/cblock/u-boot-2011.09-rc1/arch/arm/cpu/arm926ejs/at91sam9260ek'
make: *** [arch/arm/cpu/arm926ejs/at91sam9260ek/libat91sam9260ek.o] 错误 2
在arch/arm/include/asm/arch-at91/at91sam9260.h Line164添加
#elif defined(CONFIG_AT91SAM9260)
# define ATMEL_CPU_NAME  "AT91SAM9260"
# define ATMEL_ID_USART5 25 /* USART 5 */
# define ATMEL_BASE_SRAM0 0x00200000 /* Internal SRAM 0 */
# define ATMEL_BASE_SRAM1 0x00300000 /* Internal SRAM 1 */
# define ATMEL_BASE_USART5 0xfffd8000
# define ATMEL_BASE_GPBR 0xfffffd50
 
4.继续make,这下没错了,成功编译。剩下的就慢慢来针对板子来修改了。
 
阅读(2419) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~