diff mbox series

[Xen-devel] xen/arm: Allow cleaning the directory even when CONFIG_EARLY_PRINTK is set

Message ID 20190422164106.20331-1-julien.grall@arm.com
State Superseded
Headers show
Series [Xen-devel] xen/arm: Allow cleaning the directory even when CONFIG_EARLY_PRINTK is set | expand

Commit Message

Julien Grall April 22, 2019, 4:41 p.m. UTC
CONFIG_EARLY_PRINTK can only be set when CONFIG_DEBUG is enabled. It can
be quite convenient to only modify the target.

However, the target clean will not include the .config. This means
CONFIG_DEBUG is not enabled and therefore make will throw an error
preventing clean to continue.

The check is not moved at linking time.

Signed-off-by: Julien Grall <julien.grall@arm.com>

---

This code is pretty nasty, but I haven't found a better way for avoiding
to check if CONFIG_DEBUG is enabled when the target clean is called.

Ideally we will want to move CONFIG_EARLY_PRINTK in Kconfig. I haven't
had time yet to look at it properly so far.
---
 xen/arch/arm/Makefile | 5 +++++
 xen/arch/arm/Rules.mk | 7 -------
 2 files changed, 5 insertions(+), 7 deletions(-)

Comments

Stefano Stabellini April 24, 2019, 12:20 a.m. UTC | #1
On Mon, 22 Apr 2019, Julien Grall wrote:
> CONFIG_EARLY_PRINTK can only be set when CONFIG_DEBUG is enabled. It can
> be quite convenient to only modify the target.
> 
> However, the target clean will not include the .config.
>
> This means CONFIG_DEBUG is not enabled and therefore make will throw
> an error preventing clean to continue.
> 
> The check is not moved at linking time.
               ^ now ?


> Signed-off-by: Julien Grall <julien.grall@arm.com>
> 
> ---
> 
> This code is pretty nasty, but I haven't found a better way for avoiding
> to check if CONFIG_DEBUG is enabled when the target clean is called.
> 
> Ideally we will want to move CONFIG_EARLY_PRINTK in Kconfig. I haven't
> had time yet to look at it properly so far.

Can we include .config in the clean target?


> ---
>  xen/arch/arm/Makefile | 5 +++++
>  xen/arch/arm/Rules.mk | 7 -------
>  2 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
> index cb902cb6fe..fef508c836 100644
> --- a/xen/arch/arm/Makefile
> +++ b/xen/arch/arm/Makefile
> @@ -101,6 +101,11 @@ prelink.o: $(ALL_OBJS)
>  endif
>  
>  $(TARGET)-syms: prelink.o xen.lds
> +ifneq ($(CONFIG_EARLY_PRINTK), )
> +ifneq ($(CONFIG_DEBUG), y)
> +	$(error CONFIG_EARLY_PRINTK enabled for non-debug build)
> +endif
> +endif
>  	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
>  	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
>  	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
> diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
> index f264592aef..12150986c5 100644
> --- a/xen/arch/arm/Rules.mk
> +++ b/xen/arch/arm/Rules.mk
> @@ -80,11 +80,4 @@ CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD)
>  CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
>  CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT)
>  
> -else # !CONFIG_DEBUG
> -
> -ifneq ($(CONFIG_EARLY_PRINTK),)
> -# Early printk is dependant on a debug build.
> -$(error CONFIG_EARLY_PRINTK enabled for non-debug build)
> -endif
> -
>  endif
Julien Grall April 24, 2019, 10:47 a.m. UTC | #2
Hi,

