blob: 886cad24e2c56be5073c0f514e1845cea6ac3705 [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 Geissler84ad7c52020-06-27 00:00:16 -05008EXTRA_IMAGEDEPENDS += "qemu-xilinx-helper-native"
9
10PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native"
11PREFERRED_PROVIDER_qemu = "qemu-xilinx"
Brad Bishop286d45c2018-10-02 15:21:57 -040012
13def qemu_default_dtb(d):
14 if d.getVar("IMAGE_BOOT_FILES", True):
15 dtbs = d.getVar("IMAGE_BOOT_FILES", True).split(" ")
16 # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>'
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080017 # Note: Wildcard sources work here only because runqemu expands them at run time
Brad Bishop286d45c2018-10-02 15:21:57 -040018 dtbs = [f.split(";")[0] for f in dtbs]
19 dtbs = [f for f in dtbs if f.endswith(".dtb")]
20 if len(dtbs) != 0:
21 return dtbs[0]
Brad Bishop286d45c2018-10-02 15:21:57 -040022 return ""
23
24def qemu_default_serial(d):
Andrew Geissler84ad7c52020-06-27 00:00:16 -050025 if d.getVar("SERIAL_CONSOLES", True):
26 first_console = d.getVar("SERIAL_CONSOLES", True).split(" ")[0]
27 speed, console = first_console.split(";", 1)
Brad Bishop286d45c2018-10-02 15:21:57 -040028 # zynqmp uses earlycon and stdout (in dtb)
29 if "zynqmp" in d.getVar("MACHINEOVERRIDES", True).split(":"):
30 return ""
31 return "console=%s,%s earlyprintk" % (console, speed)
32 return ""
33
34def qemu_target_binary(d):
35 ta = d.getVar("TARGET_ARCH", True)
36 if ta == "microblazeeb":
37 ta = "microblaze"
38 elif ta == "arm":
39 ta = "aarch64"
40 return "qemu-system-%s" % ta
41
42def qemu_zynqmp_unhalt(d, multiarch):
43 if multiarch:
44 return "-global xlnx,zynqmp-boot.cpu-num=0 -global xlnx,zynqmp-boot.use-pmufw=true"
45 return "-device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4 -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4"
46
47# For qemuboot, default setup across all machines in meta-xilinx
Andrew Geissler84ad7c52020-06-27 00:00:16 -050048QB_SYSTEM_NAME_aarch64 ?= "${@qemu_target_binary(d)}-multiarch"
Brad Bishop286d45c2018-10-02 15:21:57 -040049QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}"
50QB_DEFAULT_FSTYPE ?= "cpio"
51QB_DTB ?= "${@qemu_default_dtb(d)}"
52QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}"
53