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/ep108-zynqmp.conf | 11 ++------- conf/machine/include/machine-xilinx-qemu.inc | 35 ++++++++++++++++++++++++++++ conf/machine/qemumicroblaze-s3adsp1800.conf | 9 ++----- conf/machine/qemumicroblaze.conf | 9 ++----- conf/machine/qemuzynq.conf | 10 ++------ conf/machine/zcu102-zynqmp.conf | 11 ++------- 6 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 conf/machine/include/machine-xilinx-qemu.inc diff --git a/conf/machine/ep108-zynqmp.conf b/conf/machine/ep108-zynqmp.conf index 2eabecf3..3b08248e 100644 --- a/conf/machine/ep108-zynqmp.conf +++ b/conf/machine/ep108-zynqmp.conf @@ -5,12 +5,10 @@ require conf/machine/include/tune-zynqmp.inc require conf/machine/include/machine-xilinx-default.inc require conf/machine/include/machine-xilinx-board.inc +require conf/machine/include/machine-xilinx-qemu.inc MACHINE_FEATURES = "" -# This machine has a qemu machine model -EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" - SERIAL_CONSOLE = "115200 ttyPS0" KERNEL_DEVICETREE = "xilinx/zynqmp-ep108.dtb" @@ -21,15 +19,10 @@ UBOOT_ENTRYPOINT = "0x80000" EXTRA_IMAGEDEPENDS += "arm-trusted-firmware" -# For runqemu -IMAGE_CLASSES += "qemuboot" -QB_SYSTEM_NAME = "qemu-system-aarch64" +# This machine has a QEMU model, runqemu setup: QB_MACHINE = "-machine xlnx-ep108" QB_MEM = "-m 2048" -QB_DTB = "${KERNEL_IMAGETYPE}-${@os.path.splitext(os.path.basename(d.getVar("KERNEL_DEVICETREE",True)))[0]}.dtb" QB_OPT_APPEND = "-nographic -serial mon:stdio -serial null" -QB_DEFAULT_FSTYPE = "cpio" -QB_KERNEL_CMDLINE_APPEND = "console=ttyPS0" QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -net nic,netdev=net0,macaddr=@MAC@" QB_SLIRP_OPT = "-netdev user,id=net0 -net nic,netdev=net0" 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)}" + diff --git a/conf/machine/qemumicroblaze-s3adsp1800.conf b/conf/machine/qemumicroblaze-s3adsp1800.conf index 65a85003..4eb5061f 100644 --- a/conf/machine/qemumicroblaze-s3adsp1800.conf +++ b/conf/machine/qemumicroblaze-s3adsp1800.conf @@ -4,26 +4,21 @@ require conf/machine/include/tune-microblaze.inc require conf/machine/include/machine-xilinx-default.inc +require conf/machine/include/machine-xilinx-qemu.inc TUNE_FEATURES_tune-microblaze += "v7.30 big-endian barrel-shift pattern-compare multiply-low" MACHINE_FEATURES = "" -EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" - USE_VT = "" SERIAL_CONSOLE = "115200 ttyUL0" MACHINE_ESSENTIAL_EXTRA_RDEPENDS_remove = "device-tree" -# For runqemu -IMAGE_CLASSES += "qemuboot" -QB_SYSTEM_NAME = "qemu-system-microblaze" +# This machine is a targeting a QEMU model, runqemu setup: QB_MEM = "-m 256" QB_MACHINE = "-machine petalogix-s3adsp1800" QB_OPT_APPEND = "-nographic -serial mon:stdio" -QB_DEFAULT_FSTYPE = "cpio" -QB_KERNEL_CMDLINE_APPEND = "console=ttyUL0 earlyprintk" QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -net nic,netdev=net0,macaddr=@MAC@" QB_SLIRP_OPT = "-netdev user,id=net0 -net nic,netdev=net0" diff --git a/conf/machine/qemumicroblaze.conf b/conf/machine/qemumicroblaze.conf index 067b6d0c..6fca065e 100644 --- a/conf/machine/qemumicroblaze.conf +++ b/conf/machine/qemumicroblaze.conf @@ -4,27 +4,22 @@ require conf/machine/include/tune-microblaze.inc require conf/machine/include/machine-xilinx-default.inc +require conf/machine/include/machine-xilinx-qemu.inc TUNE_FEATURES_tune-microblaze += "v8.50 little-endian barrel-shift reorder pattern-compare divide-hard multiply-high fpu-hard" MACHINE_FEATURES = "" -EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" - USE_VT = "" SERIAL_CONSOLE = "115200 ttyS0" # Use the networking setup from qemuarm FILESOVERRIDES_append_pn-init-ifupdown = ":qemuarm" -# For runqemu -IMAGE_CLASSES += "qemuboot" -QB_SYSTEM_NAME = "qemu-system-microblazeel" +# This machine is a targeting a QEMU model, runqemu setup: QB_MEM = "-m 256" QB_MACHINE = "-machine petalogix-ml605" QB_OPT_APPEND = "-nographic -serial mon:stdio" -QB_DEFAULT_FSTYPE = "cpio" -QB_KERNEL_CMDLINE_APPEND = "console=ttyS0 earlyprintk" QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -net nic,netdev=net0,macaddr=@MAC@" QB_SLIRP_OPT = "-netdev user,id=net0 -net nic,netdev=net0" diff --git a/conf/machine/qemuzynq.conf b/conf/machine/qemuzynq.conf index e9767d98..70ea9e0e 100644 --- a/conf/machine/qemuzynq.conf +++ b/conf/machine/qemuzynq.conf @@ -4,11 +4,10 @@ require conf/machine/include/tune-zynq.inc require conf/machine/include/machine-xilinx-default.inc +require conf/machine/include/machine-xilinx-qemu.inc MACHINE_FEATURES = "ext2 vfat" -EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" - SERIAL_CONSOLE = "115200 ttyPS0" MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" @@ -17,15 +16,10 @@ MACHINE_DEVICETREE = "qemu/qemuzynq.dts" # Use the networking setup from qemuarm FILESOVERRIDES_append_pn-init-ifupdown = ":qemuarm" -# For runqemu -IMAGE_CLASSES += "qemuboot" -QB_SYSTEM_NAME = "qemu-system-arm" +# This machine is a targeting a QEMU model, runqemu setup: QB_MEM = "-m 1024" QB_MACHINE = "-machine xilinx-zynq-a9" -QB_DTB = "${MACHINE}.dtb" QB_OPT_APPEND = "-nographic -serial null -serial mon:stdio" -QB_DEFAULT_FSTYPE = "cpio" -QB_KERNEL_CMDLINE_APPEND = "console=ttyPS0" QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -net nic,netdev=net0,macaddr=@MAC@" QB_SLIRP_OPT = "-netdev user,id=net0 -net nic,netdev=net0" diff --git a/conf/machine/zcu102-zynqmp.conf b/conf/machine/zcu102-zynqmp.conf index f762922a..a38ac4ac 100644 --- a/conf/machine/zcu102-zynqmp.conf +++ b/conf/machine/zcu102-zynqmp.conf @@ -6,12 +6,10 @@ require conf/machine/include/tune-zynqmp.inc require conf/machine/include/machine-xilinx-default.inc require conf/machine/include/machine-xilinx-board.inc +require conf/machine/include/machine-xilinx-qemu.inc MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost mali" -# This machine has a qemu machine model -EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" - UBOOT_MACHINE = "xilinx_zynqmp_zcu102_revB_defconfig" SERIAL_CONSOLE = "115200 ttyPS0" @@ -25,15 +23,10 @@ EXTRA_IMAGEDEPENDS += "\ arm-trusted-firmware \ " -# For runqemu -IMAGE_CLASSES += "qemuboot" -QB_SYSTEM_NAME = "qemu-system-aarch64" +# This machine has a QEMU model, runqemu setup: QB_MACHINE = "-machine xlnx-zcu102" QB_MEM = "-m 2048" -QB_DTB = "${KERNEL_IMAGETYPE}-${@os.path.splitext(os.path.basename(d.getVar("KERNEL_DEVICETREE",True)))[0]}.dtb" QB_OPT_APPEND = "-nographic -serial mon:stdio -serial null" -QB_DEFAULT_FSTYPE = "cpio" -QB_KERNEL_CMDLINE_APPEND = "console=ttyPS0" QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -net nic -net nic -net nic -net nic,netdev=net0,macaddr=@MAC@" QB_SLIRP_OPT = "-netdev user,id=net0 -net nic -net nic -net nic -net nic,netdev=net0" -- cgit v1.2.3-54-g00ecf