diff mbox

[U-Boot,1/2] Makefile: Allow arch post-link hook

Message ID 20170616000510.27262-1-paul.burton@imgtec.com
State Accepted
Commit 09bebb8397f72340812de577a2d00612c7b7ed75
Delegated to: Daniel Schwierzeck
Headers show

Commit Message

Paul Burton June 16, 2017, 12:05 a.m. UTC
This commit allows an architecture to provide a Makefile.postlink whose
u-boot target gets invoked after the u-boot ELF is linked. This will be
of use for MIPS in a following commit.

This mirrors Linux commit fbe6e37dab97 ("kbuild: add arch specific
post-link Makefile").

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de
---

 Makefile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Tom Rini June 16, 2017, 12:58 p.m. UTC | #1
On Thu, Jun 15, 2017 at 05:05:09PM -0700, Paul Burton wrote:

> This commit allows an architecture to provide a Makefile.postlink whose
> u-boot target gets invoked after the u-boot ELF is linked. This will be
> of use for MIPS in a following commit.
> 
> This mirrors Linux commit fbe6e37dab97 ("kbuild: add arch specific
> post-link Makefile").
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: u-boot@lists.denx.de

Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass June 17, 2017, 3:43 a.m. UTC | #2
On 15 June 2017 at 18:05, Paul Burton <paul.burton@imgtec.com> wrote:
> This commit allows an architecture to provide a Makefile.postlink whose
> u-boot target gets invoked after the u-boot ELF is linked. This will be
> of use for MIPS in a following commit.
>
> This mirrors Linux commit fbe6e37dab97 ("kbuild: add arch specific
> post-link Makefile").
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: u-boot@lists.denx.de
> ---
>
>  Makefile | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Daniel Schwierzeck June 23, 2017, 3:22 p.m. UTC | #3
Am 16.06.2017 um 02:05 schrieb Paul Burton:
> This commit allows an architecture to provide a Makefile.postlink whose
> u-boot target gets invoked after the u-boot ELF is linked. This will be
> of use for MIPS in a following commit.
> 
> This mirrors Linux commit fbe6e37dab97 ("kbuild: add arch specific
> post-link Makefile").
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: u-boot@lists.denx.de
> ---
> 
>  Makefile | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

applied to u-boot-mips/next, thanks.
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 62d0482bcf..3c3bbc5109 100644
--- a/Makefile
+++ b/Makefile
@@ -1215,13 +1215,16 @@  u-boot.elf: u-boot.bin
 	$(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o
 	$(call if_changed,u-boot-elf)
 
+ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(ARCH)/Makefile.postlink)
+
 # Rule to link u-boot
 # May be overridden by arch/$(ARCH)/config.mk
 quiet_cmd_u-boot__ ?= LD      $@
       cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \
       -T u-boot.lds $(u-boot-init)                             \
       --start-group $(u-boot-main) --end-group                 \
-      $(PLATFORM_LIBS) -Map u-boot.map
+      $(PLATFORM_LIBS) -Map u-boot.map;                        \
+      $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
 
 quiet_cmd_smap = GEN     common/system_map.o
 cmd_smap = \
@@ -1231,7 +1234,7 @@  cmd_smap = \
 		-c $(srctree)/common/system_map.c -o common/system_map.o
 
 u-boot:	$(u-boot-init) $(u-boot-main) u-boot.lds FORCE
-	$(call if_changed,u-boot__)
+	+$(call if_changed,u-boot__)
 ifeq ($(CONFIG_KALLSYMS),y)
 	$(call cmd,smap)
 	$(call cmd,u-boot__) common/system_map.o