summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc')
-rw-r--r--meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc108
1 files changed, 7 insertions, 101 deletions
diff --git a/meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc b/meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc
index 0fcc5087..7b953975 100644
--- a/meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc
+++ b/meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc
@@ -1,111 +1,17 @@
1# This include is used to setup default QEMU and qemuboot config for meta-xilinx 1# This include is used to setup default QEMU and qemuboot config for meta-xilinx
2# machines. 2# machines.
3 3
4# Use the xilinx specific version for these users
5IMAGE_CLASSES += "qemuboot-xilinx"
6
7# depend on qemu-helper-native, which will depend on QEMU
8EXTRA_IMAGEDEPENDS += "qemu-helper-native:do_addto_recipe_sysroot"
9
10PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native" 4PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native"
11PREFERRED_PROVIDER_qemu = "qemu-xilinx" 5PREFERRED_PROVIDER_qemu = "qemu-xilinx"
12PREFERRED_PROVIDER_qemu-native = "qemu-xilinx-native" 6PREFERRED_PROVIDER_qemu-native = "qemu-xilinx-native"
7PREFERRED_PROVIDER_qemu-system-native = "qemu-xilinx-system-native"
13PREFERRED_PROVIDER_nativesdk-qemu = "nativesdk-qemu-xilinx" 8PREFERRED_PROVIDER_nativesdk-qemu = "nativesdk-qemu-xilinx"
14 9
15def qemu_add_extra_args(d): 10# enable the overrides for the context of the conf only
16 initramfs_image = d.getVar('INITRAMFS_IMAGE') or "" 11MACHINEOVERRIDES =. "qemuboot-xilinx:"
17 bundle_image = d.getVar('INITRAMFS_IMAGE_BUNDLE') or ""
18 deploy_dir = d.getVar('DEPLOY_DIR_IMAGE') or ""
19 machine_name = d.getVar('MACHINE') or ""
20 soc_family = d.getVar('SOC_FAMILY') or ""
21 qb_extra_args = ''
22 # Add kernel image and boot.scr to qemu boot command when initramfs_image supplied
23 kernel_name = ''
24 bootscr_image = '%s/boot.scr' % deploy_dir
25 if soc_family in ('zynqmp', 'versal'):
26 kernel_name = 'Image'
27 bootscr_loadaddr = '0x20000000'
28 if initramfs_image:
29 kernel_image = '%s/%s' % (deploy_dir, kernel_name)
30 if bundle_image == "1":
31 kernel_image = '%s/%s-initramfs-%s.bin' % (deploy_dir, kernel_name, machine_name)
32 kernel_loadaddr = '0x200000'
33 if kernel_name:
34 qb_extra_args = ' -device loader,file=%s,addr=%s,force-raw=on' % (kernel_image, kernel_loadaddr)
35 qb_extra_args += ' -device loader,file=%s,addr=%s,force-raw=on' % (bootscr_image, bootscr_loadaddr)
36 if soc_family == 'versal':
37 qb_extra_args += ' -boot mode=5'
38 else:
39 if soc_family in ('zynqmp', 'versal'):
40 qb_extra_args = ' -boot mode=5'
41 return qb_extra_args
42
43def qemu_rootfs_params(d,param):
44 initramfs_image = d.getVar('INITRAMFS_IMAGE') or ""
45 bundle_image = d.getVar('INITRAMFS_IMAGE_BUNDLE') or ""
46 soc_family = d.getVar('SOC_FAMILY') or ""
47 tune_features = (d.getVar('TUNE_FEATURES') or []).split()
48 if param == 'rootfs':
49 return 'none' if bundle_image == "1" else ''
50 elif param == 'fstype':
51 fstype_dict = {
52 "microblaze": "cpio.gz",
53 "zynq": "cpio.gz",
54 "zynqmp": "cpio.gz.u-boot",
55 "versal": "cpio.gz.u-boot.qemu-sd-fatimg"
56 }
57 if 'microblaze' in tune_features:
58 soc_family = 'microblaze'
59 if not initramfs_image:
60 image_fs = d.getVar('IMAGE_FSTYPES')
61 if 'wic.qemu-sd' in image_fs:
62 return 'wic.qemu-sd'
63 return fstype_dict[soc_family]
64
65 elif param == 'rootfs-opt':
66 if not initramfs_image or soc_family == 'versal':
67 sd_index = "1"
68 if soc_family == 'zynq': sd_index = "0"
69 return ' -drive if=sd,index=%s,file=@ROOTFS@,format=raw' % (sd_index)
70 elif soc_family not in ('zynq') or 'microblaze' in tune_features:
71 return ' -device loader,file=@ROOTFS@,addr=0x04000000,force-raw=on'
72 12
73def qemu_default_dtb(d): 13# depend on qemu-helper-native, which will depend on QEMU
74 if d.getVar("IMAGE_BOOT_FILES", True): 14EXTRA_IMAGEDEPENDS += "qemu-system-native qemu-helper-native:do_addto_recipe_sysroot"
75 dtbs = d.getVar("IMAGE_BOOT_FILES", True).split(" ")
76 # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>'
77 # Note: Wildcard sources work here only because runqemu expands them at run time
78 dtbs = [f.split(";")[0] for f in dtbs]
79 dtbs = [f for f in dtbs if f.endswith(".dtb")]
80 if len(dtbs) != 0:
81 return dtbs[0]
82 return ""
83
84def qemu_default_serial(d):
85 if d.getVar("SERIAL_CONSOLES", True):
86 first_console = d.getVar("SERIAL_CONSOLES", True).split(" ")[0]
87 speed, console = first_console.split(";", 1)
88 # zynqmp uses earlycon and stdout (in dtb)
89 if "zynqmp" in d.getVar("MACHINEOVERRIDES", True).split(":"):
90 return ""
91 return "console=%s,%s earlyprintk" % (console, speed)
92 return ""
93
94def qemu_target_binary(d):
95 ta = d.getVar("TARGET_ARCH", True)
96 if ta == "microblazeeb":
97 ta = "microblaze"
98 elif ta == "arm":
99 ta = "aarch64"
100 return "qemu-system-%s" % ta
101
102def qemu_zynqmp_unhalt(d, multiarch):
103 if multiarch:
104 return "-global xlnx,zynqmp-boot.cpu-num=0 -global xlnx,zynqmp-boot.use-pmufw=true"
105 return "-device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4 -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4"
106 15
107# For qemuboot, default setup across all machines in meta-xilinx 16# Use the xilinx specific version for these users
108QB_SYSTEM_NAME:aarch64 ?= "${@qemu_target_binary(d)}-multiarch" 17IMAGE_CLASSES += "qemuboot-xilinx"
109QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}"
110QB_DEFAULT_FSTYPE ?= "cpio"
111QB_DTB ?= "${@qemu_default_dtb(d)}"