Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp728975ybj; Thu, 7 May 2020 06:23:35 -0700 (PDT) X-Google-Smtp-Source: APiQypID/DzVFQmJuhMF4ykM1ci4g1M2XnsTnGC3xI6Qouer7C9PDbr/YXjC3cnZXGATfCoEjZc/ X-Received: by 2002:a17:906:809:: with SMTP id e9mr11570529ejd.81.1588857815372; Thu, 07 May 2020 06:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588857815; cv=none; d=google.com; s=arc-20160816; b=Aft+lAvPmxZXvXKPE3ArK2dP1BD4rJb2UT0x3D5XoyqoiuM2pOTjYw9TKBmADw4QIR yulRI86Os5DzzrpJE7UNbW3cDMlzHhdQN/bHXUT6qRvuATebF1kd49XfxVI782kT00AH jr1gr+Isd+6OhKAU668MxLzhAl1/e712sFLrydoGhIJH7AB+4i/Sh7WLZEx5aN2vRhvH sJxOih/7AtUnkM58YwsvN20CjAA3N6I6RUgL77yMzAuMrNZn7nNkhGkph0X9lCUP1X96 XJ3oADOBJGLikW2wSPtVRgZitOqJBNLDDvFHBHAXTrQK87jJkK6rCAGHVPiRhT1C1uls +LrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=iD3QJCROI9/t+iIU3dKEHHvOHN1ViLxt/Dy9XOOMgG8=; b=G2j4AaWU3Rwpk6g15cn+uYE6JAxA5BvoD6FQS6zhLNkFkQ79qzEyXpG2aFb9Fv0Qxb TMfHhZrx70o3xNl/0GDeoAby08U2KxN2x7Pc4XY6BZdAcmRbHNmx1TqjzdD9a5wDn8xY tsO3+K9tvlofGUGIg1Zr92z54+tMrCaDFIoeYlUglNgX0YplQzqjNb4bQU8taotNuvcA HDtKzVrzRzcgufpKIH07CJ203S5OpmP7kRW82H44mjuP853h0mAuFnoYavh+9ieaGw4N rKZpTFeevxsZNVgcK+5n8xf7pnNSvbX6VS9Ve0QJdF88Ji3O3eA4U0PDMdUzuzs1rUwl HrDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce21si2600259edb.297.2020.05.07.06.23.07; Thu, 07 May 2020 06:23:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727030AbgEGNSK (ORCPT + 99 others); Thu, 7 May 2020 09:18:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:57820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726007AbgEGNSK (ORCPT ); Thu, 7 May 2020 09:18:10 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 29BA720708; Thu, 7 May 2020 13:18:09 +0000 (UTC) Date: Thu, 7 May 2020 09:18:07 -0400 From: Steven Rostedt To: Masahiro Yamada Cc: Changbin Du , Jonathan Corbet , "open list:DOCUMENTATION" , Linux Kernel Mailing List , Linux Kbuild mailing list , Randy Dunlap Subject: Re: [PATCH v4] streamline_config.pl: add LMC_KEEP to preserve some kconfigs Message-ID: <20200507091807.0a789fbd@gandalf.local.home> In-Reply-To: References: <20200503001141.9647-1-changbin.du@gmail.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 May 2020 12:19:57 +0900 Masahiro Yamada wrote: > On Sun, May 3, 2020 at 9:11 AM Changbin Du 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 > > > > --- > > 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. > > > > > > + 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? -- Steve