QEMU 4.1 仿真vexpress
好久没更博客了。
这篇文章缘起于备课时发现目标开发平台硬件有问题,又不好换平台,于是想到了用qemu来仿真vexpress_defconfig开发板
1. 下载内核 这里随便下了个长期支持版本的内核 linux-3.16.71
2. 解压内核
3. 编译内核
- #export ARCH=arm
- #export CROSS_COMPILE=arm-none-linux-gnueabi-
- 注意,这里的工具链要根据自己实际情况设置
- #make vexpress_defconfig
- #make -j5
- 注意 这里的数字5根据自己cpu线程数设置,不能超过自己cpu线程数
- make menuconfig
- 配置内核
1 2 3 4 5 6 |
Device Drivers ---> Generic Driver Options ---> [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs -*- Enable the block layer ---> [*] Support for large (2TB+) block devices and files |
- make -j5
- 用buildroot制作文件系统
- 设置串口为ttyAMA0
- 生成ext4镜像
- 编译生成镜像
- 新建一个目录
- #mkdir vexpress
- 复制内核的zImage、vexpress-v2p-ca9.dtb到此目录
- arch/arm/boot/zImage
- arch/arm/boot/dts/vexpress-v2p-ca9.dtb
- 复制镜像到此目录
- 编写仿真启动脚本start.sh
1 2 3 4 5 6 7 8 9 |
#!/bin/bash qemu-system-arm -M vexpress-a9 \ -m 512M \ -nographic \ -dtb ./vexpress-v2p-ca9.dtb \ -kernel ./zImage \ -sd ./rootfs.ext4 \ -append "root=/dev/mmcblk0 rw console=ttyAMA0 " \ |
- 启动脚本
- chmod +x start.sh
- ./start.sh