Re: [PATCH 1/1] merge_config.sh: Replace prefix CONFIG_ with any prefix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 28, 2018 at 9:55 PM Petr Vorel <petr.vorel@xxxxxxxxx> wrote:
>
> merge_config.sh expect prefix from kernel: CONFIG_.
> There some other projects using kconfig with different prefixes
> (e.g. buildroot: BR2_ prefix). While there could be some option
> to specify config prefix [1] [2], IMHO it's better to not specify
> prefix (expect just any prefix).
>
> [1] http://patchwork.ozlabs.org/patch/824051/
> [2] https://patchwork.ozlabs.org/patch/988890/
>
> Signed-off-by: Petr Vorel <petr.vorel@xxxxxxxxx>
> Suggested-by: Marcel Patzlaff <m.patzlaff@xxxxxxx>
> ---
> NOTE: I deliberately left prefix CONFIG_ in comment:
> # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set


I'd like to filter "CONFIG_", "BR2_", or whatever specified prefix.

Some fragment files (e.g. arch/x86/configs/xen.config)
have comment lines.

Matching '# ' + arbitrary string
might hit comment lines accidentally.



The kconfig binary checks the environment variable 'CONFIG_'
to override the default prefix:
https://github.com/torvalds/linux/blob/v4.19/scripts/kconfig/lkc.h#L28


For similarity, how about doing in the same way in merge_config.sh ?


Does the following work for you ?
(you can pass CONFIG_=BR2_ to merge_config.sh)




diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 67d1314..391ee6c 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -90,6 +90,10 @@ if [ -z "$KCONFIG_CONFIG" ]; then
        fi
 fi

+# Check the environment variable "CONFIG_" for the config option prefix.
+# If unset, the default is "CONFIG_".
+: ${CONFIG_=CONFIG_}
+
 INITFILE=$1
 shift;

@@ -99,7 +103,7 @@ if [ ! -r "$INITFILE" ]; then
 fi

 MERGE_LIST=$*
-SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
+SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_}[a-zA-Z0-9_]*\)[= ].*/\2/p"
 TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)

 echo "Using $INITFILE as base"






--
Best Regards
Masahiro Yamada



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux