在 QEMU 以 vexpress-a15运行 3.10.28内核的时候,刚开始 boot之后就停住了
$ ./qemu-2.0.0/arm-softmmu/qemu-system-arm -M vexpress-a15 -kernel ../linux-3.10.28/arch/arm/boot/zImage -serial stdio --append "console=ttyAMA0" -S -s
audio: Could not init `oss' audio driver
Uncompressing Linux... done, booting the kernel.
使用debug模式,可以发现,内核 hang的地方:
__loop_delay () at arch/arm/lib/delay-loop.S:46
46 subs r0, r0, #1
(gdb) where
#0 __loop_delay () at arch/arm/lib/delay-loop.S:46
#1 0x803adfe4 in panic (
fmt=0x804533a0 "vexpress: this kernel does not support core tile ID 0x%08x when booting via ATAGs.\nYou may need a device tree blob or a different kernel to boot on this board.\n") at kernel/panic.c:181
#2 0x804d4204 in v2m_populate_ct_desc () at arch/arm/mach-vexpress/v2m.c:322
#3 v2m_map_io () at arch/arm/mach-vexpress/v2m.c:331
#4 0x804d31a0 in devicemaps_init (mdesc=0x804ed1a0 <__mach_desc_VEXPRESS>)
at arch/arm/mm/mmu.c:1248
#5 paging_init (mdesc=mdesc@entry=0x804ed1a0 <__mach_desc_VEXPRESS>)
at arch/arm/mm/mmu.c:1310
#6 0x804cff5c in setup_arch (
cmdline_p=cmdline_p@entry=0x804fffcc <init_thread_union+8140>)
at arch/arm/kernel/setup.c:790
#7 0x804cd824 in start_kernel () at init/main.c:502
#8 0x80008074 in stext () at arch/arm/kernel/head.S:139
对应代码:
308 static void __init v2m_populate_ct_desc(void)
309 {
310 int i;
311 u32 current_tile_id;
312
313 ct_desc = NULL;
314 current_tile_id = vexpress_get_procid(VEXPRESS_SITE_MASTER)
315 & V2M_CT_ID_MASK;
316
317 for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i)
318 if (ct_descs[i]->id == current_tile_id)
319 ct_desc = ct_descs[i];
320
321 if (!ct_desc)
<span style="color:#FF0000;">322 panic("vexpress: this kernel does not support core tile ID 0x%08x when booting via ATAGs.\n"
323 "You may need a device tree blob or a different kernel to boot on this board.\n",
324 current_tile_id)</span>;
325 }
326
根据提示,可以用 dtb方式来 boot:
$ ./qemu-2.0.0/arm-softmmu/qemu-system-arm -M vexpress-a15 -kernel ../linux-3.10.28/arch/arm/boot/zImage -serial stdio --append "console=ttyAMA0" -dtb ../linux-3.10.28/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dtb
audio: Could not init `oss' audio driver
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Linux version 3.10.28 (charles@taotao) (gcc version 4.9.1 (GCC) ) #1 SMP Thu Sep 18 08:37:20 KST 2014
CPU: ARMv7 Processor [412fc0f1] revision 1 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
Machine: ARM-Versatile Express, model: V2P-CA15_CA7
Memory policy: ECC disabled, Data cache writealloc
这样就没问题了。
dtb文件可由 dts文件编译得到。
$ ARCH=arm CROSS_COMPILE=arm-v7a15-linux-gnueabi- make vexpress-v2p-ca15_a7.dtb
CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTLD scripts/mod/modpost
make[1]: `arch/arm/boot/dts/vexpress-v2p-ca15_a7.dtb' is up to date.
References:
http://www.cnblogs.com/coryxie/archive/2013/09/19/3329462.html