|
From: | 张海斌 |
Subject: | Re: [PATCH] hw/arm/virt: use pflash image real size when mapping |
Date: | Sat, 19 Sep 2020 10:03:48 +0000 |
Example:
1. Get QEMU_EFI.fd and QEMU_VARS.fd from tianocore/edk2
2. Make pflash images
dd if=/dev/zero bs=1M count=64 of=flash0.img
dd if=/dev/zero bs=1M count=64 of=flash1.img
dd if=QEMU_EFI.fd bs=1M of=flash0.img conv=notrunc
dd if=QEMU_VARS.fd bs=1M of=flash1.img conv=notrunc
3. Start VM
qemu-system-aarch64 -machine virt,accel=kvm,gic-version=3 \
-drive file=flash0.img,if=pflash,format=raw,unit=0,readonly=on \
-drive file=flash1.img,if=pflash,format=raw,unit=1 \
…
In virt machine, VIRT_FLASH size is fixed 128MB (fixed 64MB for Flash0, fixed 64MB for Flash1).
Flash0 and Flash1 are two Block Backend devices and will be copied into two memory storages alloced
in virt_flash_map, not file mapping. Size of memory storage is fixed 64MB.
Since size checking, virt machine currently doesn’t support <64MB pflash images. So, get real
size of pflash image first, and use real size to alloc memory storage.
I always use 8MB Flash0 and Flash1, using following commands
dd if=/dev/zero bs=1M count=8 of=flash0.img
dd if=/dev/zero bs=1M count=8 of=flash1.img
dd if=QEMU_EFI.fd bs=1M of=flash0.img conv=notrunc
dd if=QEMU_VARS.fd bs=1M of=flash1.img conv=notrunc
Flash0 is read-only and shared by all VMs, but Flash1 is not and private for each VM.
Btw., how to create a nvdimm device mapping to address range 0~128MB?
|
[Prev in Thread] | Current Thread | [Next in Thread] |