imx/post-image: Allow flashing u-boot-dtb.imx in the SD card
authorFabio Estevam <festevam@gmail.com>
Sun, 8 Jul 2018 21:16:18 +0000 (18:16 -0300)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Wed, 18 Jul 2018 09:47:06 +0000 (11:47 +0200)
Add support for flashing the u-boot-dtb.imx binary in the SD card
when a target selects BR2_TARGET_UBOOT_FORMAT_DTB_IMX.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
board/freescale/common/imx/genimage.cfg.template
board/freescale/common/imx/post-image.sh

index acce058b2afa957358694657a48e2a600941bd7d..2a7036a7df2634c01046403b8a01b5995947bb78 100644 (file)
@@ -22,7 +22,7 @@ image sdcard.img {
 
   partition u-boot {
     in-partition-table = "no"
-    image = "u-boot.imx"
+    image = "%UBOOTBIN%"
     offset = 1024
   }
 
index 264c8a4bcb258136ada3bba75ab98167408855b7..6590beda3e3e172d7a63000d3e53b97228807a03 100755 (executable)
@@ -41,13 +41,24 @@ genimage_type()
        fi
 }
 
+uboot_image()
+{
+       if grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then
+               echo "u-boot-dtb.imx"
+       elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then
+               echo "u-boot.imx"
+       fi
+}
+
 main()
 {
        local FILES="$(dtb_list) $(linux_image)"
+       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/%UBOOTBIN%/${UBOOTBIN}/" \
                board/freescale/common/imx/$(genimage_type) > ${GENIMAGE_CFG}
 
        rm -rf "${GENIMAGE_TMP}"