blob: 5eb4b5c47059a0b57d907f70bc5a43fcedd8862e [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>'
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080011 # Note: Wildcard sources work here only because runqemu expands them at run time
Brad Bishop286d45c2018-10-02 15:21:57 -040012 dtbs = [f.split(";")[0] for f in dtbs]
13 dtbs = [f for f in dtbs if f.endswith(".dtb")]
14 if len(dtbs) != 0:
15 return dtbs[0]
Brad Bishop286d45c2018-10-02 15:21:57 -040016 return ""
17
18def qemu_default_serial(d):
19 if d.getVar("SERIAL_CONSOLE", True):
20 speed, console = d.getVar("SERIAL_CONSOLE", True).split(" ", 1)
21 # zynqmp uses earlycon and stdout (in dtb)
22 if "zynqmp" in d.getVar("MACHINEOVERRIDES", True).split(":"):
23 return ""
24 return "console=%s,%s earlyprintk" % (console, speed)
25 return ""
26
27def qemu_target_binary(d):
28 ta = d.getVar("TARGET_ARCH", True)
29 if ta == "microblazeeb":
30 ta = "microblaze"
31 elif ta == "arm":
32 ta = "aarch64"
33 return "qemu-system-%s" % ta
34
35def qemu_zynqmp_unhalt(d, multiarch):
36 if multiarch:
37 return "-global xlnx,zynqmp-boot.cpu-num=0 -global xlnx,zynqmp-boot.use-pmufw=true"
38 return "-device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4 -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4"
39
40# For qemuboot, default setup across all machines in meta-xilinx
41QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}"
42QB_DEFAULT_FSTYPE ?= "cpio"
43QB_DTB ?= "${@qemu_default_dtb(d)}"
44QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}"
45