qemu-arm.rst 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. .. Copyright (C) 2017, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
  3. QEMU ARM
  4. ========
  5. QEMU for ARM supports a special 'virt' machine designed for emulation and
  6. virtualization purposes. This document describes how to run U-Boot under it.
  7. Both 32-bit ARM and AArch64 are supported.
  8. The 'virt' platform provides the following as the basic functionality:
  9. - A freely configurable amount of CPU cores
  10. - U-Boot loaded and executing in the emulated flash at address 0x0
  11. - A generated device tree blob placed at the start of RAM
  12. - A freely configurable amount of RAM, described by the DTB
  13. - A PL011 serial port, discoverable via the DTB
  14. - An ARMv7/ARMv8 architected timer
  15. - PSCI for rebooting the system
  16. - A generic ECAM-based PCI host controller, discoverable via the DTB
  17. Additionally, a number of optional peripherals can be added to the PCI bus.
  18. Building U-Boot
  19. ---------------
  20. Set the CROSS_COMPILE environment variable as usual, and run:
  21. - For ARM::
  22. make qemu_arm_defconfig
  23. make
  24. - For AArch64::
  25. make qemu_arm64_defconfig
  26. make
  27. Running U-Boot
  28. --------------
  29. The minimal QEMU command line to get U-Boot up and running is:
  30. - For ARM::
  31. qemu-system-arm -machine virt -bios u-boot.bin
  32. - For AArch64::
  33. qemu-system-aarch64 -machine virt -cpu cortex-a57 -bios u-boot.bin
  34. Note that for some odd reason qemu-system-aarch64 needs to be explicitly
  35. told to use a 64-bit CPU or it will boot in 32-bit mode.
  36. Additional persistent U-boot environment support can be added as follows:
  37. - Create envstore.img using qemu-img::
  38. qemu-img create -f raw envstore.img 64M
  39. - Add a pflash drive parameter to the command line::
  40. -drive if=pflash,format=raw,index=1,file=envstore.img
  41. Additional peripherals that have been tested to work in both U-Boot and Linux
  42. can be enabled with the following command line parameters:
  43. - To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.::
  44. -drive if=none,file=disk.img,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0
  45. - To add an Intel E1000 network adapter, pass e.g.::
  46. -netdev user,id=net0 -device e1000,netdev=net0
  47. - To add an EHCI-compliant USB host controller, pass e.g.::
  48. -device usb-ehci,id=ehci
  49. - To add a NVMe disk, pass e.g.::
  50. -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo
  51. These have been tested in QEMU 2.9.0 but should work in at least 2.5.0 as well.
  52. Debug UART
  53. ----------
  54. The debug UART on the ARM virt board uses these settings::
  55. CONFIG_DEBUG_UART=y
  56. CONFIG_DEBUG_UART_PL010=y
  57. CONFIG_DEBUG_UART_BASE=0x9000000
  58. CONFIG_DEBUG_UART_CLOCK=0