diff mbox

[RFC,1/2] scripts/kconfig/Makefile: Allow KBUILD_DEFCONFIG to be a target

Message ID 1442986835-13985-1-git-send-email-mpe@ellerman.id.au (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Ellerman Sept. 23, 2015, 5:40 a.m. UTC
Arch Makefiles can set KBUILD_DEFCONFIG to tell kbuild the name of the
defconfig that should be built by default.

However currently there is an assumption that KBUILD_DEFCONFIG points to
a file at arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG).

We would like to use a target, using merge_config, as our defconfig, so
adapt the logic in scripts/kconfig/Makefile to allow that.

To minimise the chance of breaking anything, we first check if
KBUILD_DEFCONFIG is a file, and if so we do the old logic. If it's not a
file, then we call the top-level Makefile with KBUILD_DEFCONFIG as the
target.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 scripts/kconfig/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Michal Marek Sept. 23, 2015, 9:50 a.m. UTC | #1
On 2015-09-23 07:40, Michael Ellerman wrote:
> +else ifneq ($(wildcard arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
>  	@$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
>  	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
> +else
> +	@$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'"
> +	$(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG)
>  endif

What is the anticipated usage of this? The patch is not needed to make

  make ppc64le_defconfig

work with the second patch. If it was, this would create a loop anyway.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Ellerman Sept. 23, 2015, 10:16 p.m. UTC | #2
On 23 September 2015 19:50:52 GMT+10:00, Michal Marek <mmarek@suse.com> wrote:
>On 2015-09-23 07:40, Michael Ellerman wrote:
>> +else ifneq ($(wildcard
>arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
>>  	@$(kecho) "*** Default configuration is based on
>'$(KBUILD_DEFCONFIG)'"
>>  	$(Q)$< $(silent)
>--defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
>> +else
>> +	@$(kecho) "*** Default configuration is based on target
>'$(KBUILD_DEFCONFIG)'"
>> +	$(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG)
>>  endif
>
>What is the anticipated usage of this? The patch is not needed to make
>
>  make ppc64le_defconfig
>
>work with the second patch. If it was, this would create a loop anyway.

The idea is to make 'make defconfig' work when KBUILD_DEFCONFIG is ppc64le_defconfig (which happens for us when uname returns ppc64le) and additionally when ppc64le_defconfig is not a real file.

It doesn't work currently, but does with these two patches applied.

cheers
Michal Marek Sept. 25, 2015, 8:46 p.m. UTC | #3
Dne 24.9.2015 v 00:16 Michael Ellerman napsal(a):
> 
> 
> On 23 September 2015 19:50:52 GMT+10:00, Michal Marek
> <mmarek@suse.com> wrote:
>> On 2015-09-23 07:40, Michael Ellerman wrote:
>>> +else ifneq ($(wildcard
>> arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
>>> @$(kecho) "*** Default configuration is based on
>> '$(KBUILD_DEFCONFIG)'"
>>> $(Q)$< $(silent)
>> --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
>>> +else +	@$(kecho) "*** Default configuration is based on target
>> '$(KBUILD_DEFCONFIG)'"
>>> +	$(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG) endif
>> 
>> What is the anticipated usage of this? The patch is not needed to
>> make
>> 
>> make ppc64le_defconfig
>> 
>> work with the second patch. If it was, this would create a loop
>> anyway.
> 
> The idea is to make 'make defconfig' work when KBUILD_DEFCONFIG is
> ppc64le_defconfig (which happens for us when uname returns ppc64le)
> and additionally when ppc64le_defconfig is not a real file.

Ah, that makes sense. You can add

Acked-by: Michal Marek <mmarek@suse.com>

if you want.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Ellerman Oct. 1, 2015, 6:14 a.m. UTC | #4
On Fri, 2015-09-25 at 22:46 +0200, Michal Marek wrote:
> Dne 24.9.2015 v 00:16 Michael Ellerman napsal(a):
> > 
> > 
> > On 23 September 2015 19:50:52 GMT+10:00, Michal Marek
> > <mmarek@suse.com> wrote:
> >> On 2015-09-23 07:40, Michael Ellerman wrote:
> >>> +else ifneq ($(wildcard
> >> arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
> >>> @$(kecho) "*** Default configuration is based on
> >> '$(KBUILD_DEFCONFIG)'"
> >>> $(Q)$< $(silent)
> >> --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
> >>> +else +	@$(kecho) "*** Default configuration is based on target
> >> '$(KBUILD_DEFCONFIG)'"
> >>> +	$(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG) endif
> >> 
> >> What is the anticipated usage of this? The patch is not needed to
> >> make
> >> 
> >> make ppc64le_defconfig
> >> 
> >> work with the second patch. If it was, this would create a loop
> >> anyway.
> > 
> > The idea is to make 'make defconfig' work when KBUILD_DEFCONFIG is
> > ppc64le_defconfig (which happens for us when uname returns ppc64le)
> > and additionally when ppc64le_defconfig is not a real file.
> 
> Ah, that makes sense. You can add
> 
> Acked-by: Michal Marek <mmarek@suse.com>
> 
> if you want.

Thanks. I'll assume by that you mean you're happy if I take both patches
through the powerpc tree.

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Marek Oct. 1, 2015, 6:50 a.m. UTC | #5
On 2015-10-01 08:14, Michael Ellerman wrote:
> On Fri, 2015-09-25 at 22:46 +0200, Michal Marek wrote:
>> Dne 24.9.2015 v 00:16 Michael Ellerman napsal(a):
>>>
>>>
>>> On 23 September 2015 19:50:52 GMT+10:00, Michal Marek
>>> <mmarek@suse.com> wrote:
>>>> On 2015-09-23 07:40, Michael Ellerman wrote:
>>>>> +else ifneq ($(wildcard
>>>> arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
>>>>> @$(kecho) "*** Default configuration is based on
>>>> '$(KBUILD_DEFCONFIG)'"
>>>>> $(Q)$< $(silent)
>>>> --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
>>>>> +else +	@$(kecho) "*** Default configuration is based on target
>>>> '$(KBUILD_DEFCONFIG)'"
>>>>> +	$(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG) endif
>>>>
>>>> What is the anticipated usage of this? The patch is not needed to
>>>> make
>>>>
>>>> make ppc64le_defconfig
>>>>
>>>> work with the second patch. If it was, this would create a loop
>>>> anyway.
>>>
>>> The idea is to make 'make defconfig' work when KBUILD_DEFCONFIG is
>>> ppc64le_defconfig (which happens for us when uname returns ppc64le)
>>> and additionally when ppc64le_defconfig is not a real file.
>>
>> Ah, that makes sense. You can add
>>
>> Acked-by: Michal Marek <mmarek@suse.com>
>>
>> if you want.
> 
> Thanks. I'll assume by that you mean you're happy if I take both patches
> through the powerpc tree.

Yes, I assumed that this was your plan.

Michal

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Ellerman Oct. 1, 2015, 7:05 a.m. UTC | #6
On Thu, 2015-10-01 at 08:50 +0200, Michal Marek wrote:
> On 2015-10-01 08:14, Michael Ellerman wrote:
> > On Fri, 2015-09-25 at 22:46 +0200, Michal Marek wrote:
> >> Dne 24.9.2015 v 00:16 Michael Ellerman napsal(a):
> >>> On 23 September 2015 19:50:52 GMT+10:00, Michal Marek
> >>> <mmarek@suse.com> wrote:
> >>>> On 2015-09-23 07:40, Michael Ellerman wrote:
> >>>>> +else ifneq ($(wildcard
> >>>> arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
> >>>>> @$(kecho) "*** Default configuration is based on
> >>>> '$(KBUILD_DEFCONFIG)'"
> >>>>> $(Q)$< $(silent)
> >>>> --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
> >>>>> +else +	@$(kecho) "*** Default configuration is based on target
> >>>> '$(KBUILD_DEFCONFIG)'"
> >>>>> +	$(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG) endif
> >>>>
> >>>> What is the anticipated usage of this? The patch is not needed to
> >>>> make
> >>>>
> >>>> make ppc64le_defconfig
> >>>>
> >>>> work with the second patch. If it was, this would create a loop
> >>>> anyway.
> >>>
> >>> The idea is to make 'make defconfig' work when KBUILD_DEFCONFIG is
> >>> ppc64le_defconfig (which happens for us when uname returns ppc64le)
> >>> and additionally when ppc64le_defconfig is not a real file.
> >>
> >> Ah, that makes sense. You can add
> >>
> >> Acked-by: Michal Marek <mmarek@suse.com>
> >>
> >> if you want.
> > 
> > Thanks. I'll assume by that you mean you're happy if I take both patches
> > through the powerpc tree.
> 
> Yes, I assumed that this was your plan.

I didn't really have a plan :)

It's certainly easiest if I take it in my tree along with the new
ppc64le_defconfig, so I'll do that. Thanks.

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Ellerman Oct. 2, 2015, 7:47 a.m. UTC | #7
On Wed, 2015-23-09 at 05:40:34 UTC, Michael Ellerman wrote:
> Arch Makefiles can set KBUILD_DEFCONFIG to tell kbuild the name of the
> defconfig that should be built by default.
> 
> However currently there is an assumption that KBUILD_DEFCONFIG points to
> a file at arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG).
> 
> We would like to use a target, using merge_config, as our defconfig, so
> adapt the logic in scripts/kconfig/Makefile to allow that.
> 
> To minimise the chance of breaking anything, we first check if
> KBUILD_DEFCONFIG is a file, and if so we do the old logic. If it's not a
> file, then we call the top-level Makefile with KBUILD_DEFCONFIG as the
> target.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Acked-by: Michal Marek <mmarek@suse.com>

Applied to powerpc next.

https://git.kernel.org/powerpc/c/d2036f30cfe1daa19e63ce75

cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Olof Johansson Oct. 13, 2015, 9:02 p.m. UTC | #8
On Fri, Oct 2, 2015 at 12:47 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> On Wed, 2015-23-09 at 05:40:34 UTC, Michael Ellerman wrote:
>> Arch Makefiles can set KBUILD_DEFCONFIG to tell kbuild the name of the
>> defconfig that should be built by default.
>>
>> However currently there is an assumption that KBUILD_DEFCONFIG points to
>> a file at arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG).
>>
>> We would like to use a target, using merge_config, as our defconfig, so
>> adapt the logic in scripts/kconfig/Makefile to allow that.
>>
>> To minimise the chance of breaking anything, we first check if
>> KBUILD_DEFCONFIG is a file, and if so we do the old logic. If it's not a
>> file, then we call the top-level Makefile with KBUILD_DEFCONFIG as the
>> target.
>>
>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>> Acked-by: Michal Marek <mmarek@suse.com>
>
> Applied to powerpc next.
>
> https://git.kernel.org/powerpc/c/d2036f30cfe1daa19e63ce75

This breaks arm64 defconfig for me:

mkdir obj-tmp
make -f Makefile O=obj-tmp ARCH=arm64 defconfig
... watch loop of:
*** Default configuration is based on target 'defconfig'
  GEN     ./Makefile



-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index aceaaed09811..b2b9c87cec50 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -96,9 +96,12 @@  savedefconfig: $(obj)/conf
 defconfig: $(obj)/conf
 ifeq ($(KBUILD_DEFCONFIG),)
 	$< $(silent) --defconfig $(Kconfig)
-else
+else ifneq ($(wildcard arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
 	@$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
 	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
+else
+	@$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'"
+	$(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG)
 endif
 
 %_defconfig: $(obj)/conf