LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/5] kconfig: remove always false ifeq ($(KBUILD_DEFCONFIG,) conditional
@ 2019-05-27 14:37 Masahiro Yamada
  2019-05-27 14:37 ` [PATCH 2/5] kconfig: require the argument of --defconfig Masahiro Yamada
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-05-27 14:37 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

With the following two commits applied, all the arch Makefiles
define KBUILD_DEFCONFIG.

- Commit f3e20ad67b4c ("s390: move arch/s390/defconfig to
  arch/s390/configs/defconfig")

- Commit 986a13769c4b ("alpha: move arch/alpha/defconfig to
  arch/alpha/configs/defconfig")

The first conditional in the defconfig rule is always false.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kconfig/Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 3f327e21f60e..059642bd6584 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -74,9 +74,7 @@ savedefconfig: $(obj)/conf
 	$< $(silent) --$@=defconfig $(Kconfig)
 
 defconfig: $(obj)/conf
-ifeq ($(KBUILD_DEFCONFIG),)
-	$< $(silent) --defconfig $(Kconfig)
-else ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
+ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
 	@$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
 	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
 else
-- 
2.17.1


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

* [PATCH 2/5] kconfig: require the argument of --defconfig
  2019-05-27 14:37 [PATCH 1/5] kconfig: remove always false ifeq ($(KBUILD_DEFCONFIG,) conditional Masahiro Yamada
@ 2019-05-27 14:37 ` Masahiro Yamada
  2019-05-27 14:37 ` [PATCH 3/5] kconfig: add static qualifier to expand_string() Masahiro Yamada
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-05-27 14:37 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Currently, the argument for --defconfig is optional. If the argument
is not passed, the hard-coded default arch/$(ARCH)/defconfig is used.

It no longer happens in Linux since the last users of the default are
gone by the following commits:

- Commit f3e20ad67b4c ("s390: move arch/s390/defconfig to
  arch/s390/configs/defconfig")

- Commit 986a13769c4b ("alpha: move arch/alpha/defconfig to
  arch/alpha/configs/defconfig")

I want to kill the Linux-specific directory path embedded in the
Kconfig binary.

The --savedefconfig (reverse operation of --defconfig) requires an
argument, so it should not hurt to do likewise for --defconfig.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kconfig/conf.c     |  4 +---
 scripts/kconfig/confdata.c | 17 -----------------
 scripts/kconfig/lkc.h      |  1 -
 3 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index ef3678c24bab..0d4c4f3a8f29 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -451,7 +451,7 @@ static struct option long_opts[] = {
 	{"oldaskconfig",    no_argument,       NULL, oldaskconfig},
 	{"oldconfig",       no_argument,       NULL, oldconfig},
 	{"syncconfig",      no_argument,       NULL, syncconfig},
-	{"defconfig",       optional_argument, NULL, defconfig},
+	{"defconfig",       required_argument, NULL, defconfig},
 	{"savedefconfig",   required_argument, NULL, savedefconfig},
 	{"allnoconfig",     no_argument,       NULL, allnoconfig},
 	{"allyesconfig",    no_argument,       NULL, allyesconfig},
@@ -562,8 +562,6 @@ int main(int ac, char **av)
 
 	switch (input_mode) {
 	case defconfig:
-		if (!defconfig_file)
-			defconfig_file = conf_get_default_confname();
 		if (conf_read(defconfig_file)) {
 			fprintf(stderr,
 				"***\n"
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 6006154d36bd..18e8051d89d7 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -177,8 +177,6 @@ static void conf_message(const char *fmt, ...)
 static const char *conf_filename;
 static int conf_lineno, conf_warnings;
 
-const char conf_defname[] = "arch/$(ARCH)/defconfig";
-
 static void conf_warning(const char *fmt, ...)
 {
 	va_list ap;
@@ -233,21 +231,6 @@ static const char *conf_get_autoconfig_name(void)
 	return name ? name : "include/config/auto.conf";
 }
 
-char *conf_get_default_confname(void)
-{
-	static char fullname[PATH_MAX+1];
-	char *env, *name;
-
-	name = expand_string(conf_defname);
-	env = getenv(SRCTREE);
-	if (env) {
-		snprintf(fullname, sizeof(fullname), "%s/%s", env, name);
-		if (is_present(fullname))
-			return fullname;
-	}
-	return name;
-}
-
 static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
 {
 	char *p2;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index cbc7658ee27d..4fb16f316626 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -49,7 +49,6 @@ const char *zconf_curname(void);
 
 /* confdata.c */
 const char *conf_get_configname(void);
-char *conf_get_default_confname(void);
 void sym_set_change_count(int count);
 void sym_add_change_count(int count);
 bool conf_set_all_new_symbols(enum conf_def_mode mode);
-- 
2.17.1


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

* [PATCH 3/5] kconfig: add static qualifier to expand_string()
  2019-05-27 14:37 [PATCH 1/5] kconfig: remove always false ifeq ($(KBUILD_DEFCONFIG,) conditional Masahiro Yamada
  2019-05-27 14:37 ` [PATCH 2/5] kconfig: require the argument of --defconfig Masahiro Yamada
@ 2019-05-27 14:37 ` Masahiro Yamada
  2019-05-27 14:37 ` [PATCH 4/5] kconfig: make arch/*/configs/defconfig the default of KBUILD_DEFCONFIG Masahiro Yamada
  2019-05-27 14:37 ` [PATCH 5/5] unicore32: rename unicore32_defconfig to defconfig Masahiro Yamada
  3 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-05-27 14:37 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Now expand_string() is only used in preprocess.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kconfig/lkc_proto.h  | 1 -
 scripts/kconfig/preprocess.c | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 86c267540ccc..38a32b1c1a28 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -58,7 +58,6 @@ void env_write_dep(FILE *f, const char *auto_conf_name);
 void variable_add(const char *name, const char *value,
 		  enum variable_flavor flavor);
 void variable_all_del(void);
-char *expand_string(const char *in);
 char *expand_dollar(const char **str);
 char *expand_one_token(const char **str);
 
diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
index 592dfbfa9fb3..0243086fb168 100644
--- a/scripts/kconfig/preprocess.c
+++ b/scripts/kconfig/preprocess.c
@@ -15,6 +15,7 @@
 #define ARRAY_SIZE(arr)		(sizeof(arr) / sizeof((arr)[0]))
 
 static char *expand_string_with_args(const char *in, int argc, char *argv[]);
+static char *expand_string(const char *in);
 
 static void __attribute__((noreturn)) pperror(const char *format, ...)
 {
@@ -550,7 +551,7 @@ static char *expand_string_with_args(const char *in, int argc, char *argv[])
 	return __expand_string(&in, is_end_of_str, argc, argv);
 }
 
-char *expand_string(const char *in)
+static char *expand_string(const char *in)
 {
 	return expand_string_with_args(in, 0, NULL);
 }
-- 
2.17.1


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

* [PATCH 4/5] kconfig: make arch/*/configs/defconfig the default of KBUILD_DEFCONFIG
  2019-05-27 14:37 [PATCH 1/5] kconfig: remove always false ifeq ($(KBUILD_DEFCONFIG,) conditional Masahiro Yamada
  2019-05-27 14:37 ` [PATCH 2/5] kconfig: require the argument of --defconfig Masahiro Yamada
  2019-05-27 14:37 ` [PATCH 3/5] kconfig: add static qualifier to expand_string() Masahiro Yamada
@ 2019-05-27 14:37 ` Masahiro Yamada
  2019-05-28 14:12   ` Catalin Marinas
  2019-05-27 14:37 ` [PATCH 5/5] unicore32: rename unicore32_defconfig to defconfig Masahiro Yamada
  3 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2019-05-27 14:37 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Paul Walmsley, Firoz Khan, Richard Henderson,
	Matt Turner, Catalin Marinas, linux-riscv, linux-s390,
	Greentime Hu, Guo Ren, Palmer Dabbelt, Will Deacon,
	linux-arm-kernel, Albert Ou, Luc Van Oostenryck, Heiko Carstens,
	Ivan Kokshaysky, linux-kernel, Vincent Chen, linux-alpha,
	Martin Schwidefsky

Until recently, if KBUILD_DEFCONFIG was not set by the arch Makefile,
the default path arch/*/defconfig was used.

The last users of the default are gone by the following commits:

- Commit f3e20ad67b4c ("s390: move arch/s390/defconfig to
  arch/s390/configs/defconfig")

- Commit 986a13769c4b ("alpha: move arch/alpha/defconfig to
  arch/alpha/configs/defconfig")

Let's set arch/*/configs/defconfig as a new default. This saves
KBUILD_DEFCONFIG for some architectures.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/alpha/Makefile      | 2 --
 arch/arm64/Makefile      | 2 --
 arch/csky/Makefile       | 1 -
 arch/nds32/Makefile      | 2 --
 arch/riscv/Makefile      | 2 --
 arch/s390/Makefile       | 2 --
 scripts/kconfig/Makefile | 4 ++++
 7 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile
index b3314e0dcb6f..12dee59b011c 100644
--- a/arch/alpha/Makefile
+++ b/arch/alpha/Makefile
@@ -8,8 +8,6 @@
 # Copyright (C) 1994 by Linus Torvalds
 #
 
-KBUILD_DEFCONFIG := defconfig
-
 NM := $(NM) -B
 
 LDFLAGS_vmlinux	:= -static -N #-relax
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index b025304bde46..970c41a30ed3 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -30,8 +30,6 @@ LDFLAGS_vmlinux	+= --fix-cortex-a53-843419
   endif
 endif
 
-KBUILD_DEFCONFIG := defconfig
-
 # Check for binutils support for specific extensions
 lseinstr := $(call as-instr,.arch_extension lse,-DCONFIG_AS_LSE=1)
 
diff --git a/arch/csky/Makefile b/arch/csky/Makefile
index f9aab9157c4a..fb1bbbd91954 100644
--- a/arch/csky/Makefile
+++ b/arch/csky/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 OBJCOPYFLAGS		:=-O binary
 GZFLAGS			:=-9
-KBUILD_DEFCONFIG	:= defconfig
 
 ifdef CONFIG_CPU_HAS_FPU
 FPUEXT = f
diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile
index 14dab5ad88ef..ccdca7142020 100644
--- a/arch/nds32/Makefile
+++ b/arch/nds32/Makefile
@@ -2,8 +2,6 @@
 LDFLAGS_vmlinux	:= --no-undefined -X
 OBJCOPYFLAGS	:= -O binary -R .note -R .note.gnu.build-id -R .comment -S
 
-KBUILD_DEFCONFIG := defconfig
-
 ifdef CONFIG_FUNCTION_TRACER
 arch-y += -malways-save-lp -mno-relax
 endif
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 03e760267657..7a117be8297c 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -16,8 +16,6 @@ endif
 KBUILD_AFLAGS_MODULE += -fPIC
 KBUILD_CFLAGS_MODULE += -fPIC
 
-KBUILD_DEFCONFIG = defconfig
-
 export BITS
 ifeq ($(CONFIG_ARCH_RV64I),y)
 	BITS := 64
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index de8521fc9de5..df1d6a150f30 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -10,8 +10,6 @@
 # Copyright (C) 1994 by Linus Torvalds
 #
 
-KBUILD_DEFCONFIG := defconfig
-
 LD_BFD		:= elf64-s390
 KBUILD_LDFLAGS	:= -m elf64_s390
 KBUILD_AFLAGS_MODULE += -fPIC
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 059642bd6584..ab30fe724c43 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -12,6 +12,10 @@ else
 Kconfig := Kconfig
 endif
 
+ifndef KBUILD_DEFCONFIG
+KBUILD_DEFCONFIG := defconfig
+endif
+
 ifeq ($(quiet),silent_)
 silent := -s
 endif
-- 
2.17.1


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

* [PATCH 5/5] unicore32: rename unicore32_defconfig to defconfig
  2019-05-27 14:37 [PATCH 1/5] kconfig: remove always false ifeq ($(KBUILD_DEFCONFIG,) conditional Masahiro Yamada
                   ` (2 preceding siblings ...)
  2019-05-27 14:37 ` [PATCH 4/5] kconfig: make arch/*/configs/defconfig the default of KBUILD_DEFCONFIG Masahiro Yamada
@ 2019-05-27 14:37 ` Masahiro Yamada
  3 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-05-27 14:37 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Robert Jarzmik, Guenter Roeck, linux-kernel,
	Guan Xuetao, Paul Burton, Krzysztof Kozlowski, Zhang Rui,
	Daniel Lezcano

Since the initial support of unicore32, it has always had a single
defconfig. Rename it to 'defconfig', which is now the standard name
when arch has just a single defconfig file.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/unicore32/Makefile                                   | 3 +--
 arch/unicore32/configs/{unicore32_defconfig => defconfig} | 0
 2 files changed, 1 insertion(+), 2 deletions(-)
 rename arch/unicore32/configs/{unicore32_defconfig => defconfig} (100%)

diff --git a/arch/unicore32/Makefile b/arch/unicore32/Makefile
index 98a5ca43ae87..390819947c37 100644
--- a/arch/unicore32/Makefile
+++ b/arch/unicore32/Makefile
@@ -41,8 +41,7 @@ libs-y			+= arch/unicore32/lib/
 
 boot			:= arch/unicore32/boot
 
-# Default defconfig and target when executing plain make
-KBUILD_DEFCONFIG	:= $(ARCH)_defconfig
+# Default target when executing plain make
 KBUILD_IMAGE		:= $(boot)/zImage
 
 all:	zImage
diff --git a/arch/unicore32/configs/unicore32_defconfig b/arch/unicore32/configs/defconfig
similarity index 100%
rename from arch/unicore32/configs/unicore32_defconfig
rename to arch/unicore32/configs/defconfig
-- 
2.17.1


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

* Re: [PATCH 4/5] kconfig: make arch/*/configs/defconfig the default of KBUILD_DEFCONFIG
  2019-05-27 14:37 ` [PATCH 4/5] kconfig: make arch/*/configs/defconfig the default of KBUILD_DEFCONFIG Masahiro Yamada
@ 2019-05-28 14:12   ` Catalin Marinas
  0 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2019-05-28 14:12 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Paul Walmsley, Firoz Khan, Richard Henderson,
	Matt Turner, linux-riscv, linux-s390, Greentime Hu, Guo Ren,
	Palmer Dabbelt, Will Deacon, linux-arm-kernel, Albert Ou,
	Luc Van Oostenryck, Heiko Carstens, Ivan Kokshaysky,
	linux-kernel, Vincent Chen, linux-alpha, Martin Schwidefsky

On Mon, May 27, 2019 at 11:37:24PM +0900, Masahiro Yamada wrote:
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index b025304bde46..970c41a30ed3 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -30,8 +30,6 @@ LDFLAGS_vmlinux	+= --fix-cortex-a53-843419
>    endif
>  endif
>  
> -KBUILD_DEFCONFIG := defconfig
> -
>  # Check for binutils support for specific extensions
>  lseinstr := $(call as-instr,.arch_extension lse,-DCONFIG_AS_LSE=1)

For arm64:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

end of thread, other threads:[~2019-05-28 14:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27 14:37 [PATCH 1/5] kconfig: remove always false ifeq ($(KBUILD_DEFCONFIG,) conditional Masahiro Yamada
2019-05-27 14:37 ` [PATCH 2/5] kconfig: require the argument of --defconfig Masahiro Yamada
2019-05-27 14:37 ` [PATCH 3/5] kconfig: add static qualifier to expand_string() Masahiro Yamada
2019-05-27 14:37 ` [PATCH 4/5] kconfig: make arch/*/configs/defconfig the default of KBUILD_DEFCONFIG Masahiro Yamada
2019-05-28 14:12   ` Catalin Marinas
2019-05-27 14:37 ` [PATCH 5/5] unicore32: rename unicore32_defconfig to defconfig Masahiro Yamada

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