Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 1 | # This include is used to setup default QEMU and qemuboot config for meta-xilinx |
| 2 | # machines. |
| 3 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 4 | # Use the xilinx specific version for these users |
| 5 | IMAGE_CLASSES += "qemuboot-xilinx" |
| 6 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 7 | # depend on qemu-helper-native, which will depend on QEMU |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 8 | EXTRA_IMAGEDEPENDS += "qemu-helper-native" |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 9 | |
| 10 | PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native" |
| 11 | PREFERRED_PROVIDER_qemu = "qemu-xilinx" |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 12 | PREFERRED_PROVIDER_qemu-native = "qemu-xilinx-native" |
| 13 | PREFERRED_PROVIDER_nativesdk-qemu = "nativesdk-qemu-xilinx" |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 14 | |
| 15 | def qemu_default_dtb(d): |
| 16 | if d.getVar("IMAGE_BOOT_FILES", True): |
| 17 | dtbs = d.getVar("IMAGE_BOOT_FILES", True).split(" ") |
| 18 | # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>' |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 19 | # Note: Wildcard sources work here only because runqemu expands them at run time |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 20 | dtbs = [f.split(";")[0] for f in dtbs] |
| 21 | dtbs = [f for f in dtbs if f.endswith(".dtb")] |
| 22 | if len(dtbs) != 0: |
| 23 | return dtbs[0] |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 24 | return "" |
| 25 | |
| 26 | def qemu_default_serial(d): |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 27 | if d.getVar("SERIAL_CONSOLES", True): |
| 28 | first_console = d.getVar("SERIAL_CONSOLES", True).split(" ")[0] |
| 29 | speed, console = first_console.split(";", 1) |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 30 | # zynqmp uses earlycon and stdout (in dtb) |
| 31 | if "zynqmp" in d.getVar("MACHINEOVERRIDES", True).split(":"): |
| 32 | return "" |
| 33 | return "console=%s,%s earlyprintk" % (console, speed) |
| 34 | return "" |
| 35 | |
| 36 | def qemu_target_binary(d): |
| 37 | ta = d.getVar("TARGET_ARCH", True) |
| 38 | if ta == "microblazeeb": |
| 39 | ta = "microblaze" |
| 40 | elif ta == "arm": |
| 41 | ta = "aarch64" |
| 42 | return "qemu-system-%s" % ta |
| 43 | |
| 44 | def qemu_zynqmp_unhalt(d, multiarch): |
| 45 | if multiarch: |
| 46 | return "-global xlnx,zynqmp-boot.cpu-num=0 -global xlnx,zynqmp-boot.use-pmufw=true" |
| 47 | return "-device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4 -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4" |
| 48 | |
| 49 | # For qemuboot, default setup across all machines in meta-xilinx |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 50 | QB_SYSTEM_NAME_aarch64 ?= "${@qemu_target_binary(d)}-multiarch" |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 51 | QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}" |
| 52 | QB_DEFAULT_FSTYPE ?= "cpio" |
| 53 | QB_DTB ?= "${@qemu_default_dtb(d)}" |
| 54 | QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}" |
| 55 | |