使用 QEMU 测试 U-BOOT

还是模拟 VEXPRESS-A9.

起初,我用的还是qemu官网里的最新代码编出的qemu程序。

u-boot从下面的网址获得:

http://ftp.denx.de/pub/u-boot/

取得是最新的代码。解压后,配置,编译:

make vexpress_ca9x4_config
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
make vexpress_ca9x4_config
make

然后,用  qemu运行 u-boot:

qemu-system-arm -M vexpress-a9  -serial stdio -kernel u-boot
结果,qemu的窗口出来了,但却没有任何输出,程序好像是deadlock 在某一个地方了。
根据 http://balau82.wordpress.com/2012/03/31/compile-linux-kernel-3-2-for-arm-and-emulate-with-qemu/

建议的方法调试如下:

1. 先运行

qemu-system-arm -M vexpress-a9  -serial stdio -kernel u-boot -s -S
然后,在另一个虚拟终端窗口执行:

arm-linux-gnueabi-gdb u-boot
...
(gdb) target remote localhost:1234
最终发现,程序执行了下面的汇编执行后就 stuck 那里了
	mcr	p15, 0, r0, c12, c0, 0	@Set VBAR
(在文件  u-boot-2013.10/arch/arm/cpu/armv7/start.S里)
现在对arm的汇编还不熟悉,这个错误不知道如何解决。。

所以,就换了另一个对arm支持较好的qemu版本: qemu-linaro。可以用git拿到源码。

git clone git://git.linaro.org/qemu/qemu-linaro.git
用编译 qemu一样的方法编译 qemu-linaro.

然后,再尝试运行u-boot:

~/code/u-boot-2013.10$ qemu-system-arm -M vexpress-a9  -serial stdio -kernel u-boot
oss: Could not initialize DAC
oss: Failed to open `/dev/dsp'
oss: Reason: No such file or directory
oss: Could not initialize DAC
oss: Failed to open `/dev/dsp'
oss: Reason: No such file or directory
audio: Failed to create voice `lm4549.out'


U-Boot 2013.10 (Oct 24 2013 - 00:04:17)

DRAM:  128 MiB
WARNING: Caches not enabled
Flash: 128 MiB
MMC:   MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   smc911x-0
Warning: smc911x-0 using MAC address from net device

Hit any key to stop autoboot:  0 
Wrong Image Format for bootm command
ERROR: can't get kernel image!
VExpress# 
VExpress# 
VExpress# help
?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
bootelf - Boot from an ELF image in memory
bootm   - boot application image from memory
bootp   - boot image via network using BOOTP/TFTP protocol
bootvx  - Boot vxWorks from an ELF image
bootz   - boot Linux zImage image from memory
cmp     - memory compare
cp      - memory copy

这次能看到u-boot的输出了。看来还是  linaro的qemu对arm的支持比较好啊。

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值