linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] merge_config.sh: Add support to pass arguments to make
@ 2015-07-21 13:22 Srinivas Kandagatla
  2015-07-24  6:10 ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Srinivas Kandagatla @ 2015-07-21 13:22 UTC (permalink / raw)
  To: Michal Marek
  Cc: yann.morin.1998, linux-kbuild, linux-kernel, Srinivas Kandagatla

The issue is flags like ARCH can be passed to make via environment variable
or at command line by passing "ARCH=" argument to make file. The former case
works fine if used with merge_config but the later case would not work and
resulting config file from merge_config is useless.

I hit this issue when I started using config fragments on arm64 bit platform
and I usually pass ARCH at the make command line.

As it is common for users like me to pass ARCH variable in command line,
providing such flexiblity in merge_config makes more sense.

This patch adds support to pass arguments to make file, without this patch the
user has to set the enviroment variables which is not explicit.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 scripts/kconfig/merge_config.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index ec8e203..8d9cae4 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -28,6 +28,7 @@ trap clean_up HUP INT TERM
 
 usage() {
 	echo "Usage: $0 [OPTIONS] [CONFIG [...]]"
+	echo "  -a    arguments to make command. ex: ARCH=arm"
 	echo "  -h    display this help text"
 	echo "  -m    only merge the fragments, do not execute the make command"
 	echo "  -n    use allnoconfig instead of alldefconfig"
@@ -39,6 +40,7 @@ RUNMAKE=true
 ALLTARGET=alldefconfig
 WARNREDUN=false
 OUTPUT=.
+MAKE_ARGS=""
 
 while true; do
 	case $1 in
@@ -61,6 +63,11 @@ while true; do
 		shift
 		continue
 		;;
+	"-a")
+		MAKE_ARGS=$2
+		shift 2
+		continue
+		;;
 	"-O")
 		if [ -d $2 ];then
 			OUTPUT=$(echo $2 | sed 's/\/*$//')
@@ -139,7 +146,7 @@ fi
 # Use the merged file as the starting point for:
 # alldefconfig: Fills in any missing symbols with Kconfig default
 # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
-make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
+make $MAKE_ARGS KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
 
 
 # Check all specified config values took (might have missed-dependency issues)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RFC] merge_config.sh: Add support to pass arguments to make
  2015-07-21 13:22 [PATCH RFC] merge_config.sh: Add support to pass arguments to make Srinivas Kandagatla
@ 2015-07-24  6:10 ` Masahiro Yamada
  2015-07-24 10:12   ` Srinivas Kandagatla
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2015-07-24  6:10 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Michal Marek, yann.morin.1998, Linux Kbuild mailing list,
	Linux Kernel Mailing List

Hi Srinivas,


2015-07-21 22:22 GMT+09:00 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:
> The issue is flags like ARCH can be passed to make via environment variable
> or at command line by passing "ARCH=" argument to make file. The former case
> works fine if used with merge_config but the later case would not work and
> resulting config file from merge_config is useless.
>
> I hit this issue when I started using config fragments on arm64 bit platform
> and I usually pass ARCH at the make command line.

Me too.  I always pass ARCH from the make command line.

I did a simple test, but I did not hit this issue.

I think both environment variables and make command line variables
are inherited to sub-processes.

I guess this patch is useful only when we directly invoke this shell script,
not via the top-level Makefile.  But, from your statement, I thought
you invoke merge_config.sh from the Makefile.  So, I cannot understand
what you mean.

Moreover, the top-level Makefile exports ARCH, so it is always an
environment variable.

See the line 408:
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC




> As it is common for users like me to pass ARCH variable in command line,
> providing such flexiblity in merge_config makes more sense.
>
> This patch adds support to pass arguments to make file, without this patch the
> user has to set the enviroment variables which is not explicit.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RFC] merge_config.sh: Add support to pass arguments to make
  2015-07-24  6:10 ` Masahiro Yamada
@ 2015-07-24 10:12   ` Srinivas Kandagatla
  0 siblings, 0 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2015-07-24 10:12 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Michal Marek, yann.morin.1998, Linux Kbuild mailing list,
	Linux Kernel Mailing List


Hi Mashahiro,

Thanks for the comments.
On 24/07/15 07:10, Masahiro Yamada wrote:
> Hi Srinivas,
>
>
> 2015-07-21 22:22 GMT+09:00 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:
>> The issue is flags like ARCH can be passed to make via environment variable
>> or at command line by passing "ARCH=" argument to make file. The former case
>> works fine if used with merge_config but the later case would not work and
>> resulting config file from merge_config is useless.
>>
>> I hit this issue when I started using config fragments on arm64 bit platform
>> and I usually pass ARCH at the make command line.
>
> Me too.  I always pass ARCH from the make command line.
>
> I did a simple test, but I did not hit this issue.
>
> I think both environment variables and make command line variables
> are inherited to sub-processes.
>
> I guess this patch is useful only when we directly invoke this shell script,
> not via the top-level Makefile.  But, from your statement, I thought
> you invoke merge_config.sh from the Makefile.  So, I cannot understand
> what you mean.

Actually Am invoking the script directly, Is this a valid usage?
If this usage is not valid we can ignore this patch I guess :-)

Sorry I should have put my command line in the log to make it clear.

I use below command:
  ./scripts/kconfig/merge_config.sh  -O /objs/ 
arch/arm64/configs/defconfig distro.conf

>
> Moreover, the top-level Makefile exports ARCH, so it is always an
> environment variable.
>
> See the line 408:
> export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
>
Yes, It works if invoked with make with your patch "kbuild: add generic 
mergeconfig target, %.config"

>
>
>
>> As it is common for users like me to pass ARCH variable in command line,
>> providing such flexiblity in merge_config makes more sense.
>>
>> This patch adds support to pass arguments to make file, without this patch the
>> user has to set the enviroment variables which is not explicit.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>
>
>
>
--srini

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-24 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-21 13:22 [PATCH RFC] merge_config.sh: Add support to pass arguments to make Srinivas Kandagatla
2015-07-24  6:10 ` Masahiro Yamada
2015-07-24 10:12   ` Srinivas Kandagatla

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).