diff mbox series

[v2,11/23] microblaze: Enable REMAKE_ELF

Message ID 321cfddf6dac18f578de6fbd57e103ddb94e0de9.1654589430.git.michal.simek@amd.com
State Superseded
Delegated to: Michal Simek
Headers show
Series microblaze: Add support for full relocation | expand

Commit Message

Michal Simek June 7, 2022, 8:10 a.m. UTC
Enable u-boot.elf recreation from u-boot.bin to prepare for removing manul
relocation. Enable option for big endian configuration but it is not used
too much that's why it is completely untested.
By supporting this system there is a need to define LITTLE/BIG endian
Kconfig options to pass -EL/-EB flags.

Full command line for u-boot.elf recreation looks like this:
microblazeel-xilinx-linux-gnu-objcopy -I binary -B microblaze \
 -O elf32-microblazeel u-boot.bin u-boot-elf.o

Signed-off-by: Michal Simek <michal.simek@amd.com>
---

Changes in v2:
- Fix endian selection

 arch/Kconfig                         | 6 +++---
 arch/microblaze/config.mk            | 6 ++++++
 configs/microblaze-generic_defconfig | 1 +
 3 files changed, 10 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/arch/Kconfig b/arch/Kconfig
index 4851300e9bbe..02de32f9c77f 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -448,7 +448,7 @@  source "arch/riscv/Kconfig"
 
 source "board/keymile/Kconfig"
 
-if MIPS
+if MIPS || MICROBLAZE
 
 choice
 	prompt "Endianness selection"
@@ -460,11 +460,11 @@  choice
 
 config SYS_BIG_ENDIAN
 	bool "Big endian"
-	depends on SUPPORTS_BIG_ENDIAN
+	depends on (SUPPORTS_BIG_ENDIAN && MIPS) || MICROBLAZE
 
 config SYS_LITTLE_ENDIAN
 	bool "Little endian"
-	depends on SUPPORTS_LITTLE_ENDIAN
+	depends on (SUPPORTS_LITTLE_ENDIAN && MIPS) || MICROBLAZE
 
 endchoice
 
diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk
index de5b97e719cc..3e84a832fc12 100644
--- a/arch/microblaze/config.mk
+++ b/arch/microblaze/config.mk
@@ -16,3 +16,9 @@  LDFLAGS_FINAL += --gc-sections
 ifeq ($(CONFIG_SPL_BUILD),)
 PLATFORM_CPPFLAGS += -fPIC
 endif
+
+ifeq ($(CONFIG_SYS_LITTLE_ENDIAN),y)
+PLATFORM_ELFFLAGS += -B microblaze $(OBJCOPYFLAGS) -O elf32-microblazeel
+else
+PLATFORM_ELFFLAGS += -B microblaze $(OBJCOPYFLAGS) -O elf32-microblaze
+endif
diff --git a/configs/microblaze-generic_defconfig b/configs/microblaze-generic_defconfig
index c0f5d4c9a1cf..c2d25ea460b2 100644
--- a/configs/microblaze-generic_defconfig
+++ b/configs/microblaze-generic_defconfig
@@ -18,6 +18,7 @@  CONFIG_XILINX_MICROBLAZE0_USE_DIV=1
 CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=2
 CONFIG_DEBUG_UART=y
 CONFIG_DISTRO_DEFAULTS=y
+CONFIG_REMAKE_ELF=y
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=-1