[Buildroot] [PATCH 2/3] imx/post-image: Allow flashing u-boot-dtb.imx in the SD card

Fabio Estevam festevam at gmail.com
Sun Jul 8 18:56:41 UTC 2018


Hi Arnout,

On Thu, Jul 5, 2018 at 6:57 PM, Arnout Vandecappelle <arnout at mind.be> wrote:

>  This file only differs from the normal template in the name of the u-boot
> binary, right? So wouldn't it make more sense to make that configurable, just
> like the %FILES%, and handle it in an extra sed line?

I am trying to implement your suggestion, but I think I need some help.

Here is what I have done so far:

diff --git a/board/freescale/common/imx/genimage.cfg.template
b/board/freescale/common/imx/genimage.cfg.template
index acce058..41584d9 100644
--- a/board/freescale/common/imx/genimage.cfg.template
+++ b/board/freescale/common/imx/genimage.cfg.template
@@ -22,7 +22,7 @@ image sdcard.img {

   partition u-boot {
     in-partition-table = "no"
-    image = "u-boot.imx"
+    image = %UBOOTBIN%
     offset = 1024
   }

diff --git a/board/freescale/common/imx/post-image.sh
b/board/freescale/common/imx/post-image.sh
index 264c8a4..2e57cef 100755
--- a/board/freescale/common/imx/post-image.sh
+++ b/board/freescale/common/imx/post-image.sh
@@ -41,8 +41,18 @@ 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 UBOOTBIN="$(uboot_image)"
        local FILES="$(dtb_list) $(linux_image)"
        local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
        local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
@@ -50,6 +60,9 @@ main()
        sed -e "s/%FILES%/${FILES}/" \
                board/freescale/common/imx/$(genimage_type) > ${GENIMAGE_CFG}

+       sed -e "s/%UBOOTBIN%/${UBOOTBIN}/" \
+               board/freescale/common/imx/$(genimage_type) > ${GENIMAGE_CFG}
+
        rm -rf "${GENIMAGE_TMP}"

        genimage \

but it does not work:

>>>   Executing post-image script board/freescale/common/imx/post-image.sh
file(%FILES%): stat(/home/fabio/buildroot/output/images/%FILES%)
failed: No such file or directory
vfat(boot.vfat): could not setup %FILES%

Could you please provide some suggestion?

Thanks



More information about the buildroot mailing list