On 24/04/2019 01:20, Stefano Stabellini wrote:
> On Mon, 22 Apr 2019, Julien Grall wrote:
>> CONFIG_EARLY_PRINTK can only be set when CONFIG_DEBUG is enabled. It can
>> be quite convenient to only modify the target.
>>
>> However, the target clean will not include the .config.
>>
>> This means CONFIG_DEBUG is not enabled and therefore make will throw
>> an error preventing clean to continue.
>>
>> The check is not moved at linking time.
>                 ^ now ?
> 
> 
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>>
>> ---
>>
>> This code is pretty nasty, but I haven't found a better way for avoiding
>> to check if CONFIG_DEBUG is enabled when the target clean is called.
>>
>> Ideally we will want to move CONFIG_EARLY_PRINTK in Kconfig. I haven't
>> had time yet to look at it properly so far.
> 
> Can we include .config in the clean target?
I did only mention the clean target in the commit message but the issue is the 
same for any target not include .config. For instance, a distclean results to 
the same error.

It also feels quite wrong to expect the .config to be in place for any target 
other than build.

Cheers,
Jan Beulich May 23, 2019, 8:27 a.m. UTC | #3
>>> On 24.04.19 at 12:47, <julien.grall@arm.com> wrote:
> On 24/04/2019 01:20, Stefano Stabellini wrote:
>> On Mon, 22 Apr 2019, Julien Grall wrote:
>>> This code is pretty nasty, but I haven't found a better way for avoiding
>>> to check if CONFIG_DEBUG is enabled when the target clean is called.
>>>
>>> Ideally we will want to move CONFIG_EARLY_PRINTK in Kconfig. I haven't
>>> had time yet to look at it properly so far.

This, to me, would seem to be the much better approach, as it would
avoid replacing one nasty construct by another. Are there any
complications?

>> Can we include .config in the clean target?
> I did only mention the clean target in the commit message but the issue is the 
> same for any target not include .config. For instance, a distclean results to 
> the same error.
> 
> It also feels quite wrong to expect the .config to be in place for any target 
> other than build.

I agree.

Jan
Julien Grall May 23, 2019, 9:10 a.m. UTC | #4
Hi Jan,

Thank you for the feedback.

On 5/23/19 9:27 AM, Jan Beulich wrote:
>>>> On 24.04.19 at 12:47, <julien.grall@arm.com> wrote:
>> On 24/04/2019 01:20, Stefano Stabellini wrote:
>>> On Mon, 22 Apr 2019, Julien Grall wrote:
>>>> This code is pretty nasty, but I haven't found a better way for avoiding
>>>> to check if CONFIG_DEBUG is enabled when the target clean is called.
>>>>
>>>> Ideally we will want to move CONFIG_EARLY_PRINTK in Kconfig. I haven't
>>>> had time yet to look at it properly so far.
> 
> This, to me, would seem to be the much better approach, as it would
> avoid replacing one nasty construct by another. Are there any
> complications?

Last time I looked at moving earlyprintk to Kconfig I was struggling to 
find a good way describing them.

I guess I can have another look if I can manage to do it in a couple of 
hours.

This patch is more a way to paper the problem before causing more 
trouble when building using Yocto.

Cheers,

>>> Can we include .config in the clean target?
>> I did only mention the clean target in the commit message but the issue is the
>> same for any target not include .config. For instance, a distclean results to
>> the same error.
>>
>> It also feels quite wrong to expect the .config to be in place for any target
>> other than build.
> 
> I agree.
> 
> Jan
> 
>
diff mbox series

Patch

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index cb902cb6fe..fef508c836 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -101,6 +101,11 @@  prelink.o: $(ALL_OBJS)
 endif
 
 $(TARGET)-syms: prelink.o xen.lds
+ifneq ($(CONFIG_EARLY_PRINTK), )
+ifneq ($(CONFIG_DEBUG), y)
+	$(error CONFIG_EARLY_PRINTK enabled for non-debug build)
+endif
+endif
 	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index f264592aef..12150986c5 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -80,11 +80,4 @@  CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD)
 CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
 CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT)
 
-else # !CONFIG_DEBUG
-
-ifneq ($(CONFIG_EARLY_PRINTK),)
-# Early printk is dependant on a debug build.
-$(error CONFIG_EARLY_PRINTK enabled for non-debug build)
-endif
-
 endif