Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1801249
  • 博文数量: 286
  • 博客积分: 3713
  • 博客等级: 少校
  • 技术积分: 2275
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-11 09:47
个人简介

http://blog.chinaunix.net/uid/16979052.html

文章分类

全部博文(286)

文章存档

2018年(1)

2017年(16)

2016年(9)

2015年(17)

2014年(15)

2013年(112)

2012年(116)

分类: 嵌入式

2013-05-20 11:26:51

原文地址:u-boot编译 qemu中运行 作者:lerd

主机的操作系统是ubuntu11.04,用新立得安装的qemu和qemu-system,其他的看着装。
qemu安装到哪个目录也不知道,反正只要能找到qemu-system-arm就可以了。

1, 从ftp://ftp.denx.de/pub/u-boot/下载最新的u-boot, 文件名是u-boot-2011.06.tar.bz2。
2, tar xvf u-boot-2011.06.tar.bz2
3,   找个 arm-linux-gcc-4.3.2.tgz
4, 解压缩到根目录
5, 在~/.bashrc增加一行
       alias sparm432='PATH=/usr/local/arm/4.3.2/bin:$PATH'
6,    make distclean 就把配置都清掉了。
7,    make smdk2410_config
8,  先在终端中运行sparm432,设置一下arm-linux-gcc的路径
9,  make CROSS_COMPILE=arm-linux-
10, 编译成功,没报错。能不能跑就不知道了。

11,   vim Makefile
Line 160左右,
增加 CROSS_COMPILE ?=arm-linux-
这样,编译时只敲一个make就好了。不过对其他arch编译时要改回来。

12   make clean
make versatilepb_config
make
这样编译会失败,报告错误
===
board.c: In function '__dram_init_banksize':
board.c:233: error: 'CONFIG_SYS_SDRAM_BASE' undeclared (first use in this function)
board.c:233: error: (Each undeclared identifier is reported only once
board.c:233: error: for each function it appears in.)
board.c: In function 'board_init_f':
board.c:276: error: 'CONFIG_SYS_INIT_SP_ADDR' undeclared (first use in this function)
board.c:309: error: 'CONFIG_SYS_SDRAM_BASE' undeclared (first use in this function)
make[1]: *** [board.o] 错误 1
make[1]:正在离开目录 `/home/ldm/downloads/u-boot-2011.06/arch/arm/lib'
===

下载了个u-boot-2010.03,再用下面的命令就可以
make distclean
make versatilepb_config ARCH=arm CROSS_COMPILE=arm-linux-
make all ARCH=arm CROSS_COMPILE=arm-linux-

不过有人说要用make all ARCH=arm CROSS_COMPILE=arm-linux-uclibcgnueabi-编译才能在qemu中运行
但是我实验这样就可以跑了。

qemu-system-arm -M versatilepb -nographic -kernel u-boot.bin

===

ldm@ldm-TOP2:~/downloads/u-boot-2010.03$ qemu-system-arm -M versatilepb -nographic -kernel u-boot.bin


U-Boot 2010.03 ( 8月 11 2011 - 17:06:03)

DRAM:   0 kB
## Unknown FLASH on Bank 1 - Size = 0x00000000 = 0 MB
Flash:  0 kB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   SMC91111-0
VersatilePB #
VersatilePB #
VersatilePB #
VersatilePB #
VersatilePB # 
Unknown command '' - try 'help'
VersatilePB # QEMU: Terminated
ldm@ldm-TOP2:~/downloads/u-boot-2010.03$
===

hit “Ctrl-a” and then “x” to exit QEMU



阅读(1585) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~