summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2018-03-26 22:50:38 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2018-03-28 18:06:52 +0200
commitf33a87a519444fd2b4618eb1713cb5cce2b6a007 (patch)
tree3ed54cf280db6ce0ce91c2515b3bc2373df7c207
parent53ce474afe0b496f311c76689362f6a82e0c97de (diff)
u-boot-toradex: add inc to generate U-Boot default environment
Including u-boot-toradex-env.inc will generate a uEnv.txt text file containing the default environment of the U-Boot binary. This is useful for Toradex Easy Installer to write the default environment using the "u_boot_env" property. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r--recipes-bsp/u-boot/u-boot-toradex-env.inc74
1 files changed, 74 insertions, 0 deletions
diff --git a/recipes-bsp/u-boot/u-boot-toradex-env.inc b/recipes-bsp/u-boot/u-boot-toradex-env.inc
new file mode 100644
index 0000000..74c0b49
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-toradex-env.inc
@@ -0,0 +1,74 @@
+# This provides uEnv.txt files containing default environment.
+
+do_compile_append() {
+
+ if [ -n "${UBOOT_CONFIG}" ]; then
+ unset i j k
+ for config in ${UBOOT_MACHINE}; do
+ i=$(expr $i + 1);
+ for type in ${UBOOT_CONFIG}; do
+ j=$(expr $j + 1);
+ if [ $j -eq $i ]; then
+ cp ${B}/${config}/common/env_common.o ${TMPDIR}/uboot.env-${config}
+ ${OBJCOPY} -O binary -j ".rodata.default_environment" ${TMPDIR}/uboot.env-${config}
+ tr '\0' '\n' < ${TMPDIR}/uboot.env-${config} | sed -e '/^$/d' > ${B}/${config}/uEnv-${type}.txt
+ rm ${TMPDIR}/uboot.env-${config}
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ cp ${B}/common/env_common.o ${TMPDIR}/uboot.env
+ ${OBJCOPY} -O binary -j ".rodata.default_environment" ${TMPDIR}/uboot.env
+ tr '\0' '\n' < ${TMPDIR}/uboot.env | sed -e '/^$/d' > ${B}/uEnv.txt
+ rm ${TMPDIR}/uboot.env
+ fi
+}
+
+
+do_install_append() {
+ if [ -n "${UBOOT_CONFIG}" ]; then
+ for config in ${UBOOT_MACHINE}; do
+ i=$(expr $i + 1);
+ for type in ${UBOOT_CONFIG}; do
+ j=$(expr $j + 1);
+ if [ $j -eq $i ]; then
+ install -d ${D}/boot
+ install -m 644 ${B}/${config}/uEnv-${type}.txt ${D}/boot/uEnv-${type}-${PV}-${PR}.txt
+ ln -sf uEnv-${type}-${PV}-${PR}.txt ${D}/boot/uEnv-${type}.txt
+ ln -sf uEnv-${type}-${PV}-${PR}.txt ${D}/boot/uEnv.txt
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install -d ${D}/boot
+ install -m 644 ${B}/uEnv.txt ${D}/boot/uEnv-${MACHINE}-${PV}-${PR}.txt
+ ln -sf uEnv-${MACHINE}-${PV}-${PR}.txt ${D}/boot/uEnv.txt
+ fi
+}
+
+do_deploy_append() {
+ if [ -n "${UBOOT_CONFIG}" ]; then
+ for config in ${UBOOT_MACHINE}; do
+ i=$(expr $i + 1);
+ for type in ${UBOOT_CONFIG}; do
+ j=$(expr $j + 1);
+ if [ $j -eq $i ]; then
+ install -d ${DEPLOYDIR}
+ install -m 644 ${B}/${config}/uEnv-${type}.txt ${DEPLOYDIR}/uEnv-${type}-${PV}-${PR}.txt
+ ln -sf uEnv-${type}-${PV}-${PR}.txt ${DEPLOYDIR}/uEnv-${type}.txt
+ ln -sf uEnv-${type}-${PV}-${PR}.txt ${DEPLOYDIR}/uEnv.txt
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install -d ${DEPLOYDIR}
+ install -m 644 ${B}/uEnv.txt ${DEPLOYDIR}/uEnv-${MACHINE}-${PV}-${PR}.txt
+ ln -sf uEnv-${MACHINE}-${PV}-${PR}.txt ${DEPLOYDIR}/uEnv.txt
+ fi
+}