board/freescale/common/imx: add support for i.MX8X
authorAndré Hentschel <andre.hentschel@zf.com>
Mon, 18 Feb 2019 20:48:06 +0000 (21:48 +0100)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 23 Feb 2019 15:23:08 +0000 (16:23 +0100)
Signed-off-by: André Hentschel <andre.hentschel@zf.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
board/freescale/common/imx/genimage.cfg.template_imx8
board/freescale/common/imx/imx8-bootloader-prepare.sh
board/freescale/common/imx/post-image.sh

index 2f8842f8e0f669c778cc9745dfab4886562f0b40..bd5f6cdc738d04c4f00b970d23010967d912fdb5 100644 (file)
@@ -23,7 +23,7 @@ image sdcard.img {
   partition imx-boot {
     in-partition-table = "no"
     image = "imx8-boot-sd.bin"
-    offset = 33K
+    offset = %IMXOFFSET%
   }
 
   partition boot {
index cc12666ae6c0088e6b7d7cc05ded97142e1ad4d4..e98e93a857b15c6d56cc041f968f17df26e1d4ee 100755 (executable)
@@ -7,12 +7,22 @@ main ()
                echo "ERROR: couldn't find dtb: $UBOOT_DTB"
                exit 1
        fi
-       cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
-       BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
-       ${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
-       rm -f ${BINARIES_DIR}/u-boot.its
 
-       ${HOST_DIR}/bin/mkimage_imx8 -fit -signed_hdmi ${BINARIES_DIR}/signed_hdmi_imx8m.bin -loader ${BINARIES_DIR}/u-boot-spl-ddr.bin 0x7E1000 -second_loader ${BINARIES_DIR}/u-boot.itb 0x40200000 0x60000 -out ${BINARIES_DIR}/imx8-boot-sd.bin
+       if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
+               cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
+               BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
+               ${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
+               rm -f ${BINARIES_DIR}/u-boot.its
+
+               ${HOST_DIR}/bin/mkimage_imx8 -fit -signed_hdmi ${BINARIES_DIR}/signed_hdmi_imx8m.bin -loader ${BINARIES_DIR}/u-boot-spl-ddr.bin 0x7E1000 -second_loader ${BINARIES_DIR}/u-boot.itb 0x40200000 0x60000 -out ${BINARIES_DIR}/imx8-boot-sd.bin
+       else
+               ${HOST_DIR}/bin/mkimage_imx8 -commit > ${BINARIES_DIR}/mkimg.commit
+               cat ${BINARIES_DIR}/u-boot.bin ${BINARIES_DIR}/mkimg.commit > ${BINARIES_DIR}/u-boot-hash.bin
+               cp ${BINARIES_DIR}/bl31.bin ${BINARIES_DIR}/u-boot-atf.bin
+               dd if=${BINARIES_DIR}/u-boot-hash.bin of=${BINARIES_DIR}/u-boot-atf.bin bs=1K seek=128
+
+               ${HOST_DIR}/bin/mkimage_imx8 -soc QX -rev B0 -append ${BINARIES_DIR}/ahab-container.img -c -scfw ${BINARIES_DIR}/mx8qx-mek-scfw-tcm.bin -ap ${BINARIES_DIR}/u-boot-atf.bin a35 0x80000000 -out ${BINARIES_DIR}/imx8-boot-sd.bin
+       fi
 
        exit $?
 }
index 6590beda3e3e172d7a63000d3e53b97228807a03..12a5bea73b4030502263d959a4c5d61c6841b628 100755 (executable)
@@ -34,6 +34,8 @@ genimage_type()
 {
        if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
                echo "genimage.cfg.template_imx8"
+       elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X=y$" ${BR2_CONFIG}; then
+               echo "genimage.cfg.template_imx8"
        elif grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
                echo "genimage.cfg.template_spl"
        else
@@ -41,6 +43,15 @@ genimage_type()
        fi
 }
 
+imx_offset()
+{
+       if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
+               echo "33K"
+       else
+               echo "32K"
+       fi
+}
+
 uboot_image()
 {
        if grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then
@@ -53,11 +64,13 @@ uboot_image()
 main()
 {
        local FILES="$(dtb_list) $(linux_image)"
+       local IMXOFFSET="$(imx_offset)"
        local UBOOTBIN="$(uboot_image)"
        local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
        local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
 
        sed -e "s/%FILES%/${FILES}/" \
+               -e "s/%IMXOFFSET%/${IMXOFFSET}/" \
                -e "s/%UBOOTBIN%/${UBOOTBIN}/" \
                board/freescale/common/imx/$(genimage_type) > ${GENIMAGE_CFG}