[dts] [PATCH] qemu-kvm: Add support to provide Kernel Image explicitly to boot VM

Tu, Lijuan lijuan.tu at intel.com
Wed Jul 3 08:07:36 CEST 2019


Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of
> pvukkisala at marvell.com
> Sent: Thursday, June 27, 2019 4:33 PM
> To: dts at dpdk.org
> Cc: avijay at marvell.com; fmasood at marvell.com; Phanendra Vukkisala
> <pvukkisala at marvell.com>
> Subject: [dts] [PATCH] qemu-kvm: Add support to provide Kernel Image
> explicitly to boot VM
> 
> From: Phanendra Vukkisala <pvukkisala at marvell.com>
> 
> Enables option to boot VM with Kernel Image which is not part of VM image.
> Enables provding kernel boot parameters from configs
> 
> Signed-off-by: Phanendra Vukkisala <pvukkisala at marvell.com>
> ---
>  conf/sriov_kvm.cfg    |   10 ++++++++++
>  framework/qemu_kvm.py |   26 ++++++++++++++++++++++++++
>  2 files changed, 36 insertions(+)
> 
> diff --git a/conf/sriov_kvm.cfg b/conf/sriov_kvm.cfg index a7ba884..8106e04
> 100644
> --- a/conf/sriov_kvm.cfg
> +++ b/conf/sriov_kvm.cfg
> @@ -98,6 +98,16 @@
>  #           note:
>  #               By default VM will start with the daemonize status.
>  #               Not support starting it on the stdin now.
> +#
> +#kernel
> +#       kernel_img: <path of kernel image>
> +#           note: adding kernel_img use this kernel and following argument to
> as
> +#                 kernel boot command args
> +#       console: ttyS0
> +#       baudrate: 115200
> +#       root: /dev/sda2 rw rootwait
> +#           note: along with root path, can provide any other extra parameters
> +#
> 
> 
>  # vm configuration for pmd sriov case
> diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index
> 80a39c8..8408795 100644
> --- a/framework/qemu_kvm.py
> +++ b/framework/qemu_kvm.py
> @@ -483,6 +483,32 @@ class QEMUKvm(VirtBase):
>              elif options['type'] in ['tap', 'bridge']:
>                  self.net_type = 'bridge'
> 
> +    def add_vm_kernel(self, **options):
> +        """
> +        Add Kernel Image explicitly
> +        kernel_img: path to kernel Image
> +        console: console details in kernel boot args
> +        baudrate: console access baudrate in kernel boot args
> +        root: root partition details in kernel boot args
> +        """
> +        print options
> +        if 'kernel_img' in options.keys() and options['kernel_img']:
> +            kernel_boot_line = '-kernel %s' % options['kernel_img']
> +        else:
> +            return False
> +        self.__add_boot_line(kernel_boot_line)
> +        kernel_args = ""
> +        if 'console' in options.keys() and options['console']:
> +            kernel_args = "console=%s" %options['console']
> +            if 'baudrate' in options.keys() and options['baudrate']:
> +                kernel_args += "," + options['baudrate']
> +        if 'root' in options.keys() and options['root']:
> +            kernel_args += " root=%s" %options['root']
> +        if kernel_args:
> +            append_boot_line = '--append \"%s\"' %kernel_args
> +            self.__add_boot_line(append_boot_line)
> +
> +
>      def __add_vm_net_nic(self, **options):
>          """
>          type: nic
> --
> 1.7.9.5



More information about the dts mailing list