All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arc: introduce "mdbtrick" target
@ 2014-12-26  9:51 Alexey Brodkin
  2014-12-26 10:00 ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Brodkin @ 2014-12-26  9:51 UTC (permalink / raw)
  To: u-boot

MetaWare debugger doesn't support PIE (position-independent executable)
so the only way to load U-Boot in MDB is to fake it by:
  1. Reset PIE flag in ELF header
  2. Strip all debug information from elf

Even though it could be done manually but having this automated way
is very convenient. User may build U-Boot that will be loaded on target
via MDB saying "make mdbtrick".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Tom Rini <trini@ti.com>
---
 arch/arc/Makefile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index de25cc9..03ea6db 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -6,3 +6,18 @@ head-y := arch/arc/cpu/$(CPU)/start.o
 
 libs-y += arch/arc/cpu/$(CPU)/
 libs-y += arch/arc/lib/
+
+# MetaWare debugger doesn't support PIE (position-independent executable)
+# so the only way to load U-Boot in MDB is to fake it by:
+#   1. Reset PIE flag in ELF header
+#   2. Strip all debug information from elf
+ifdef CONFIG_SYS_LITTLE_ENDIAN
+	EXEC_TYPE_OFFSET=16
+else
+	EXEC_TYPE_OFFSET=17
+endif
+
+mdbtrick: u-boot
+	$(Q)printf '\x02' | dd of=u-boot bs=1 seek=$(EXEC_TYPE_OFFSET) count=1 \
+		conv=notrunc &> /dev/null
+	$(Q)$(CROSS_COMPILE)strip -g u-boot
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-26 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26  9:51 [U-Boot] [PATCH] arc: introduce "mdbtrick" target Alexey Brodkin
2014-12-26 10:00 ` Wolfgang Denk
2014-12-26 10:17   ` Alexey Brodkin
2014-12-26 15:48     ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.