summaryrefslogtreecommitdiffstats
path: root/conf/machine/include
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2016-09-21 00:09:21 +1000
committerNathan Rossi <nathan@nathanrossi.com>2016-10-11 21:10:40 +1000
commit2147f108ef9cfbdb83304c08dc511df4286ded9c (patch)
treebdfbbeb4939d4213f159ea42f960eefb402926a8 /conf/machine/include
parenteff4a495cbafd787d39ab5afb75f1525e7685ec7 (diff)
downloadmeta-xilinx-2147f108ef9cfbdb83304c08dc511df4286ded9c.tar.gz
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 <nathan@nathanrossi.com>
Diffstat (limited to 'conf/machine/include')
-rw-r--r--conf/machine/include/machine-xilinx-qemu.inc35
1 files changed, 35 insertions, 0 deletions
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 @@
1EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native"
2
3def qemu_default_dtb(d):
4 if d.getVar("MACHINE_DEVICETREE", True):
5 dtbs = d.getVar("MACHINE_DEVICETREE", True).split(" ")
6 dtbs = [os.path.splitext(os.path.basename(d)) for d in dtbs]
7 dtbs = ["%s.dtb" % name for name, ext in dtbs if ext == ".dts" or ext == ".dtb"]
8 return dtbs[0] if dtbs else ""
9 elif d.getVar("KERNEL_DEVICETREE", True):
10 dtbs = d.getVar("KERNEL_DEVICETREE", True).split(" ")
11 dtbs = [os.path.basename(d) for d in dtbs]
12 return d.getVar("KERNEL_IMAGETYPE", True) + "-" + (dtbs[0] if dtbs else "")
13 return ""
14
15def qemu_default_serial(d):
16 if d.getVar("SERIAL_CONSOLE", True):
17 speed, console = d.getVar("SERIAL_CONSOLE", True).split(" ", 1)
18 return "console=%s,%s earlyprintk" % (console, speed)
19 return ""
20
21def qemu_target_binary(d):
22 ta = d.getVar("TARGET_ARCH", True)
23 if ta == "microblazeeb":
24 ta = "microblaze"
25 elif ta == "arm":
26 ta = "aarch64"
27 return "qemu-system-%s" % ta
28
29# For runqemu, default setup across all machines in meta-xilinx
30IMAGE_CLASSES += "qemuboot"
31QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}"
32QB_DEFAULT_FSTYPE ?= "cpio"
33QB_DTB ?= "${@qemu_default_dtb(d)}"
34QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}"
35