README 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. This target generates images that can be used on ARM machines with EFI
  2. support (e.g EDKII/TianoCore or U-Boot with bootefi).
  3. The kernel and filesystem images can also be used directly by QEMU:
  4. Run with qemu-system-arm
  5. # boot with initramfs embedded in
  6. qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-initramfs-kernel.bin
  7. # boot with accel=kvm
  8. qemu-system-arm -nographic -M virt,accel=kvm -cpu host -m 64 -kernel
  9. openwrt-armvirt-32-generic-initramfs-kernel.bin
  10. # boot with a separate rootfs
  11. qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \
  12. -drive file=openwrt-armvirt-32-generic-ext4-rootfs.img,format=raw,if=virtio -append 'root=/dev/vda rootwait'
  13. # boot with local dir as rootfs
  14. qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \
  15. -fsdev local,id=rootdev,path=root-armvirt/,security_model=none \
  16. -device virtio-9p-pci,fsdev=rootdev,mount_tag=/dev/root \
  17. -append 'rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p'
  18. Run with kvmtool
  19. # start a named machine
  20. lkvm run -k openwrt-armvirt-32-zImage -i openwrt-armvirt-32-rootfs.cpio --name armvirt0
  21. # start with virtio-9p rootfs
  22. lkvm run -k openwrt-armvirt-32-zImage -d root-armvirt/
  23. # stop "armvirt0"
  24. lkvm stop --name armvirt0
  25. # stop all
  26. lkvm stop --all
  27. The multi-platform ARMv8 target can be used with QEMU:
  28. qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic \
  29. -kernel openwrt-armvirt-64-generic-initramfs-kernel.bin \
  30. With a EDKII or U-Boot binary for the QEMU ARM virtual machines, you can use these
  31. images in EFI mode:
  32. 32-bit:
  33. gunzip -c bin/targets/armvirt/32/openwrt-armvirt-32-generic-ext4-combined.img.gz > openwrt-arm-32.img
  34. qemu-system-arm -nographic \
  35. -cpu cortex-a15 -machine virt \
  36. -bios QEMU_EFI_32.fd \
  37. -smp 1 -m 1024 \
  38. -device virtio-rng-pci \
  39. -drive file=openwrt-arm-32.img,format=raw,index=0,media=disk \
  40. -netdev user,id=testlan -net nic,netdev=testlan \
  41. -netdev user,id=testwan -net nic,netdev=testwan
  42. 64-bit:
  43. gunzip -c bin/targets/armvirt/64/openwrt-armvirt-64-generic-ext4-combined.img.gz > openwrt-arm-64.img
  44. qemu-system-aarch64 -nographic \
  45. -cpu cortex-a53 -machine virt \
  46. -bios QEMU_EFI_64.fd \
  47. -smp 1 -m 1024 \
  48. -device virtio-rng-pci \
  49. -drive file=openwrt-arm-64.img,format=raw,index=0,media=disk \
  50. -netdev user,id=testlan -net nic,netdev=testlan \
  51. -netdev user,id=testwan -net nic,netdev=testwan
  52. One can find EFI/BIOS binaries from:
  53. - Compile mainline U-Boot for the QEMU ARM virtual machine (qemu_arm_defconfig/qemu_arm64_defconfig)
  54. - From distribution packages (such as qemu-efi-arm and qemu-efi-aarch64 in Debian)
  55. - Community builds, like retrage/edk2-nightly: https://retrage.github.io/edk2-nightly/