Skip to contentSkip to conversation

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

PATCH In review Thomas Petazzoni 4 participants 4 messages Aug 27, 2014 – Sep 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Cc Masahiro Yamada <[email protected]>
Cc Sonic Zhang <[email protected]>

---
An improved solution would be to be able to override STRIP completely by setting it to /bin/true, but the main Makefile enforces STRIP = $(CROSS_COMPILE)strip.

---
 tools/env/Makefile | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
tools/env/Makefile +8 -6
index 4927489..40164f7 100644
@@ -21,14 +21,16 @@ HOST_EXTRACFLAGS += -DMTD_OLD
 endif
 
 always := fw_printenv
-hostprogs-y := fw_printenv_unstripped
+hostprogs-y := fw_printenv
 
-fw_printenv_unstripped-objs := fw_env.o fw_env_main.o \
+fw_printenv-objs := fw_env.o fw_env_main.o \
 	crc32.o ctype.o linux_string.o \
 	env_attr.o env_flags.o aes.o
 
-quiet_cmd_strip = STRIP   $@
-      cmd_strip = $(STRIP) -o $@ $<
+quiet_cmd_crosstools_strip = STRIP   $^
+      cmd_crosstools_strip = $(STRIP) $^; touch $@
 
-$(obj)/fw_printenv: $(obj)/fw_printenv_unstripped FORCE
-	$(call if_changed,strip)
+$(obj)/.strip: $(obj)/fw_printenv
+	$(call cmd,crosstools_strip)
+
+always += .strip
Signature · 1 line
2.0.0
#1 lore raw

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

Quoted 13 lines · On Wed, 27 Aug 2014 14:29:00 +0200 Thomas Petazzoni…

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.

Quoted 3 lines
Cc Masahiro Yamada <[email protected]>
Cc Sonic Zhang <[email protected]>

Thanks!

#2 lore raw

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

In reply to Thomas Petazzoni
Quoted 54 lines · Thomas Petazzoni

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.

Cc Masahiro Yamada <[email protected]>
Cc Sonic Zhang <[email protected]>

---
An improved solution would be to be able to override STRIP completely by setting it to /bin/true, but the main Makefile enforces STRIP = $(CROSS_COMPILE)strip.

---
 tools/env/Makefile | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
tools/env/Makefile +8 -7
index 4927489..40164f7 100644
@@ -21,14 +21,16 @@ HOST_EXTRACFLAGS += -DMTD_OLD
 endif
 
 always := fw_printenv
-hostprogs-y := fw_printenv_unstripped
+hostprogs-y := fw_printenv
 
-fw_printenv_unstripped-objs := fw_env.o fw_env_main.o \
+fw_printenv-objs := fw_env.o fw_env_main.o \
        crc32.o ctype.o linux_string.o \
        env_attr.o env_flags.o aes.o
 
-quiet_cmd_strip = STRIP   $@
-      cmd_strip = $(STRIP) -o $@ $<
+quiet_cmd_crosstools_strip = STRIP   $^
+      cmd_crosstools_strip = $(STRIP) $^; touch $@
 
-$(obj)/fw_printenv: $(obj)/fw_printenv_unstripped FORCE
-       $(call if_changed,strip)
+$(obj)/.strip: $(obj)/fw_printenv
+       $(call cmd,crosstools_strip)
+
+always += .strip
--
Quoted 2 lines

2.0.0

Regards,

Sonic

#3 lore raw
In reply to Thomas Petazzoni
Quoted 13 lines · Thomas Petazzoni

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.

Quoted 5 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140925/40e4792a/attachment.pgp>