blob: dd275f3b4800daf10cfcbe3c497a1f34a44c4bad [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
4# depend on qemu-helper-native, which will depend on QEMU
5EXTRA_IMAGEDEPENDS += "qemu-helper-native"
6
7def qemu_default_dtb(d):
8 if d.getVar("IMAGE_BOOT_FILES", True):
9 dtbs = d.getVar("IMAGE_BOOT_FILES", True).split(" ")
10 # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>'
11 dtbs = [f.split(";")[0] for f in dtbs]
12 dtbs = [f for f in dtbs if f.endswith(".dtb")]
13 if len(dtbs) != 0:
14 return dtbs[0]
15 if d.getVar("KERNEL_DEVICETREE", True):
16 dtbs = d.getVar("KERNEL_DEVICETREE", True).split(" ")
17 dtbs = [os.path.basename(d) for d in dtbs]
18 if len(dtbs) != 0:
19 return d.getVar("KERNEL_IMAGETYPE", True) + "-" + dtbs[0]
20 return ""
21
22def qemu_default_serial(d):
23 if d.getVar("SERIAL_CONSOLE", True):
24 speed, console = d.getVar("SERIAL_CONSOLE", True).split(" ", 1)
25 # zynqmp uses earlycon and stdout (in dtb)
26 if "zynqmp" in d.getVar("MACHINEOVERRIDES", True).split(":"):
27 return ""
28 return "console=%s,%s earlyprintk" % (console, speed)
29 return ""
30
31def qemu_target_binary(d):
32 ta = d.getVar("TARGET_ARCH", True)
33 if ta == "microblazeeb":
34 ta = "microblaze"
35 elif ta == "arm":
36 ta = "aarch64"
37 return "qemu-system-%s" % ta
38
39def qemu_zynqmp_unhalt(d, multiarch):
40 if multiarch:
41 return "-global xlnx,zynqmp-boot.cpu-num=0 -global xlnx,zynqmp-boot.use-pmufw=true"
42 return "-device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4 -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4"
43
44# For qemuboot, default setup across all machines in meta-xilinx
45QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}"
46QB_DEFAULT_FSTYPE ?= "cpio"
47QB_DTB ?= "${@qemu_default_dtb(d)}"
48QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}"
49