qemu 可以支持 ARMv8
且支持的 boot 包括
1. 从 ATF启动
2. 从 UEFI启动
3. 从 u-boot启动
4. 从 linux 启动
这里打算用以下平台 qemu-system-aarch64 -M virt -cpu
qemu virt 平台
1.硬件平台
1. 可配置项
1. cpu微架构,个数
2. 内存大小
3. flash镜像
4. RAM 镜像
2. 不可配置项
1. Flash memory starts at address 0x0000_0000 , 支持 XIP ,可配置
2. RAM starts at 0x4000_0000
3. One PL011 UART
4. 其他配置项
All other information about device locations may change between QEMU versions, so guest code must look in the DTB.
qemu-system-aarch64 -machine virt,dumpdtb=virt.dtb -cpu cortex-a57 -smp 1 -m 2G -nographic
2.boot
QEMU supports two types of guest image boot for virt, and the way for the guest code to locate the dtb binary differs:
1.For guests using the Linux kernel boot protocol (this means any non-ELF file passed to the QEMU -kernel option)
the address of the DTB is passed in a register (r2 for 32-bit guests, or x0 for 64-bit guests)
2.For guests booting as “bare-metal” (any other kind of boot)
the DTB is at the start of RAM (0x4000_0000)
qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -smp 4
qemu-system-aarch64 支持bios ,但是必须显式设置,否则不使用bios
但是qemu-system-aarch64 在 不显式设置 bios 的时候,会去看share/qemu/efi-virtio.rom 是否为存在,是否为空,如果存在且不空, 才可正常走下去.否则,会自动结束
但是qemu-system-aarch64 并不会 读 share/qemu/efi-virtio.rom 中的内容
share/qemu/efi-virtio.rom 的格式
bin/../share/qemu/efi-virtio.rom: BIOS (ia32) ROM Ext. (135*512)
不显式设置-bios
直接跑kernel
-bios none
不支持
-bios xxx.bin
会去找 xxx.bin 文件,并以其为 bios 运行
-bios QEMU_EFI.fd
-bios u-boot.bin
qemu-system-aarch64/qemu-system-x86/qemu-system-riscv64 都有自己的 bios
对应 arm64 virt板 来说是 不跑bios
对应 x86 来说是 UEFI.fd ?
对应 rv 来说 是 opensbi-riscv64-generic-fw_dynamic.bin
-kernel xxx.elf
UEFI + ubuntu-16.04.3-server-arm64.iso
http:
https:
我之前搭好了一个从 UEFI 启动的平台 : https:
qemu-system-aarch64 \
-M virt \
-cpu cortex-a57 -smp 1 \
-m 1024M \
-bios QEMU_EFI.fd \
-drive if=none,file=xenial-server-cloudimg-arm64-uefi1.img,format=qcow2,id=hd0 -device virtio-blk-device,drive=hd0 \
-netdev user,id=hostnet0,hostfwd=tcp::2222-:22 -device virtio-net-device,netdev=hostnet0 \
-nographic
qemu virt 的启动有没有参考资料???
我们探索从 u-boot 启动 ,可参考 https:
qemu-system-aarch64 \
-M virt \
-cpu cortex-a57 -smp 1 \
-m 2G \
-bios u-boot.bin \
-drive if=pflash,format=raw,index=1,file=flash.img \
-nographic
从 EL1 boot
-machine virt,virtualization=on
使用QEMU(3.0版本以上)模拟一个arm64 virt平台,virt平台上有两个cfi flash。
启动过程为 : BootRom(BL1) 从Flash1 FIP中加载BL2,BL2再加载BL3, BL33(u-boot)
Flash0当成Boot使用,用于烧录 ATF(arm trust firmware)的BL1;
Flash1上 用于烧录 格式为ATF FIP的Image
qemu-system-aarch64
-machine virt,secure=xxx 和 -machine virt,virtualization=yyy 的关系
总结:
virtualization 可单独存在
secure 存在时, virtualization 必须存在
$ qemu-system-aarch64 -machine virt,help
virt-6.1-machine options:
acpi=<OnOffAuto> - Enable ACPI
append=<string> - Linux kernel command line
confidential-guest-support=<link<confidential-guest-support>> - Set confidential guest scheme to support
default_bus_bypass_iommu=<bool> - Set on/off to enable/disable bypass_iommu for default root bus
dt-compatible=<string> - Overrides the "compatible" property of the dt root node
dtb=<string> - Linux kernel device tree file
dump-guest-core=<bool> - Include guest memory in a core dump
dumpdtb=<string> - Dump current dtb to a file and quit
firmware=<string> - Firmware image
gic-version=<string> - Set GIC version. Valid values are 2, 3, host and max
graphics=<bool> - Set on/off to enable/disable graphics emulation
highmem=<bool> - Set on/off to enable/disable using physical address space above 32 bits
initrd=<string> - Linux initial ramdisk file
iommu=<string> - Set the IOMMU type. Valid values are none and smmuv3
its=<bool> - Set on/off to enable/disable ITS instantiation
kernel=<string> - Linux kernel image file
mem-merge=<bool> - Enable/disable memory merge support
memory-backend=<string> - Set RAM backendValid value is ID of hostmem based backend
memory-encryption=<string> - Set memory encryption object to use
mte=<bool> - Set on/off to enable/disable emulating a guest CPU which implements the ARM Memory Tagging Extension
phandle-start=<int> - The first phandle ID we may generate dynamically
ras=<bool> - Set on/off to enable/disable reporting host memory errors to a KVM guest using ACPI and guest external abort exceptions
secure=<bool> - Set on/off to enable/disable the ARM Security Extensions (TrustZone)
smp=<SMPConfiguration> - CPU topology
suppress-vmdesc=<bool> - Set on to disable self-describing migration
usb=<bool> - Set on/off to enable/disable usb
virtualization=<bool> - Set on/off to enable/disable emulating a guest CPU which implements the ARM Virtualization Extensions
x-oem-id=<string> - Override the default value of field OEMID in ACPI table header.The string may be up to 6 bytes in size
x-oem-table-id=<string> - Override the default value of field OEM Table ID in ACPI table header.The string may be up to 8 bytes in size