Commit bdc7dc4595646da8774f53a2c4f5a7599b0a5f16

Authored by Thomas Petazzoni
Committed by Tom Rini
1 parent e5bf9878ea

tools/env: change stripping strategy to allow no-stripping

When building the U-Boot tools for non-ELF platforms (such as Blackfin
FLAT), since commit 79fc0c5f498c3982aa4740c273ab1a9255063d9c
("tools/env: cross-compile fw_printenv without setting HOSTCC"), the
build fails because it tries to strip a FLAT binary, which does not
make sense.

This commit solves this by changing the stripping logic in
tools/env/Makefile to be similar to the one in tools/Makefile. This
logic continues to apply strip to the final binary, but does not abort
the build if it fails, and does the stripping in place on the final
binary. This allows the logic to work fine if stripping doesn't work,
as it leaves the final binary untouched.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Sonic Zhang <sonic.zhang@analog.com>
Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Sonic Zhang <sonic.zhang@analog.com>

Showing 1 changed file with 8 additions and 6 deletions Side-by-side Diff

... ... @@ -21,15 +21,17 @@
21 21 endif
22 22  
23 23 always := fw_printenv
24   -hostprogs-y := fw_printenv_unstripped
  24 +hostprogs-y := fw_printenv
25 25  
26   -fw_printenv_unstripped-objs := fw_env.o fw_env_main.o \
  26 +fw_printenv-objs := fw_env.o fw_env_main.o \
27 27 crc32.o ctype.o linux_string.o \
28 28 env_attr.o env_flags.o aes.o
29 29  
30   -quiet_cmd_strip = STRIP $@
31   - cmd_strip = $(STRIP) -o $@ $<
  30 +quiet_cmd_crosstools_strip = STRIP $^
  31 + cmd_crosstools_strip = $(STRIP) $^; touch $@
32 32  
33   -$(obj)/fw_printenv: $(obj)/fw_printenv_unstripped FORCE
34   - $(call if_changed,strip)
  33 +$(obj)/.strip: $(obj)/fw_printenv
  34 + $(call cmd,crosstools_strip)
  35 +
  36 +always += .strip