diff mbox

[U-Boot,RFC] Makefile: Add a message warning size change for mpc85xx boards

Message ID 1406669019-31651-1-git-send-email-yorksun@freescale.com
State RFC
Headers show

Commit Message

York Sun July 29, 2014, 9:23 p.m. UTC
Some mpc85xx boards are using 768KB size u-boot image while some
legacy boards still use 512KB. To bring attention to users about
the size change, a message is printed when compiling. SPL/PBL is
not covered by this change.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Kim Phillips <kim.phillips@freescale.com>
---
 Makefile |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

York Sun July 29, 2014, 9:56 p.m. UTC | #1
This is an RFC. Do NOT apply. It outputs the message, tricks MAKEALL to count it
as warning.

York


On 07/29/2014 02:23 PM, York Sun wrote:
> Some mpc85xx boards are using 768KB size u-boot image while some
> legacy boards still use 512KB. To bring attention to users about
> the size change, a message is printed when compiling. SPL/PBL is
> not covered by this change.
> 
> Signed-off-by: York Sun <yorksun@freescale.com>
> CC: Kim Phillips <kim.phillips@freescale.com>
> ---
>  Makefile |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index ca212b5..5c823dc 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -691,8 +691,20 @@ BOARD_SIZE_CHECK = \
>  		exit 1; \
>  	fi
>  else
> +ifdef CONFIG_MPC85xx
> +BOARD_SIZE_CHECK = \
> +	@actual=`wc -c $@ | awk '{print $$1}'`; \
> +	limit=524288; \
> +	if test $$actual -gt $$limit; then \
> +		echo "Attention: File size $$actual bytes, may be different from legacy images" >&2; \
> +		offset=`printf "%x" $$actual`; \
> +		echo "           NOR flash address for u-boot.bin: 0x$$offset from end of boot bank" >&2; \
> +		echo "           See board README"; \
> +	fi
> +else
>  BOARD_SIZE_CHECK =
>  endif
> +endif
>  
>  # Statically apply RELA-style relocations (currently arm64 only)
>  ifneq ($(CONFIG_STATIC_RELA),)
>
Wolfgang Denk July 30, 2014, 5:02 a.m. UTC | #2
Dear York Sun,

In message <1406669019-31651-1-git-send-email-yorksun@freescale.com> you wrote:
> Some mpc85xx boards are using 768KB size u-boot image while some
> legacy boards still use 512KB. To bring attention to users about
> the size change, a message is printed when compiling. SPL/PBL is
> not covered by this change.

This makes no sense to me.  Where are these magic image sizes coming
from?  This is highly board specific stuff at best, probably valid for
some Freescale boards only.

I think if this is useful at all (which I actually doubt) this should
be moved to board specific code, or if you really think it fits, then
maybe made Freescale vendor specific.

But please keep such stuff out of the global Makefile.

Thanks.

Wolfgang Denk
York Sun July 30, 2014, 10:13 p.m. UTC | #3
On 07/29/2014 10:02 PM, Wolfgang Denk wrote:
> Dear York Sun,
> 
> In message <1406669019-31651-1-git-send-email-yorksun@freescale.com> you wrote:
>> Some mpc85xx boards are using 768KB size u-boot image while some
>> legacy boards still use 512KB. To bring attention to users about
>> the size change, a message is printed when compiling. SPL/PBL is
>> not covered by this change.
> 
> This makes no sense to me.  Where are these magic image sizes coming
> from?  This is highly board specific stuff at best, probably valid for
> some Freescale boards only.

This was raised by an end user who got confused by upgrading from the older
image which was 512KB to the new image 768KB. The README file described the
change, but it may be not obvious enough to a user to notice.

Kim proposed the idea to add a compiling warning (not really a warning though)
about the size change to raise attention.

> 
> I think if this is useful at all (which I actually doubt) this should
> be moved to board specific code, or if you really think it fits, then
> maybe made Freescale vendor specific.
> 
> But please keep such stuff out of the global Makefile.
> 

I agree it should not be put into global Makefile. I am struggling to understand
the right way to move such check to arch/powerpc/cpu/mpc85xx/Makefile. Do I need
to add a new target in arch/powerpc/cpu/mpc85xx/Makefile, like

+NEW_TARGET:
+    Do something special here

and add an entry in global Makefile, like


u-boot.bin: u-boot FORCE
        $(call if_changed,objcopy)
        $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
        $(BOARD_SIZE_CHECK)
+        $(Q)$(MAKE) $(build)=arch/powerpc/cpu/mpc85xx NEW_TARGET

Some guidance (or examples) will be appreciated.

York
diff mbox

Patch

diff --git a/Makefile b/Makefile
index ca212b5..5c823dc 100644
--- a/Makefile
+++ b/Makefile
@@ -691,8 +691,20 @@  BOARD_SIZE_CHECK = \
 		exit 1; \
 	fi
 else
+ifdef CONFIG_MPC85xx
+BOARD_SIZE_CHECK = \
+	@actual=`wc -c $@ | awk '{print $$1}'`; \
+	limit=524288; \
+	if test $$actual -gt $$limit; then \
+		echo "Attention: File size $$actual bytes, may be different from legacy images" >&2; \
+		offset=`printf "%x" $$actual`; \
+		echo "           NOR flash address for u-boot.bin: 0x$$offset from end of boot bank" >&2; \
+		echo "           See board README"; \
+	fi
+else
 BOARD_SIZE_CHECK =
 endif
+endif
 
 # Statically apply RELA-style relocations (currently arm64 only)
 ifneq ($(CONFIG_STATIC_RELA),)