From 2147f108ef9cfbdb83304c08dc511df4286ded9c Mon Sep 17 00:00:00 2001 From: Nathan Rossi Date: Wed, 21 Sep 2016 00:09:21 +1000 Subject: machine-xilinx-qemu.inc: Move common runqemu setup to include Move the common setup for QEMU machines into an include call 'machine-xilinx-qemu.inc'. This include is added to any machine that has a QEMU model. It sets up common QB_* values as well as inheriting the qemuboot class and adding the EXTRA_IMAGEDEPENDS on qemu-native. This include also has helper functions to automatically determine the DTB from KERNEL_DEVICETREE/MACHINE_DEVICETREE and automatically setup the 'console=' kernel command line based on SERIAL_CONSOLE. Signed-off-by: Nathan Rossi --- conf/machine/include/machine-xilinx-qemu.inc | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 conf/machine/include/machine-xilinx-qemu.inc (limited to 'conf/machine/include') diff --git a/conf/machine/include/machine-xilinx-qemu.inc b/conf/machine/include/machine-xilinx-qemu.inc new file mode 100644 index 00000000..25bf7dec --- /dev/null +++ b/conf/machine/include/machine-xilinx-qemu.inc @@ -0,0 +1,35 @@ +EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" + +def qemu_default_dtb(d): + if d.getVar("MACHINE_DEVICETREE", True): + dtbs = d.getVar("MACHINE_DEVICETREE", True).split(" ") + dtbs = [os.path.splitext(os.path.basename(d)) for d in dtbs] + dtbs = ["%s.dtb" % name for name, ext in dtbs if ext == ".dts" or ext == ".dtb"] + return dtbs[0] if dtbs else "" + elif d.getVar("KERNEL_DEVICETREE", True): + dtbs = d.getVar("KERNEL_DEVICETREE", True).split(" ") + dtbs = [os.path.basename(d) for d in dtbs] + return d.getVar("KERNEL_IMAGETYPE", True) + "-" + (dtbs[0] if dtbs else "") + return "" + +def qemu_default_serial(d): + if d.getVar("SERIAL_CONSOLE", True): + speed, console = d.getVar("SERIAL_CONSOLE", True).split(" ", 1) + return "console=%s,%s earlyprintk" % (console, speed) + return "" + +def qemu_target_binary(d): + ta = d.getVar("TARGET_ARCH", True) + if ta == "microblazeeb": + ta = "microblaze" + elif ta == "arm": + ta = "aarch64" + return "qemu-system-%s" % ta + +# For runqemu, default setup across all machines in meta-xilinx +IMAGE_CLASSES += "qemuboot" +QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}" +QB_DEFAULT_FSTYPE ?= "cpio" +QB_DTB ?= "${@qemu_default_dtb(d)}" +QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}" + -- cgit v1.2.3-54-g00ecf