From 2decaaf821c54ce893cc33e30bf04066d8aef0c1 Mon Sep 17 00:00:00 2001 From: Kirill Kapranov Date: Wed, 19 Aug 2020 21:32:06 +0300 Subject: [PATCH] u-boot: Reengineering of environment allocation The offset and size of the environment block for u-boot compiling and fw_utils are described in the single file ucm-imx8m-mini.conf to avoid data nsynchronizing. Signed-off-by: Kirill Kapranov --- conf/machine/ucm-imx8m-mini.conf | 4 +++- recipes-bsp/u-boot/u-boot-fslc-fw-utils_%.bbappend | 11 +++++++++++ recipes-bsp/u-boot/u-boot-imx_%.bbappend | 10 ++++++++++ recipes-bsp/u-boot/u-boot-imx_2017.03.bbappend | 3 --- recipes-bsp/u-boot/u-boot-imx_2018.03.bbappend | 3 --- 5 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 recipes-bsp/u-boot/u-boot-imx_%.bbappend delete mode 100644 recipes-bsp/u-boot/u-boot-imx_2017.03.bbappend delete mode 100644 recipes-bsp/u-boot/u-boot-imx_2018.03.bbappend diff --git a/conf/machine/ucm-imx8m-mini.conf b/conf/machine/ucm-imx8m-mini.conf index fb832ad..8705c08 100644 --- a/conf/machine/ucm-imx8m-mini.conf +++ b/conf/machine/ucm-imx8m-mini.conf @@ -43,7 +43,9 @@ LOADADDR = "" UBOOT_SUFFIX = "bin" UBOOT_MAKE_TARGET = "" IMX_BOOT_SEEK = "33" - +# Max GPT size is 34 * 512 +UBOOT_ENV_OFFSET = "0x4400" +UBOOT_ENV_SIZE = "0x1000" OPTEE_BIN_EXT = "8mm" PLATFORM_FLAVOR_ucm-imx8m-mini = "mx8mmevk" diff --git a/recipes-bsp/u-boot/u-boot-fslc-fw-utils_%.bbappend b/recipes-bsp/u-boot/u-boot-fslc-fw-utils_%.bbappend index cf6cce0..066dd82 100644 --- a/recipes-bsp/u-boot/u-boot-fslc-fw-utils_%.bbappend +++ b/recipes-bsp/u-boot/u-boot-fslc-fw-utils_%.bbappend @@ -17,4 +17,15 @@ do_compile () { oe_runmake envtools } +do_install_prepend () { + if [ -e ${WORKDIR}/fw_env.config ]; then + sed -i -e \ + 's:\(.*/dev/mmcblk[^[:blank:]]*\)[[:blank:]].*$:\1 ${UBOOT_ENV_OFFSET} ${UBOOT_ENV_SIZE}:' \ + ${WORKDIR}/fw_env.config + else + bbfatal "fw_env.config not found in ${WORKDIR}" + + fi +} + RPROVIDES_${PN} += "u-boot-fw-utils" diff --git a/recipes-bsp/u-boot/u-boot-imx_%.bbappend b/recipes-bsp/u-boot/u-boot-imx_%.bbappend new file mode 100644 index 0000000..d33959e --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-imx_%.bbappend @@ -0,0 +1,10 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/compulab/imx8mm:" + +include compulab/imx8mm.inc + +do_compile_prepend () { + sed -i -e \ + "s/^\(#define[[:blank:]]*CONFIG_ENV_OFFSET[[:blank:]]*\).*$/\1${UBOOT_ENV_OFFSET}/"\ + -e "s/^\(#define[[:blank:]]*CONFIG_ENV_SIZE[[:blank:]]*\).*$/\1${UBOOT_ENV_SIZE}/" \ + ${S}/include/configs/ucm-imx8m-mini.h +} diff --git a/recipes-bsp/u-boot/u-boot-imx_2017.03.bbappend b/recipes-bsp/u-boot/u-boot-imx_2017.03.bbappend deleted file mode 100644 index 0b765ec..0000000 --- a/recipes-bsp/u-boot/u-boot-imx_2017.03.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/compulab/imx8mm:" - -include compulab/imx8mm.inc diff --git a/recipes-bsp/u-boot/u-boot-imx_2018.03.bbappend b/recipes-bsp/u-boot/u-boot-imx_2018.03.bbappend deleted file mode 100644 index 0b765ec..0000000 --- a/recipes-bsp/u-boot/u-boot-imx_2018.03.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/compulab/imx8mm:" - -include compulab/imx8mm.inc