[meta-xilinx] [RFC v1 3/4] machine-xilinx-qemu.inc: Add support for starting Xilinx's QEMU

Alistair Francis alistair.francis at xilinx.com
Mon Jan 16 14:10:48 PST 2017


On Mon, Jan 16, 2017 at 1:55 AM, Nathan Rossi <nathan at nathanrossi.com> wrote:
> On 14 January 2017 at 10:32, Alistair Francis
> <alistair.francis at xilinx.com> wrote:
>> This patch adds support to the general include file to boot Xilinx's
>> QEMU machines.
>>
>> Signed-off-by: Alistair Francis <alistair.francis at xilinx.com>
>> Signed-off-by: Nathan Rossi <nathan at nathanrossi.com>
>> ---
>>  conf/machine/include/machine-xilinx-qemu.inc | 35 +++++++++++++++++++++++++++-
>>  1 file changed, 34 insertions(+), 1 deletion(-)
>>
>> diff --git a/conf/machine/include/machine-xilinx-qemu.inc b/conf/machine/include/machine-xilinx-qemu.inc
>> index 25bf7de..e159f59 100644
>> --- a/conf/machine/include/machine-xilinx-qemu.inc
>> +++ b/conf/machine/include/machine-xilinx-qemu.inc
>> @@ -15,6 +15,9 @@ def qemu_default_dtb(d):
>>  def qemu_default_serial(d):
>>      if d.getVar("SERIAL_CONSOLE", True):
>>          speed, console = d.getVar("SERIAL_CONSOLE", True).split(" ", 1)
>> +        # zynqmp uses earlycon and stdout (in dtb)
>> +        if "zynqmp" in d.getVar("MACHINEOVERRIDES", True).split(":"):
>> +            return ""
>>          return "console=%s,%s earlyprintk" % (console, speed)
>>      return ""
>>
>> @@ -24,12 +27,42 @@ def qemu_target_binary(d):
>>          ta = "microblaze"
>>      elif ta == "arm":
>>          ta = "aarch64"
>> +    if qemuboot_xilinx_enabled(d):
>> +        return "qemu-xilinx/qemu-system-%s" % ta
>>      return "qemu-system-%s" % ta
>>
>> +def qemuboot_xilinx_enabled(d):
>> +    if bb.utils.contains("MACHINE_FEATURES", "qemu-system-xilinx", True, False, d):
>> +        if d.getVar("XILINX_QEMUBOOT", True) == "1":
>> +            return True
>> +    return False
>> +
>>  # For runqemu, default setup across all machines in meta-xilinx
>>  IMAGE_CLASSES += "qemuboot"
>>  QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}"
>> -QB_DEFAULT_FSTYPE ?= "cpio"
>> +
>> +XILINX_QEMUBOOT[doc] = "Set this variable to '1' to enable the generation of qemuboot.conf which uses the Xilinx QEMU."
>> +XILINX_QEMUBOOT ?= ""
>> +
>> +# Dependencies for native Xilinx QEMU
>> +XILINX_QEMU_DEPENDS ?= "qemu-xilinx-native"
>> +# If the machine supports the Xilinx QEMU, add the dependencies
>> +EXTRA_IMAGEDEPENDS += "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-system-xilinx', '${XILINX_QEMU_DEPENDS}', '', d)}"
>> +
>> +# Add an override for when booting with the Xilinx QEMU
>> +MACHINEOVERRIDES .= "${@':qemuboot-xilinx' if qemuboot_xilinx_enabled(d) else ''}"
>> +
>> +# This is ignored if using Xilinx's QEMU fork
>>  QB_DTB ?= "${@qemu_default_dtb(d)}"
>
> Should this also be overridden so that for qemuboot-xilinx QB_DTB =
> "". I remember it being mentioned that passing -dtb when using -hw-dtb
> causes issues? or does that only matter when directly booting into
> Linux?

It doesn't matter. As the kernel is set to 'none' the runqemu script
doesn't attach any -dtb option.

I can overwrite it to "" if you want, but it doesn't change how the script runs.

>
>> +
>> +# ZynqMP machines need special "-hw-dtb" device trees for the Xilinx QEMU
>> +XILINX_QEMU_DEPENDS_append_zynqmp = " qemu-devicetrees"
>> +
>> +QB_DEFAULT_FSTYPE ?= "${@'none' if qemuboot_xilinx_enabled(d) else 'cpio'}"
>> +QB_DEFAULT_KERNEL ?= "${@'none' if qemuboot_xilinx_enabled(d) else ''}"
>
> Should these instead be:
>
> QB_DEFAULT_FSTYPE_qemuboot-xilinx = "none"
> QB_DEFAULT_KERNEL_qemuboot-xilinx = "none"
>
> So that for the kernel one, it allows the default qemuboot case to still be
>
> QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}"
>
> from qemuboot.bbclass.

Yeah, good idea.

Thanks,

Alistair

>
> Regards,
> Nathan
>
>>  QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}"
>>
>> +# Default machine targets for Xilinx QEMU (FDT Generic)
>> +QB_MACHINE_qemuboot-xilinx_aarch64 = "-machine arm-generic-fdt"
>> +QB_MACHINE_qemuboot-xilinx_arm = "-machine arm-generic-fdt-plnx"
>> +QB_MACHINE_qemuboot-xilinx_microblaze = "-machine microblaze-generic-fdt"
>> --
>> 2.7.4
>>



More information about the meta-xilinx mailing list