lkml.org 
[lkml]   [2022]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] kconfig: Add findconf script and helper program
On Thu, Jun 9, 2022 at 8:19 PM Zev Weiss <zev@bewilderbeest.net> wrote:
>
> On Wed, Jun 08, 2022 at 10:47:08PM PDT, Masahiro Yamada wrote:
> >On Thu, Jun 9, 2022 at 12:49 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>
> >>
> >>
> >> On 6/8/22 20:46, Zev Weiss wrote:
> >> > On Wed, Jun 08, 2022 at 07:48:44PM PDT, Randy Dunlap wrote:
> >> >> Hi--
> >> >>
> >> >> On 6/8/22 02:54, Zev Weiss wrote:
> >> >>> scripts/findconf provides menuconfig's search functionality as a
> >> >>> standalone, non-interactive command, somewhat in the spirit of
> >> >>> scripts/config. It is meant to be useful for tasks like getting a
> >> >>> quick overview of symbol dependencies or determining which Kconfig
> >> >>> file to edit for a given symbol, without having to fire up one of the
> >> >>> interactive config programs.
> >> >>>
> >> >>> It accepts a single command-line flag, '-v', which causes it to also
> >> >>> print the help text of each matching result.
> >> >>>
> >> >>> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> >> >>> ---
> >> >>
> >> >> I can see how this could be useful.
> >> >> It's a little easier to use than what I currently do:
> >> >>
> >> >> $ findconfig DRM_HISI_HIBMC
> >> >> ./drivers/gpu/drm/hisilicon/hibmc/Kconfig:2:config DRM_HISI_HIBMC
> >> >
> >> > I'm guessing 'findconfig' here is some personal shell
> >> > alias/function/script? (I can't see any references to it in the kernel
> >> > source tree.)
> >> >
> >>
> >> Yes, it's just local.
> >>
> >> >>
> >> >> then $EDITOR that_Kconfig_file
> >> >>
> >> >>
> >> >> In testing, I am seeing this:
> >> >>
> >> >> #
> >> >> # using defaults found in /boot/config-5.3.18-150300.59.63-default
> >> >> #
> >> >> .config:421:warning: symbol value 'm' invalid for I8K
> >> >> .config:2335:warning: symbol value 'm' invalid for
> >> >> MTD_NAND_ECC_SW_HAMMING
> >> >> .config:2484:warning: symbol value 'm' invalid for PVPANIC
> >> >> .config:8671:warning: symbol value 'm' invalid for INTERCONNECT
> >> >> .config:9369:warning: symbol value 'm' invalid for
> >> >> CRYPTO_ARCH_HAVE_LIB_BLAKE2S
> >> >> .config:9370:warning: symbol value 'm' invalid for
> >> >> CRYPTO_LIB_BLAKE2S_GENERIC
> >> >> .config:9653:warning: symbol value '1' invalid for KASAN_STACK
> >> >>
> >> >
> >> > This I assume is just due to the contents of your .config file relative
> >> > to the current Kconfig definitions and not a problem with anything in
> >> > this patch?
> >>
> >> There is no .config file in the linux/ source tree at the top level.
> >> I use O=build_dir for all builds.
> >>
> >> >
> >> >> How do I specify/choose a .config file to be used?
> >> >>
> >> >> Oh, use KCONFIG_CONFIG=filename
> >> >>
> >> >
> >> > Ah, I guess that'd be a nice thing to add a flag for to the wrapper
> >> > script -- I'll include that in v2.
> >> >
> >> >>
> >> >> Please update (add) usage/help text in scripts/kconfig/Makefile.
> >> >>
> >> >
> >> > Ack, will do.
> >> >
> >> >
> >> > Thanks for the review!
> >> >
> >> >
> >> > Zev
> >> >
> >
> >
> >
> >
> >
> >
> >
> >
> >Another idea might be to add the following to
> >scripts/kconfig/Makefile:
> >
> >
> >
> >@@ -77,7 +76,13 @@ PHONY += $(simple-targets)
> > $(simple-targets): $(obj)/conf
> > $(Q)$< $(silent) --$@ $(Kconfig)
> >
> >-PHONY += savedefconfig defconfig
> >+PHONY += findconfig savedefconfig defconfig
> >+
> >+findconfig: $(obj)/conf
> >+ $(Q)$< $(silent) --$@=$(KCONFIG_FIND) $(Kconfig)
> >+
> >+%_findconfig: $(obj)/conf
> >+ $(Q)$< $(silent) --findconfig=$* $(Kconfig)
> >
> > savedefconfig: $(obj)/conf
> > $(Q)$< $(silent) --$@=defconfig $(Kconfig)
> >
> >
> >
> >
> >
> >Instead of adding a separate program for this,
> >you can modify scripts/kconfig/conf.c
> >
> > - add 'findconfig' to enum input_mode
> > - add 'findconfig' to long_opts[]
> > - add 'case findconfig' to main() function
> >
> >
> >
> >Then, you can do
> >
> >$ make findconfig KCONFIG_FIND=DRM_HISI_HIBMC
> >
> > or
> >
> >$ make DRM_HISI_HIBMC_findconfig
> >
> > as a shorthand.
> >
> >
> >scripts/findconf is unneeded
> >but you can put your own script in ~/bin
> >if you want to save your typing even more.
> >
>
> Hmm, interesting idea -- it seems a bit more awkward to use though, and
> if everyone who makes much use of it is likely to be writing their own
> little ad-hoc wrapper script anyway, it seems like we might as well do
> that once and check it in?
>
> The current approach also provides support for multi-query searches,
> which while it isn't critical is slightly more convenient than running
> it multiple times or cramming everything into a single combined regex
> (analogous to grep's '-e' flag).
>
> That said, if you and/or others have a strong preference for doing it
> via a make target I could rearrange it to work that way instead.
>


Hmm, OK. Then, let's keep scripts/findconfig.

But, I'd like to pass the regex pattern via the --findconfig=
option.

In the shell script, can you do some conversion?





> Thanks,
> Zev
>


--
Best Regards
Masahiro Yamada

\
 
 \ /
  Last update: 2022-06-10 16:48    [W:0.052 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site