runqemu: Add QB_KERNEL_CMDLINE

Message ID 20220615095916.16290-1-raju.kumar-pothuraju@xilinx.com
State New
Headers show
Series runqemu: Add QB_KERNEL_CMDLINE | expand

Commit Message

Raju Kumar Pothuraju June 15, 2022, 9:59 a.m. UTC
runqemu auto generating the KERNEL_CMDLINE values and specifying using
-append option to qemu boot command which will lead to override the
kernel_cmdline/bootargs which are specified in DTB when using -dtb option.
Add new macro QB_KERNEL_CMDLINE to specify not to add the runqemu
generated KERNEL_CMDLINE values instead use which are in the DTB if
value defined as 'none'.
Add provision to override bootargs using # runqemu bootparams="root=/dev/ram0"

Signed-off-by: Raju Kumar Pothuraju <raju.kumar-pothuraju@xilinx.com>
---
 scripts/runqemu | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Alexander Kanavin June 15, 2022, 11:11 a.m. UTC | #1
This means QB_KERNEL_CMDLINE needs to be set by default everywhere to
preserve existing behaviour, I'm not sure this is going to work. Can
you achieve the desired effect with a reverse condition?

Alex

On Wed, 15 Jun 2022 at 11:59, Raju Kumar Pothuraju
<raju.kumar-pothuraju@xilinx.com> wrote:
>
> runqemu auto generating the KERNEL_CMDLINE values and specifying using
> -append option to qemu boot command which will lead to override the
> kernel_cmdline/bootargs which are specified in DTB when using -dtb option.
> Add new macro QB_KERNEL_CMDLINE to specify not to add the runqemu
> generated KERNEL_CMDLINE values instead use which are in the DTB if
> value defined as 'none'.
> Add provision to override bootargs using # runqemu bootparams="root=/dev/ram0"
>
> Signed-off-by: Raju Kumar Pothuraju <raju.kumar-pothuraju@xilinx.com>
> ---
>  scripts/runqemu | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/runqemu b/scripts/runqemu
> index 6e1f073ed2..97ea37d690 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -1486,9 +1486,15 @@ class BaseConfig(object):
>      def start_qemu(self):
>          import shlex
>          if self.kernel:
> -            kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel, self.kernel_cmdline,
> +            kernel_opts = "-kernel %s" % (self.kernel)
> +            if self.get('QB_KERNEL_CMDLINE') != "none":
> +                kernel_opts += " -append '%s %s %s %s'" % (self.kernel_cmdline,
>                                                                  self.kernel_cmdline_script, self.get('QB_KERNEL_CMDLINE_APPEND'),
>                                                                  self.bootparams)
> +            else:
> +                if self.bootparams:
> +                    kernel_opts += " -append '%s'" % (self.bootparams)
> +
>              if self.dtb:
>                  kernel_opts += " -dtb %s" % self.dtb
>          else:
> --
> 2.17.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#166926): https://lists.openembedded.org/g/openembedded-core/message/166926
> Mute This Topic: https://lists.openembedded.org/mt/91773086/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexander Kanavin June 15, 2022, 11:27 a.m. UTC | #2
Right, I still find the naming confusing though. Can it be
QB_RUNQEMU_KERNEL_CMDLINE_SUPPRESS? The name needs to indicate that it
does not contain the actual cmdline, but only a flag to suppress it.

Alex

