diff options
| author | Nathan Rossi <nathan@nathanrossi.com> | 2016-09-21 00:09:21 +1000 |
|---|---|---|
| committer | Nathan Rossi <nathan@nathanrossi.com> | 2016-10-11 21:10:40 +1000 |
| commit | 2147f108ef9cfbdb83304c08dc511df4286ded9c (patch) | |
| tree | bdfbbeb4939d4213f159ea42f960eefb402926a8 /conf/machine/include | |
| parent | eff4a495cbafd787d39ab5afb75f1525e7685ec7 (diff) | |
| download | meta-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.inc | 35 |
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 @@ | |||
| 1 | EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" | ||
| 2 | |||
| 3 | def 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 | |||
| 15 | def 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 | |||
| 21 | def 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 | ||
| 30 | IMAGE_CLASSES += "qemuboot" | ||
| 31 | QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}" | ||
| 32 | QB_DEFAULT_FSTYPE ?= "cpio" | ||
| 33 | QB_DTB ?= "${@qemu_default_dtb(d)}" | ||
| 34 | QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}" | ||
| 35 | |||
