使用 QEMU 运行 RT-Thread
qemu-system-arm仿真vexpress-a9踩坑记

buildroot 编译:

修改 qemu_arm_vexpress_defconfig, 添加 linux kernel git 地址:

# Architecture
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_ENABLE_VFP=y
BR2_ARM_FPU_VFPV3D16=y

# System
BR2_SYSTEM_DHCP="eth0"
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"

# Filesystem
BR2_TARGET_ROOTFS_EXT2=y
# BR2_TARGET_ROOTFS_TAR is not set

# Linux headers same as kernel, a 4.19 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y

# Kernel
BR2_LINUX_KERNEL=y

#BR2_LINUX_KERNEL_CUSTOM_VERSION=y
#BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.90"
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="http://172.17.0.1:3000/<path>/linux-4.19.90.git"
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="b27c50698362fa3269acbafea0006053883cf696"

BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"

# host-qemu for gitlab testing
BR2_PACKAGE_HOST_QEMU=y
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y

开始编译:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- qemu_arm_vexpress_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

输出目录文件:

  • ./output/images
  • rootfs.ext2
  • vexpress-v2p-ca9.dtb
  • zImage

根文件目录:

  • ./output/target

qemu 运行

  • -M: 指定模拟器类型
  • -cpu:指定 CPU 类型
  • -m: 指定内存大小
  • -kernel:指定内核文件
  • -dtb: dtb 文件
  • -append:kernel 内核参数, "root=/dev/mmcblk0 console=ttyAMA0"
  • -serial: 指定串行接口数据
  • -sd: 指定 SD 镜像文件挂载
  • -net nic -net tap,ifname=tap:tap 虚拟网卡
  • -display: 显示模式,例如: "-display sdl"
  • -S: Do not start CPU at startup (you must type ’c’ in the monitor).
@echo off
if exist sd.raw goto run
qemu-img create -f raw sd.raw 32M

:run
qemu-system-arm -M vexpress-a9 -cpu cortex-a9 -m 256 -kernel zImage -s -serial stdio -sd rootfs.ext2 -dtb vexpress-v2p-ca9.dtb -append "root=/dev/mmcblk0 console=ttyAMA0" -net nic -net tap,ifname=tap -display sdl

标签: none

添加新评论