arm-trusted-firmware-rockchip-vendor: workaround for VARIANT issue

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
(cherry picked from commit 751967e121738723182408c7c22ad003234ccf69)
This commit is contained in:
Tianling Shen 2021-08-13 00:35:13 +08:00
parent 87464461d3
commit 9a3b347499
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 44 additions and 15 deletions

View File

@ -29,38 +29,26 @@ define Package/arm-trusted-firmware-rk3328
$(Package/arm-trusted-firmware-rockchip-vendor)
DEPENDS:=@TARGET_rockchip_armv8
VARIANT:=rk3328
ATF:=rk33/rk322xh_bl31_v1.46.elf
DDR:=rk33/rk3328_ddr_333MHz_v1.17.bin
LOADER:=rk33/rk322xh_miniloader_v2.50.bin
endef
define Package/arm-trusted-firmware-rk3399
$(Package/arm-trusted-firmware-rockchip-vendor)
DEPENDS:=@TARGET_rockchip_armv8
VARIANT:=rk3399
ATF:=rk33/rk3399_bl31_v1.35.elf
DDR:=rk33/rk3399_ddr_800MHz_v1.25.bin
LOADER:=rk33/rk3399_miniloader_v1.26.bin
endef
define Build/Configure
$(SED) 's,$$$$(PKG_BUILD_DIR),$(PKG_BUILD_DIR),g' $(PKG_BUILD_DIR)/trust.ini
$(SED) 's,$$$$(VARIANT),$(VARIANT),g' $(PKG_BUILD_DIR)/trust.ini
$(SED) 's,$$$$(VARIANT),$(BUILD_VARIANT),g' $(PKG_BUILD_DIR)/trust.ini
$(call Build/Configure/Default)
endef
define Build/Compile
mkimage -n $(VARIANT) -T rksd -d $(PKG_BUILD_DIR)/bin/$(DDR) $(PKG_BUILD_DIR)/$(VARIANT)-idbloader.bin
cat $(PKG_BUILD_DIR)/bin/$(LOADER) >> $(PKG_BUILD_DIR)/$(VARIANT)-idbloader.bin
$(PKG_BUILD_DIR)/tools/trust_merger --replace bl31.elf $(PKG_BUILD_DIR)/bin/$(ATF) $(PKG_BUILD_DIR)/trust.ini
$(CURDIR)/pack-firmware.sh build $(BUILD_VARIANT) '$(PKG_BUILD_DIR)'
endef
define Build/InstallDev
$(INSTALL_DIR) -p $(STAGING_DIR_IMAGE)
$(CP) $(PKG_BUILD_DIR)/bin/$(ATF) $(STAGING_DIR_IMAGE)/
$(CP) $(PKG_BUILD_DIR)/tools/loaderimage $(STAGING_DIR_IMAGE)/
$(CP) $(PKG_BUILD_DIR)/$(VARIANT)-idbloader.bin $(STAGING_DIR_IMAGE)/
$(CP) $(PKG_BUILD_DIR)/$(VARIANT)-trust.bin $(STAGING_DIR_IMAGE)/
$(CURDIR)/pack-firmware.sh install $(BUILD_VARIANT) '$(PKG_BUILD_DIR)' '$(STAGING_DIR_IMAGE)'
endef
define Package/arm-trusted-firmware-rk3328/install

View File

@ -0,0 +1,41 @@
#!/bin/bash
# Copyright (C) 2021 ImmortalWrt.org
ACTION="$1"
VARIANT="$2"
PKG_BUILD_DIR="$3"
STAGING_DIR_IMAGE="$4"
case "$VARIANT" in
"rk3328")
ATF="rk33/rk322xh_bl31_v1.46.elf"
DDR="rk33/rk3328_ddr_333MHz_v1.17.bin"
LOADER="rk33/rk322xh_miniloader_v2.50.bin"
;;
"rk3399")
ATF="rk33/rk3399_bl31_v1.35.elf"
DDR="rk33/rk3399_ddr_800MHz_v1.25.bin"
LOADER="rk33/rk3399_miniloader_v1.26.bin"
;;
*)
echo -e "Not compatible with your platform: $VARIANT."
exit 1
;;
esac
set -x
if [ "$ACTION" == "build" ]; then
mkimage -n "$VARIANT" -T "rksd" -d "$PKG_BUILD_DIR/bin/$DDR" "$PKG_BUILD_DIR/$VARIANT-idbloader.bin"
cat "$PKG_BUILD_DIR/bin/$LOADER" >> "$PKG_BUILD_DIR/$VARIANT-idbloader.bin"
"$PKG_BUILD_DIR/tools/trust_merger" --replace "bl31.elf" "$PKG_BUILD_DIR/bin/$ATF" "$PKG_BUILD_DIR/trust.ini"
elif [ "$ACTION" == "install" ]; then
mkdir -p "$STAGING_DIR_IMAGE"
cp -fp "$PKG_BUILD_DIR/bin/$ATF" "$STAGING_DIR_IMAGE"/
cp -fp "$PKG_BUILD_DIR/tools/loaderimage" "$STAGING_DIR_IMAGE"/
cp -fp "$PKG_BUILD_DIR/$VARIANT-idbloader.bin" "$STAGING_DIR_IMAGE"/
cp -fp "$PKG_BUILD_DIR/$VARIANT-trust.bin" "$STAGING_DIR_IMAGE"/
else
echo -e "Unknown operation: $ACTION."
exit 1
fi
set +x