summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2017-04-14 00:05:20 +1000
committerNathan Rossi <nathan@nathanrossi.com>2017-04-28 00:22:19 +1000
commit3119a03a3db979541a5a20884e393c3b0868f9b5 (patch)
treefc381dbc0a395875e3aa4542bd71fce9abea1ef4
parenta765a5bdbf0da72704bbe88171571ecc82668a0a (diff)
downloadmeta-xilinx-3119a03a3db979541a5a20884e393c3b0868f9b5.tar.gz
qemuboot-xilinx.bbclass: Rework qemu-xilinx setup
This change reworks how the meta-xilinx layer enables and provides the custom version of QEMU based on Xilinx's fork of QEMU. The existing implementation relied on the single sysroot which was changed in oe-core such that now recipes have their own sysroots (RSS support). Additionally oe-core now provides the QEMU binaries to the runqemu script via the 'qemu-helper-native' recipes sysroot as opposed to the image sysroot. These rework changes allow for a single machine to select the targeted QEMU version as well as to provide the qemuboot config specific to the targeted QEMU version. The selection of QEMU version is now handled by PREFERRED_PROVIDER mechanics with the meta-xilinx layer providing an additional recipe that is equivalent to qemu-helper-native and which also provides said target allowing for the machine to select via the use of PREFERRED_PROVIDER_qemu-helper-native. This recipe (qemu-xilinx-helper-native) however instead provides the sysroot populated with qemu-xilinx instead of qemu. Additionally the XILINX_QEMUBOOT variable is replaced with the qemuboot-xilinx.bbclass, this provides the overrides for setting up qemu-xilinx specific QB_* args. Additionally this bbclass points runqemu at the qemu-xilinx-helper-native sysroot for QEMU binaries. These changes also work towards making the meta-xilinx layer better handle multiple qemuboot.conf variants as well as handling different QEMU versions. This change also removes the 'qemu-system-xilinx' MACHINE_FEATURES, this is due to MACHINE_FEATURES no longer being available for native recipes. Additionally there is no longer any logic that needs to know this any way. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
-rw-r--r--classes/qemuboot-xilinx.bbclass27
-rw-r--r--conf/machine/include/machine-xilinx-qemu.inc39
-rw-r--r--conf/machine/ml605-qemu-microblazeel.conf1
-rw-r--r--conf/machine/qemu-zynq7.conf1
-rw-r--r--conf/machine/s3adsp1800-qemu-microblazeeb.conf1
-rw-r--r--conf/machine/zcu102-zynqmp.conf8
-rw-r--r--recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb20
7 files changed, 61 insertions, 36 deletions
diff --git a/classes/qemuboot-xilinx.bbclass b/classes/qemuboot-xilinx.bbclass
new file mode 100644
index 00000000..024626cb
--- /dev/null
+++ b/classes/qemuboot-xilinx.bbclass
@@ -0,0 +1,27 @@
1
2# enable the overrides for the context of the conf only
3OVERRIDES .= ":qemuboot-xilinx"
4
5# setup the target binary
6QB_SYSTEM_NAME_prepend = "qemu-xilinx/"
7
8# Default machine targets for Xilinx QEMU (FDT Generic)
9QB_MACHINE_aarch64 = "-machine arm-generic-fdt"
10QB_MACHINE_arm = "-machine arm-generic-fdt-7series"
11QB_MACHINE_microblaze = "-machine microblaze-generic-fdt-plnx"
12
13# defaults
14QB_DEFAULT_KERNEL ?= "none"
15
16inherit qemuboot
17
18# rewrite the qemuboot with the custom sysroot bindir
19python do_write_qemuboot_conf_append() {
20 val = os.path.join(d.getVar('BASE_WORKDIR'), d.getVar('BUILD_SYS'), 'qemu-xilinx-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/')
21 cf.set('config_bsp', 'STAGING_BINDIR_NATIVE', '%s' % val)
22
23 # write out the updated version from this append
24 with open(qemuboot, 'w') as f:
25 cf.write(f)
26}
27
diff --git a/conf/machine/include/machine-xilinx-qemu.inc b/conf/machine/include/machine-xilinx-qemu.inc
index 2701df20..938d76d4 100644
--- a/conf/machine/include/machine-xilinx-qemu.inc
+++ b/conf/machine/include/machine-xilinx-qemu.inc
@@ -1,4 +1,8 @@
1EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" 1# 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"
2 6
3def qemu_default_dtb(d): 7def qemu_default_dtb(d):
4 if d.getVar("IMAGE_BOOT_FILES", True): 8 if d.getVar("IMAGE_BOOT_FILES", True):
@@ -30,42 +34,11 @@ def qemu_target_binary(d):
30 ta = "microblaze" 34 ta = "microblaze"
31 elif ta == "arm": 35 elif ta == "arm":
32 ta = "aarch64" 36 ta = "aarch64"
33 if qemuboot_xilinx_enabled(d):
34 return "qemu-xilinx/qemu-system-%s" % ta
35 return "qemu-system-%s" % ta 37 return "qemu-system-%s" % ta
36 38
37def qemuboot_xilinx_enabled(d): 39# For qemuboot, default setup across all machines in meta-xilinx
38 if bb.utils.contains("MACHINE_FEATURES", "qemu-system-xilinx", True, False, d):
39 if d.getVar("XILINX_QEMUBOOT", True) == "1":
40 return True
41 return False
42
43# For runqemu, default setup across all machines in meta-xilinx
44IMAGE_CLASSES += "qemuboot"
45QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}" 40QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}"
46QB_DEFAULT_FSTYPE ?= "cpio" 41QB_DEFAULT_FSTYPE ?= "cpio"
47
48XILINX_QEMUBOOT[doc] = "Set this variable to '1' to enable the generation of qemuboot.conf which uses the Xilinx QEMU."
49XILINX_QEMUBOOT ??= ""
50
51# Dependencies for native Xilinx QEMU
52XILINX_QEMU_DEPENDS ?= "qemu-xilinx-native"
53# If the machine supports the Xilinx QEMU, add the dependencies
54EXTRA_IMAGEDEPENDS += "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-system-xilinx', '${XILINX_QEMU_DEPENDS}', '', d)}"
55
56# Add an override for when booting with the Xilinx QEMU
57MACHINEOVERRIDES .= "${@':qemuboot-xilinx' if qemuboot_xilinx_enabled(d) else ''}"
58
59# This is ignored if using Xilinx's QEMU fork
60QB_DTB ?= "${@qemu_default_dtb(d)}" 42QB_DTB ?= "${@qemu_default_dtb(d)}"
61
62# ZynqMP machines need special "-hw-dtb" device trees for the Xilinx QEMU
63XILINX_QEMU_DEPENDS_append_zynqmp = " qemu-devicetrees"
64
65QB_DEFAULT_KERNEL_qemuboot-xilinx = "none"
66QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}" 43QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}"
67 44
68# Default machine targets for Xilinx QEMU (FDT Generic)
69QB_MACHINE_qemuboot-xilinx_aarch64 = "-machine arm-generic-fdt"
70QB_MACHINE_qemuboot-xilinx_arm = "-machine arm-generic-fdt-plnx"
71QB_MACHINE_qemuboot-xilinx_microblaze = "-machine microblaze-generic-fdt"
diff --git a/conf/machine/ml605-qemu-microblazeel.conf b/conf/machine/ml605-qemu-microblazeel.conf
index a0ef7d3e..731f26f3 100644
--- a/conf/machine/ml605-qemu-microblazeel.conf
+++ b/conf/machine/ml605-qemu-microblazeel.conf
@@ -17,6 +17,7 @@ SERIAL_CONSOLE = "115200 ttyS0"
17FILESOVERRIDES_append_pn-init-ifupdown = ":qemuarm" 17FILESOVERRIDES_append_pn-init-ifupdown = ":qemuarm"
18 18
19# This machine is a targeting a QEMU model, runqemu setup: 19# This machine is a targeting a QEMU model, runqemu setup:
20IMAGE_CLASSES += "qemuboot"
20QB_MEM = "-m 256" 21QB_MEM = "-m 256"
21QB_MACHINE = "-machine petalogix-ml605" 22QB_MACHINE = "-machine petalogix-ml605"
22QB_OPT_APPEND = "-nographic -serial mon:stdio" 23QB_OPT_APPEND = "-nographic -serial mon:stdio"
diff --git a/conf/machine/qemu-zynq7.conf b/conf/machine/qemu-zynq7.conf
index 6073211c..0fe99e27 100644
--- a/conf/machine/qemu-zynq7.conf
+++ b/conf/machine/qemu-zynq7.conf
@@ -17,6 +17,7 @@ IMAGE_BOOT_FILES += "${MACHINE}.dtb"
17FILESOVERRIDES_append_pn-init-ifupdown = ":qemuarm" 17FILESOVERRIDES_append_pn-init-ifupdown = ":qemuarm"
18 18
19# This machine is a targeting a QEMU model, runqemu setup: 19# This machine is a targeting a QEMU model, runqemu setup:
20IMAGE_CLASSES += "qemuboot"
20QB_MEM = "-m 1024" 21QB_MEM = "-m 1024"
21QB_MACHINE = "-machine xilinx-zynq-a9" 22QB_MACHINE = "-machine xilinx-zynq-a9"
22QB_OPT_APPEND = "-nographic -serial null -serial mon:stdio" 23QB_OPT_APPEND = "-nographic -serial null -serial mon:stdio"
diff --git a/conf/machine/s3adsp1800-qemu-microblazeeb.conf b/conf/machine/s3adsp1800-qemu-microblazeeb.conf
index 2577faab..16bf4d46 100644
--- a/conf/machine/s3adsp1800-qemu-microblazeeb.conf
+++ b/conf/machine/s3adsp1800-qemu-microblazeeb.conf
@@ -16,6 +16,7 @@ SERIAL_CONSOLE = "115200 ttyUL0"
16MACHINE_ESSENTIAL_EXTRA_RDEPENDS_remove = "device-tree" 16MACHINE_ESSENTIAL_EXTRA_RDEPENDS_remove = "device-tree"
17 17
18# This machine is a targeting a QEMU model, runqemu setup: 18# This machine is a targeting a QEMU model, runqemu setup:
19IMAGE_CLASSES += "qemuboot"
19QB_MEM = "-m 256" 20QB_MEM = "-m 256"
20QB_MACHINE = "-machine petalogix-s3adsp1800" 21QB_MACHINE = "-machine petalogix-s3adsp1800"
21QB_OPT_APPEND = "-nographic -serial mon:stdio" 22QB_OPT_APPEND = "-nographic -serial mon:stdio"
diff --git a/conf/machine/zcu102-zynqmp.conf b/conf/machine/zcu102-zynqmp.conf
index c55b536c..2e3c1367 100644
--- a/conf/machine/zcu102-zynqmp.conf
+++ b/conf/machine/zcu102-zynqmp.conf
@@ -7,7 +7,7 @@ require conf/machine/include/machine-xilinx-default.inc
7require conf/machine/include/machine-xilinx-board.inc 7require conf/machine/include/machine-xilinx-board.inc
8require conf/machine/include/machine-xilinx-qemu.inc 8require conf/machine/include/machine-xilinx-qemu.inc
9 9
10MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost mali qemu-system-xilinx" 10MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost mali"
11 11
12UBOOT_MACHINE = "xilinx_zynqmp_zcu102_revB_defconfig" 12UBOOT_MACHINE = "xilinx_zynqmp_zcu102_revB_defconfig"
13 13
@@ -20,16 +20,18 @@ PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-xlnx"
20 20
21EXTRA_IMAGEDEPENDS += "\ 21EXTRA_IMAGEDEPENDS += "\
22 arm-trusted-firmware \ 22 arm-trusted-firmware \
23 qemu-devicetrees \
23 " 24 "
24 25
25# This machine has a QEMU model, runqemu setup: 26# This machine has a QEMU model, runqemu setup:
27IMAGE_CLASSES += "qemuboot-xilinx"
26QB_MACHINE = "-machine xlnx-zcu102" 28QB_MACHINE = "-machine xlnx-zcu102"
27QB_MEM = "-m 2048" 29QB_MEM = "-m 2048"
28QB_OPT_APPEND = "-nographic -serial mon:stdio -serial null" 30QB_OPT_APPEND = "-nographic -serial mon:stdio -serial null"
29QB_NETWORK_DEVICE = "-net nic -net nic -net nic -net nic,netdev=net0,macaddr=@MAC@" 31QB_NETWORK_DEVICE = "-net nic -net nic -net nic -net nic,netdev=net0,macaddr=@MAC@"
30 32
31# Xilinx QEMU options, default to using Xilinx QEMU 33# Use qemu-xilinx instead of mainline
32XILINX_QEMUBOOT ?= "1" 34PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native"
33 35
34# Reset and unhalt CPU0, load the boot media. 36# Reset and unhalt CPU0, load the boot media.
35QB_OPT_APPEND_append_qemuboot-xilinx = " \ 37QB_OPT_APPEND_append_qemuboot-xilinx = " \
diff --git a/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb b/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb
new file mode 100644
index 00000000..f04be960
--- /dev/null
+++ b/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb
@@ -0,0 +1,20 @@
1
2def get_filespath_extra(d, subpath):
3 metaroot = next((p for p in d.getVar('BBPATH').split(':') if os.path.basename(p) == 'meta'), None)
4 if metaroot:
5 return os.path.join(metaroot, subpath) + ":"
6 return ""
7
8# TODO: improve this, since it is very hacky that this recipe need to build tunctl.
9# include the existing qemu-helper-native
10require recipes-devtools/qemu/qemu-helper-native_1.0.bb
11# get the path to tunctl.c
12FILESEXTRAPATHS_prepend := "${@get_filespath_extra(d, 'recipes-devtools/qemu/qemu-helper')}"
13
14# provide it, to replace the existing
15PROVIDES += "qemu-helper-native"
16
17# replace qemu with qemu-xilinx
18DEPENDS_remove = "qemu-native"
19DEPENDS_append = " qemu-xilinx-native"
20