tfa-layerscape: fix create_pbl and byte_swap host build

- make create_pbl and byte_swap as host tools

- fix a bug that maybe use the cross compiler
to compile create_pbl and byte_swap:

	# -a option appends the image for Chassis 3 devices in case of non secure boot
	aarch64-openwrt-linux-musl-gcc -Wall -Werror -pedantic -std=c99 -O2
	 -DVERSION=v1.5(release):reboot-10604-ge9216b3336 -D_GNU_SOURCE -D_XOPEN_SOURCE=700
	 -c -o create_pbl.o create_pbl.c
	cc1: note: someone does not honour COPTS correctly, passed 0 times
	  LD      create_pbl
	/usr/bin/ld: create_pbl.o: Relocations in generic ELF (EM: 183)
	/usr/bin/ld: create_pbl.o: Relocations in generic ELF (EM: 183)
	/usr/bin/ld: create_pbl.o: Relocations in generic ELF (EM: 183)
	create_pbl.o: error adding symbols: File in wrong format
	collect2: error: ld returned 1 exit status
	Makefile:43: recipe for target create_pbl failed
	make[4]: *** [create_pbl] Error 1
	plat/nxp/tools/pbl_ch2.mk:45: recipe for target pbl failed
	make[3]: *** [pbl] Error 2

- add tfa- prefix to all tools in order to avoid future clashes with
  other toolnames

Signed-off-by: Biwen Li <biwen.li@nxp.com>
[added missing HOST_CFLAGS, added tfa- prefix to the tools]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
master
Biwen Li 5 years ago committed by Petr Štetiar
parent a1c6a316d2
commit 83d5ca2186

@ -48,7 +48,9 @@ define Build/Compile
fip pbl PLAT=$(PLAT) BOOT_MODE=$(BOOT_MODE) \
RCW=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-rcw.bin \
BL33=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot.bin \
FIPTOOL=$(STAGING_DIR_HOST)/bin/fiptool
FIPTOOL=$(STAGING_DIR_HOST)/bin/tfa-fiptool \
CREATE_PBL=$(STAGING_DIR_HOST)/bin/tfa-create-pbl \
BYTE_SWAP=$(STAGING_DIR_HOST)/bin/tfa-byte-swap
endef
HOST_CFLAGS += -Wall -Werror -pedantic -std=c99
@ -57,10 +59,15 @@ define Host/Compile
$(HOST_BUILD_DIR)/tools/fiptool \
CFLAGS="$(HOST_CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)"
$(MAKE) -C \
$(HOST_BUILD_DIR)/plat/nxp/tools \
CFLAGS="$(HOST_CFLAGS)"
endef
define Host/Install
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/fiptool/fiptool $(STAGING_DIR_HOST)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/fiptool/fiptool $(STAGING_DIR_HOST)/bin/tfa-fiptool
$(INSTALL_BIN) $(HOST_BUILD_DIR)/plat/nxp/tools/create_pbl $(STAGING_DIR_HOST)/bin/tfa-create-pbl
$(INSTALL_BIN) $(HOST_BUILD_DIR)/plat/nxp/tools/byte_swap $(STAGING_DIR_HOST)/bin/tfa-byte-swap
endef
define Package/tfa-layerscape/ls1012ardb

@ -0,0 +1,30 @@
From 65e9a722b44bf28b98fe25b3b174761b47ec7dbd Mon Sep 17 00:00:00 2001
From: Biwen Li <biwen.li@nxp.com>
Date: Mon, 1 Apr 2019 13:41:55 +0800
Subject: [PATCH 2/3] plat/nxp/tools: fix a makefile bug that will use default
implicit rules
The patch fix a makefile bug that will use default implicit rules,
because do not have explicit rules for the destination files.
Signed-off-by: Biwen Li <biwen.li@nxp.com>
---
plat/nxp/tools/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plat/nxp/tools/Makefile b/plat/nxp/tools/Makefile
index 2095294b..0082a0be 100644
--- a/plat/nxp/tools/Makefile
+++ b/plat/nxp/tools/Makefile
@@ -53,7 +53,7 @@ ${PROJECT_2}: ${OBJECTS_2} Makefile
@echo "Built $@ successfully"
@${ECHO_BLANK_LINE}
-%.o: %.c %.h Makefile
+%.o: %.c Makefile
@echo " CC $<"
${Q}${HOSTCC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@
--
2.17.1

@ -0,0 +1,60 @@
From 8a458876013991fe2f288bbe4694264b16c3b9e9 Mon Sep 17 00:00:00 2001
From: Biwen Li <biwen.li@nxp.com>
Date: Fri, 26 Jul 2019 15:44:10 +0800
Subject: [PATCH 3/3] plat/nxp/tools: fix create_pbl and byte_swap host build
Not compile create_pbl and byte_swap in the process of cross compilation
Signed-off-by: Biwen Li <biwen.li@nxp.com>
---
plat/nxp/tools/pbl_ch2.mk | 3 ---
plat/nxp/tools/pbl_ch3.mk | 5 -----
2 files changed, 8 deletions(-)
diff --git a/plat/nxp/tools/pbl_ch2.mk b/plat/nxp/tools/pbl_ch2.mk
index afa43520..ff624dd9 100644
--- a/plat/nxp/tools/pbl_ch2.mk
+++ b/plat/nxp/tools/pbl_ch2.mk
@@ -20,8 +20,6 @@ ifeq ($(RCW),"")
else
# Generate header for bl2.bin
$(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
- # Compile create_pbl tool
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH};\
# Add bl2.bin to RCW
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\
-o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;\
@@ -43,7 +41,6 @@ ifeq ($(RCW),"")
${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
else
# -a option appends the image for Chassis 3 devices in case of non secure boot
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH};
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \
-o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;
# Swapping of RCW is required for QSPi Chassis 2 devices
diff --git a/plat/nxp/tools/pbl_ch3.mk b/plat/nxp/tools/pbl_ch3.mk
index 944ae3bb..9aa8f635 100644
--- a/plat/nxp/tools/pbl_ch3.mk
+++ b/plat/nxp/tools/pbl_ch3.mk
@@ -27,9 +27,6 @@ else
# Generate header for bl2.bin
$(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
- # Compile create_pbl tool
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH};\
-
# Add Block Copy command for bl2.bin to RCW
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\
-o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl -f ${BL2_SRC_OFFSET};\
@@ -57,8 +54,6 @@ else #SECURE_BOOT
ifeq ($(RCW),"")
${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
else
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH};
-
# Add Block Copy command and populate boot loc ptrfor bl2.bin to RCW
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \
-o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl -f ${BL2_SRC_OFFSET};
--
2.17.1
Loading…
Cancel
Save