blob: b804112b5be3c15acd35fd99ad33a80bac084f67 [file] [log] [blame]
Brad Bishop286d45c2018-10-02 15:21:57 -04001# This include is used to setup default QEMU and qemuboot config for meta-xilinx
2# machines.
3
Andrew Geissler84ad7c52020-06-27 00:00:16 -05004# Use the xilinx specific version for these users
5IMAGE_CLASSES += "qemuboot-xilinx"
6
Brad Bishop286d45c2018-10-02 15:21:57 -04007# depend on qemu-helper-native, which will depend on QEMU
Andrew Geisslera9ff2b32020-10-16 10:11:54 -05008EXTRA_IMAGEDEPENDS += "qemu-helper-native"
Andrew Geissler84ad7c52020-06-27 00:00:16 -05009
10PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native"
11PREFERRED_PROVIDER_qemu = "qemu-xilinx"
Andrew Geisslera9ff2b32020-10-16 10:11:54 -050012PREFERRED_PROVIDER_qemu-native = "qemu-xilinx-native"
13PREFERRED_PROVIDER_nativesdk-qemu = "nativesdk-qemu-xilinx"
Brad Bishop286d45c2018-10-02 15:21:57 -040014
15def 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 Bishop1a4b7ee2018-12-16 17:11:34 -080019 # Note: Wildcard sources work here only because runqemu expands them at run time
Brad Bishop286d45c2018-10-02 15:21:57 -040020 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 Bishop286d45c2018-10-02 15:21:57 -040024 return ""
25
26def qemu_default_serial(d):
Andrew Geissler84ad7c52020-06-27 00:00:16 -050027 if d.getVar("SERIAL_CONSOLES", True):
28 first_console = d.getVar("SERIAL_CONSOLES", True).split(" ")[0]
29 speed, console = first_console.split(";", 1)
Brad Bishop286d45c2018-10-02 15:21:57 -040030 # 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
36def 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
44def 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 Geissler84ad7c52020-06-27 00:00:16 -050050QB_SYSTEM_NAME_aarch64 ?= "${@qemu_target_binary(d)}-multiarch"
Brad Bishop286d45c2018-10-02 15:21:57 -040051QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}"
52QB_DEFAULT_FSTYPE ?= "cpio"
53QB_DTB ?= "${@qemu_default_dtb(d)}"
54QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}"
55