linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changbin Du <changbin.du@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Changbin Du <changbin.du@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v4] streamline_config.pl: add LMC_KEEP to preserve some kconfigs
Date: Fri, 8 May 2020 22:00:47 +0800	[thread overview]
Message-ID: <20200508140047.rln4iogroxw7esxa@mail.google.com> (raw)
In-Reply-To: <20200507091807.0a789fbd@gandalf.local.home>

On Thu, May 07, 2020 at 09:18:07AM -0400, Steven Rostedt wrote:
> On Thu, 7 May 2020 12:19:57 +0900
> Masahiro Yamada <masahiroy@kernel.org> wrote:
> 
> > On Sun, May 3, 2020 at 9:11 AM Changbin Du <changbin.du@gmail.com> wrote:
> > >
> > > Sometimes it is useful to preserve batches of configs when making
> > > localmodconfig. For example, I usually don't want any usb and fs
> > > modules to be disabled. Now we can do it by:
> > >
> > >  $ make LMC_KEEP="drivers/usb;fs" localmodconfig
> > >
> > > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > >
> > > ---
> > > v4: fix typo.
> > > v3: rename LOCALMODCONFIG_PRESERVE to shorter LMC_KEEP.
> > > v2: fix typo in documentation. (Randy Dunlap)
> > > ---  
> > 
> > 
> > Personally, I do not mind the long LOCALMODCONFIG_PRESERVE,
> 
> Perhasp we allow both? ;-)
> 
> And just have one set to the other.
> 
> > but this tends to be bike-sheding.
> > I do not have a strong opinion.
> > 
> > 
> > >  Documentation/admin-guide/README.rst |  8 +++++++-
> > >  scripts/kconfig/Makefile             |  1 +
> > >  scripts/kconfig/streamline_config.pl | 23 +++++++++++++++++++++++
> > >  3 files changed, 31 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/Documentation/admin-guide/README.rst b/Documentation/admin-guide/README.rst
> > > index cc6151fc0845..1371deab8bc7 100644
> > > --- a/Documentation/admin-guide/README.rst
> > > +++ b/Documentation/admin-guide/README.rst
> > > @@ -209,10 +209,16 @@ Configuring the kernel
> > >                             store the lsmod of that machine into a file
> > >                             and pass it in as a LSMOD parameter.
> > >
> > > +                           Also, you can preserve modules in certain folders
> > > +                           or kconfig files by specifying their paths in
> > > +                           parameter LMC_KEEP.
> > > +
> > >                     target$ lsmod > /tmp/mylsmod
> > >                     target$ scp /tmp/mylsmod host:/tmp
> > >
> > > -                   host$ make LSMOD=/tmp/mylsmod localmodconfig
> > > +                   host$ make LSMOD=/tmp/mylsmod \
> > > +                           LMC_KEEP="drivers/usb;drivers/gpu;fs" \  
> > 
> > 
> > This might be another bike-sheding item, but
> > can you use a space for the delimiter?
> > 
> > 
> > LMC_KEEP="drivers/usb drivers/gpu fs"
> > 
> > If you pass multiple directories,
> > you will need to surround them with double-quotes.
> 
> I agree that spaces look better.
>
I am okay with space. But what about ":" which is used by shell PATH and many
others?

> > 
> > 
> > 
> > 
> > > +                           localmodconfig
> > >
> > >                             The above also works when cross compiling.
> > >
> > > diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> > > index c9d0a4a8efb3..e0abbf5805f5 100644
> > > --- a/scripts/kconfig/Makefile
> > > +++ b/scripts/kconfig/Makefile
> > > @@ -123,6 +123,7 @@ help:
> > >         @echo  '  gconfig         - Update current config utilising a GTK+ based front-end'
> > >         @echo  '  oldconfig       - Update current config utilising a provided .config as base'
> > >         @echo  '  localmodconfig  - Update current config disabling modules not loaded'
> > > +       @echo  '                    except those preserved by LMC_KEEP environment variable'
> > >         @echo  '  localyesconfig  - Update current config converting local mods to core'
> > >         @echo  '  defconfig       - New config with default from ARCH supplied defconfig'
> > >         @echo  '  savedefconfig   - Save current config as ./defconfig (minimal config)'
> > > diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> > > index e2f8504f5a2d..d26543a807c9 100755
> > > --- a/scripts/kconfig/streamline_config.pl
> > > +++ b/scripts/kconfig/streamline_config.pl
> > > @@ -143,6 +143,7 @@ my %depends;
> > >  my %selects;
> > >  my %prompts;
> > >  my %objects;
> > > +my %config2kfile;
> > >  my $var;
> > >  my $iflevel = 0;
> > >  my @ifdeps;
> > > @@ -201,6 +202,7 @@ sub read_kconfig {
> > >         if (/^\s*(menu)?config\s+(\S+)\s*$/) {
> > >             $state = "NEW";
> > >             $config = $2;
> > > +           $config2kfile{"CONFIG_$config"} = $kconfig;
> > >
> > >             # Add depends for 'if' nesting
> > >             for (my $i = 0; $i < $iflevel; $i++) {
> > > @@ -592,6 +594,22 @@ while ($repeat) {
> > >
> > >  my %setconfigs;
> > >
> > > +my @preserved_kconfigs;
> > > +@preserved_kconfigs = split(/;/,$ENV{LMC_KEEP}) if (defined($ENV{LMC_KEEP}));  
> > 
> > Maybe, you can do 'my' declaration and the assignment
> > in a single line?
> > 
> > Can you drop the 'if ...' conditional?
> > 
> > 
> > Does this work for you?
> > 
> > my @preserved_kconfigs = split(/;/,$ENV{LMC_KEEP});
> > 
> > 
> 
> Will an undefined warning happen if LMC_KEEP isn't defined?
> 
I just verifed there is no warning raised.

> -- Steve

-- 
Cheers,
Changbin Du

  reply	other threads:[~2020-05-08 14:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03  0:11 [PATCH v4] streamline_config.pl: add LMC_KEEP to preserve some kconfigs Changbin Du
2020-05-07  3:19 ` Masahiro Yamada
2020-05-07 13:18   ` Steven Rostedt
2020-05-08 14:00     ` Changbin Du [this message]
2020-05-08 16:14       ` Steven Rostedt
2020-05-09 11:07       ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508140047.rln4iogroxw7esxa@mail.google.com \
    --to=changbin.du@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).