2019-04-16

使用 QEMU 執行 openSUSE/AARCH64 image

因為 tclBlend 我接到一個 issue,在 AARCH64 下編譯失敗,所以需要一個 AARCH64 模擬器來除錯。


首先要安裝 QEMU-ARM:
sudo zypper install qemu-arm

要下載一個 openSUSE AARCH64 image 來進行測試(我使用 unxz 解壓縮)。
wget https://download.opensuse.org/ports/aarch64/factory/images/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-Current.raw.xz
unxz openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-Current.raw.xz

如果使用 efi image,需要有 Unified EFI BIOS 模擬器正確的載入 boot loader 才行(不然無法正確執行)。我從 Linaro 下載一個來使用。
wget https://releases.linaro.org/components/kernel/uefi-linaro/16.02/release/qemu64/QEMU_EFI.img.gz
gzip -d QEMU_EFI.img.gz 

然後就可以這樣執行:
qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios QEMU_EFI.img -serial stdio -device virtio-net-device,netdev=hostnet0,id=net0,mac=52:54:00:09:a4:37 -netdev user,id=hostnet0  -drive if=none,format=raw,file=openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-Current.raw,id=hd0  -device virtio-blk-device,drive=hd0

(使用者帳號為 root,密碼為 linux)

參考文章:
openSUSE:AArch64
Documentation/Platforms/ARM
Linux on AArch64 ARM 64-bit Architecture
Building ARM Servers With UEFI And ACPI


就 ARM 來說,有二種描述 hardware scheme 的方式,一種是 UEFI/ACPI,一種是 Device Tree。Linux kernel 可以編譯為二種都支援。文件中有提到:

ACPI support in drivers and subsystems for ARMv8 should never be mutually exclusive with DT support at compile time.

At boot time the kernel will only use one description method depending on parameters passed from the boot loader (including kernel bootargs).

Regardless of whether DT or ACPI is used, the kernel must always be capableof booting with either scheme (in kernels with both schemes enabled at compile time).

沒有留言: