我对嵌入式系统很陌生,我正在 qemu 上使用 ARM。因此,我在使用 cpu cortex-a9 的多功能 Express 上从模拟 SD 启动 Linux 内核映像时遇到了问题。
我按以下顺序准备了所有内容:首先,我使用适当的 ARM 工具链构建了内核vexpress_defconfig。然后我用 构建了 u-boot vexpress_ca9x4_defconfig。一切都很顺利。我使用的 Linux 内核源代码是 4.13 版本(来自 git 的最新稳定版)。U-boot版本为2017.09-00100。然后我准备了一张标清图像:
dd if=/dev/zero of=sd.img bs=4096 count=4096
mkfs.vfat sd.img
mount sd.img /mnt/tmp -o loop,rw
cp kernel/arch/arm/boot/zImage /mnt/tmp
umount /mnt/tmp
Run Code Online (Sandbox Code Playgroud)
接下来我尝试按如下方式运行 qemu:
qemu-system-arm -machine vexpress-a9 -cpu cortex-a9 -m 128M -dtb kernel/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -kernel uboot/u-boot -sd sd.img -nographic
Run Code Online (Sandbox Code Playgroud)
U-boot 加载成功并给出命令提示符。SD 确实存在并附加:
=> mmcinfo
Device: MMC
Manufacturer ID: aa
OEM: 5859
Name: QEMU!
Tran Speed: 25000000
Rd Block …Run Code Online (Sandbox Code Playgroud)