还是模拟 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的支持比较好啊。

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