| 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 | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 8 | EXTRA_IMAGEDEPENDS += "qemu-xilinx-helper-native" | 
|  | 9 |  | 
|  | 10 | PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native" | 
|  | 11 | PREFERRED_PROVIDER_qemu = "qemu-xilinx" | 
| Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 12 |  | 
|  | 13 | def 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 17 | # 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] | 18 | 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 Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 22 | return "" | 
|  | 23 |  | 
|  | 24 | def qemu_default_serial(d): | 
| Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 25 | if d.getVar("SERIAL_CONSOLES", True): | 
|  | 26 | first_console = d.getVar("SERIAL_CONSOLES", True).split(" ")[0] | 
|  | 27 | speed, console = first_console.split(";", 1) | 
| Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 28 | # 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 |  | 
|  | 34 | def 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 |  | 
|  | 42 | def 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 Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 48 | QB_SYSTEM_NAME_aarch64 ?= "${@qemu_target_binary(d)}-multiarch" | 
| Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 49 | QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}" | 
|  | 50 | QB_DEFAULT_FSTYPE ?= "cpio" | 
|  | 51 | QB_DTB ?= "${@qemu_default_dtb(d)}" | 
|  | 52 | QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}" | 
|  | 53 |  |