On Wed, 15 Jun 2022 at 13:19, Pothuraju, Rajukumar
<rajukumar.pothuraju@amd.com> wrote:
>
> Hi Alexander,
>
> > -----Original Message-----
> > From: Alexander Kanavin <alex.kanavin@gmail.com>
> > Sent: Wednesday, June 15, 2022 4:42 PM
> > To: Raju Kumar Pothuraju <raju.kumar-pothuraju@xilinx.com>
> > Cc: OE-core <openembedded-core@lists.openembedded.org>;
> > mark.hatle@xilinx.com
> > Subject: Re: [OE-core][PATCH] runqemu: Add QB_KERNEL_CMDLINE
> >
> > CAUTION: This message has originated from an External Source. Please use
> > proper judgment and caution when opening attachments, clicking links, or
> > responding to this email.
> >
> >
> > This means QB_KERNEL_CMDLINE needs to be set by default everywhere to
> > preserve existing behaviour, I'm not sure this is going to work. Can you
> > achieve the desired effect with a reverse condition?
> The default flow works as it is, to skip that you have to set QB_KERNEL_CMDLINE to "none".
>
> Regards,
> Rajukumar P.
> >
> > Alex
> >
> > On Wed, 15 Jun 2022 at 11:59, Raju Kumar Pothuraju <raju.kumar-
> > pothuraju@xilinx.com> wrote:
> > >
> > > runqemu auto generating the KERNEL_CMDLINE values and specifying using
> > > -append option to qemu boot command which will lead to override the
> > > kernel_cmdline/bootargs which are specified in DTB when using -dtb
> > option.
> > > Add new macro QB_KERNEL_CMDLINE to specify not to add the runqemu
> > > generated KERNEL_CMDLINE values instead use which are in the DTB if
> > > value defined as 'none'.
> > > Add provision to override bootargs using # runqemu
> > bootparams="root=/dev/ram0"
> > >
> > > Signed-off-by: Raju Kumar Pothuraju <raju.kumar-pothuraju@xilinx.com>
> > > ---
> > >  scripts/runqemu | 8 +++++++-
> > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/scripts/runqemu b/scripts/runqemu index
> > > 6e1f073ed2..97ea37d690 100755
> > > --- a/scripts/runqemu
> > > +++ b/scripts/runqemu
> > > @@ -1486,9 +1486,15 @@ class BaseConfig(object):
> > >      def start_qemu(self):
> > >          import shlex
> > >          if self.kernel:
> > > -            kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel,
> > self.kernel_cmdline,
> > > +            kernel_opts = "-kernel %s" % (self.kernel)
> > > +            if self.get('QB_KERNEL_CMDLINE') != "none":
> > > +                kernel_opts += " -append '%s %s %s %s'" %
> > > + (self.kernel_cmdline,
> > >                                                                  self.kernel_cmdline_script,
> > self.get('QB_KERNEL_CMDLINE_APPEND'),
> > >
> > > self.bootparams)
> > > +            else:
> > > +                if self.bootparams:
> > > +                    kernel_opts += " -append '%s'" %
> > > + (self.bootparams)
> > > +
> > >              if self.dtb:
> > >                  kernel_opts += " -dtb %s" % self.dtb
> > >          else:
> > > --
> > > 2.17.1
> > >
> > >
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > > Links: You receive all messages sent to this group.
> > > View/Reply Online (#166926):
> > > https://lists.openembedded.org/g/openembedded-core/message/166926
> > > Mute This Topic: https://lists.openembedded.org/mt/91773086/1686489
> > > Group Owner: openembedded-core+owner@lists.openembedded.org
> > > Unsubscribe: https://lists.openembedded.org/g/openembedded-
> > core/unsub
> > > [alex.kanavin@gmail.com]
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > >
Alexander Kanavin June 15, 2022, 3:21 p.m. UTC | #3
Right, that's ok then, although the naming for both could be improved.

Alex

On Wed, 15 Jun 2022 at 14:17, Pothuraju, Rajukumar
<rajukumar.pothuraju@amd.com> wrote:
>
> I have taken reference of QB_ROOTFS https://github.com/openembedded/openembedded-core/blob/master/scripts/runqemu#L1218 so QB_KERNEL_CMDLINE and QB_KERNEL_CMDLINE_APPEND will be in sync right.
>
> Regards,
> Rajukumar P.
>
> > -----Original Message-----
> > From: Alexander Kanavin <alex.kanavin@gmail.com>
> > Sent: Wednesday, June 15, 2022 4:57 PM
> > To: Pothuraju, Rajukumar <rajukumar.pothuraju@amd.com>
> > Cc: Raju Kumar Pothuraju <raju.kumar-pothuraju@xilinx.com>; OE-core
> > <openembedded-core@lists.openembedded.org>; mark.hatle@xilinx.com
> > Subject: Re: [OE-core][PATCH] runqemu: Add QB_KERNEL_CMDLINE
> >
> > CAUTION: This message has originated from an External Source. Please use
> > proper judgment and caution when opening attachments, clicking links, or
> > responding to this email.
> >
> >
> > Right, I still find the naming confusing though. Can it be
> > QB_RUNQEMU_KERNEL_CMDLINE_SUPPRESS? The name needs to indicate
> > that it does not contain the actual cmdline, but only a flag to suppress it.
> >
> > Alex
> >
> > On Wed, 15 Jun 2022 at 13:19, Pothuraju, Rajukumar
> > <rajukumar.pothuraju@amd.com> wrote:
> > >
> > > Hi Alexander,
> > >
> > > > -----Original Message-----
> > > > From: Alexander Kanavin <alex.kanavin@gmail.com>
> > > > Sent: Wednesday, June 15, 2022 4:42 PM
> > > > To: Raju Kumar Pothuraju <raju.kumar-pothuraju@xilinx.com>
> > > > Cc: OE-core <openembedded-core@lists.openembedded.org>;
> > > > mark.hatle@xilinx.com
> > > > Subject: Re: [OE-core][PATCH] runqemu: Add QB_KERNEL_CMDLINE
> > > >
> > > > CAUTION: This message has originated from an External Source. Please
> > > > use proper judgment and caution when opening attachments, clicking
> > > > links, or responding to this email.
> > > >
> > > >
> > > > This means QB_KERNEL_CMDLINE needs to be set by default everywhere
> > > > to preserve existing behaviour, I'm not sure this is going to work.
> > > > Can you achieve the desired effect with a reverse condition?
> > > The default flow works as it is, to skip that you have to set
> > QB_KERNEL_CMDLINE to "none".
> > >
> > > Regards,
> > > Rajukumar P.
> > > >
> > > > Alex
> > > >
> > > > On Wed, 15 Jun 2022 at 11:59, Raju Kumar Pothuraju <raju.kumar-
> > > > pothuraju@xilinx.com> wrote:
> > > > >
> > > > > runqemu auto generating the KERNEL_CMDLINE values and specifying
> > > > > using -append option to qemu boot command which will lead to
> > > > > override the kernel_cmdline/bootargs which are specified in DTB
> > > > > when using -dtb
> > > > option.
> > > > > Add new macro QB_KERNEL_CMDLINE to specify not to add the
> > runqemu
> > > > > generated KERNEL_CMDLINE values instead use which are in the DTB
> > > > > if value defined as 'none'.
> > > > > Add provision to override bootargs using # runqemu
> > > > bootparams="root=/dev/ram0"
> > > > >
> > > > > Signed-off-by: Raju Kumar Pothuraju
> > > > > <raju.kumar-pothuraju@xilinx.com>
> > > > > ---
> > > > >  scripts/runqemu | 8 +++++++-
> > > > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/scripts/runqemu b/scripts/runqemu index
> > > > > 6e1f073ed2..97ea37d690 100755
> > > > > --- a/scripts/runqemu
> > > > > +++ b/scripts/runqemu
> > > > > @@ -1486,9 +1486,15 @@ class BaseConfig(object):
> > > > >      def start_qemu(self):
> > > > >          import shlex
> > > > >          if self.kernel:
> > > > > -            kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel,
> > > > self.kernel_cmdline,
> > > > > +            kernel_opts = "-kernel %s" % (self.kernel)
> > > > > +            if self.get('QB_KERNEL_CMDLINE') != "none":
> > > > > +                kernel_opts += " -append '%s %s %s %s'" %
> > > > > + (self.kernel_cmdline,
> > > > >
> > > > > self.kernel_cmdline_script,
> > > > self.get('QB_KERNEL_CMDLINE_APPEND'),
> > > > >
> > > > > self.bootparams)
> > > > > +            else:
> > > > > +                if self.bootparams:
> > > > > +                    kernel_opts += " -append '%s'" %
> > > > > + (self.bootparams)
> > > > > +
> > > > >              if self.dtb:
> > > > >                  kernel_opts += " -dtb %s" % self.dtb
> > > > >          else:
> > > > > --
> > > > > 2.17.1
> > > > >
> > > > >
> > > > > -=-=-=-=-=-=-=-=-=-=-=-
> > > > > Links: You receive all messages sent to this group.
> > > > > View/Reply Online (#166926):
> > > > > https://lists.openembedded.org/g/openembedded-
> > core/message/166926
> > > > > Mute This Topic:
> > > > > https://lists.openembedded.org/mt/91773086/1686489
> > > > > Group Owner: openembedded-core+owner@lists.openembedded.org
> > > > > Unsubscribe: https://lists.openembedded.org/g/openembedded-
> > > > core/unsub
> > > > > [alex.kanavin@gmail.com]
> > > > > -=-=-=-=-=-=-=-=-=-=-=-
> > > > >

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index 6e1f073ed2..97ea37d690 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1486,9 +1486,15 @@  class BaseConfig(object):
     def start_qemu(self):
         import shlex
         if self.kernel:
-            kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel, self.kernel_cmdline,
+            kernel_opts = "-kernel %s" % (self.kernel)
+            if self.get('QB_KERNEL_CMDLINE') != "none":
+                kernel_opts += " -append '%s %s %s %s'" % (self.kernel_cmdline,
                                                                 self.kernel_cmdline_script, self.get('QB_KERNEL_CMDLINE_APPEND'),
                                                                 self.bootparams)
+            else:
+                if self.bootparams:
+                    kernel_opts += " -append '%s'" % (self.bootparams)
+
             if self.dtb:
                 kernel_opts += " -dtb %s" % self.dtb
         else: