Hi everyone.
I am trying to integrate Mender into a working Yocto image for the Karo TXUL-8013 board. I used this documentation to try and integrate it with U-Boot. After doing so, I received an error very similar to one listed in the troubleshooting section of the documentation. Here is the full message:
WARNING: u-boot-karo-git-r0 do_patch: Fuzz detected:
Applying patch 0001-Add-missing-header-which-fails-on-recent-GCC.patch
patching file tools/env/fw_env.c
Hunk #1 succeeded at 16 with fuzz 1 (offset -4 lines).
Applying patch 0003-Integration-of-Mender-boot-code-into-U-Boot.patch
patching file include/env_default.h
Hunk #1 succeeded at 10 with fuzz 1.
patching file scripts/Makefile.autoconf
Hunk #1 succeeded at 95 with fuzz 1.
Applying patch 0004-Disable-CONFIG_BOOTCOMMAND-and-enable-CONFIG_MENDER_.patch
patching file include/env_default.h
Hunk #1 succeeded at 34 with fuzz 1.
The context lines in the patches can be updated with devtool:
devtool modify u-boot-karo
devtool finish --force-patch-refresh u-boot-karo <layer_path>
Don't forget to review changes done by devtool!
WARNING: u-boot-karo-git-r0 do_patch: QA Issue: Patch log indicates that patches do not apply cleanly. [patch-fuzz]
WARNING: u-boot-karo-git-r0 do_provide_mender_defines: Found more than one dtb specified in KERNEL_DEVICETREE ( imx6ull-txul-8013.dtb imx6ull-txul-8013-mb7.dtb imx6ull-txul-8013-mainboard.dtb ). Only one should be specified. Choosing the last one: imx6ull-txul-8013-mainboard.dtb. Set KERNEL_DEVICETREE to the desired dtb file to silence this warning.
WARNING: u-boot-karo-git-r0 do_mender_uboot_auto_configure: Found more than one machine specified in UBOOT_MACHINE. Only one should be specified. Choosing the last one.
ERROR: u-boot-karo-git-r0 do_mender_uboot_auto_configure: Execution of '/home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0/temp/run.do_mender_uboot_auto_configure.16041' failed with exit code 1:
If at any point you get an unexpanded variable, there is probably an argument
you haven't given.
+ SUB_X=-x
+ set -u
+ rm -rf /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0/tmp-src
++ dirname /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0/tmp-src
+ mkdir -p /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0
+ cp -r /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0/git /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0/tmp-src
+ cd /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0/tmp-src
+ make 'HOSTCC=gcc -DMENDER_AUTO_PROBING' 'CC=arm-poky-linux-gnueabi-gcc -DMENDER_AUTO_PROBING' tx6ul-8013_config
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
+ grep -q '^tools-all: *env\b' Makefile
+ ENV_TARGET=env
+ grep -q '^tools-all: *envtools\b' Makefile
+ '[' -z env ']'
+ bash -x /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0/uboot_auto_patch.sh --patch-config-file
+ UBI=0
+++ dirname /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0/uboot_auto_patch.sh
++ readlink -f /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0
+ SCRIPT_DIR=/home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0
+ '[' -z --patch-config-file ']'
+ '[' --patch-config-file = -h ']'
+ '[' --patch-config-file = --help ']'
+ set -e
+ '[' --patch-config-file = --patch-config-file ']'
+ '[' 1 -gt 1 ']'
+ sed -i -e 's/^[ \t]*#[ \t]*define[ \t]*CONFIG_FILE\b.*/#define CONFIG_FILE "fw_env.config"/' tools/env/fw_env.h
+ exit 0
+ make 'HOSTCC=gcc -DMENDER_AUTO_PROBING' 'CC=gcc -DMENDER_AUTO_PROBING' env
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
UPD include/config.h
GEN include/autoconf.mk
GEN include/autoconf.mk.dep
HOSTCC tools/env/fw_env.o
HOSTCC tools/env/fw_env_main.o
HOSTCC tools/env/crc32.o
HOSTCC tools/env/ctype.o
HOSTCC tools/env/linux_string.o
HOSTCC tools/env/env_attr.o
HOSTCC tools/env/env_flags.o
HOSTCC tools/env/aes.o
HOSTLD tools/env/fw_printenv
STRIP tools/env/fw_printenv
arm-poky-linux-gnueabi-strip:tools/env/fw_printenv: file format not recognized
++ printf %d 0x20000
+ dd if=/dev/zero of=fake-env.txt count=1 bs=131072
1+0 records in
1+0 records out
131072 bytes (131 kB, 128 KiB) copied, 0.000281971 s, 465 MB/s
+ cat
+ mkdir -p fw_printenv.lock
+ ret=0
+ tools/env/fw_printenv -l fw_printenv.lock
tools/env/fw_printenv: invalid option -- 'l'
Try `fw_printenv --help' for more information.
+ ret=1
+ rm -rf fw_printenv.lock
+ '[' 1 -ne 0 ']'
+ '[' 1 -eq 134 -o 1 -eq 139 ']'
+ exit 1
WARNING: exit code 1 from a shell command.
ERROR: Logfile of failure stored in: /home/safian99ali/karo-bsp/build-txul-8013/tmp/work/txul_8013-poky-linux-gnueabi/u-boot-karo/git-r0/temp/log.do_mender_uboot_auto_configure.16041
I followed the suggested fix here, but bitbake returned the same error. I used the u-boot-fw-utils file in the poky directory, and made some minor changes. This is the content of the ‘u-boot-fw-utils-karo_git.bb’ file:
require recipes-bsp/u-boot/u-boot-fw-utils-mender.inc
SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
DEPENDS += "mtd-utils"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=30503fd321432fc713238f582193b78e"
SRCREV = "e5aee22e4be75e75a854ab64503fc80598bc2004"
SRC_URI = "git://git.denx.de/u-boot.git"
S = "${WORKDIR}/git"
INSANE_SKIP_${PN} = "already-stripped"
EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" V=1'
EXTRA_OEMAKE_class-cross = 'HOSTCC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
inherit uboot-config
do_compile () {
oe_runmake ${UBOOT_MACHINE}
oe_runmake env
}
do_install () {
install -d ${D}${base_sbindir}
install -d ${D}${sysconfdir}
install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
install -m 0644 ${S}/tools/env/fw_env.config ${D}${sysconfdir}/fw_env.config
}
do_install_class-cross () {
install -d ${D}${bindir_cross}
install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_printenv
install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_setenv
}
SYSROOT_DIRS_append_class-cross = " ${bindir_cross}"
PACKAGE_ARCH = "${MACHINE_ARCH}"
BBCLASSEXTEND = "cross"
PROVIDES_${PN} = "u-boot-fw-utils"
RPROVIDES_${PN} = "u-boot-fw-utils"
This is the content of ‘u-boot-karo_git.bb’:
require recipes-bsp/u-boot/u-boot.inc
require recipes-bsp/u-boot/u-boot-mender.inc
DESCRIPTION = "U-Boot for Ka-Ro electronics TX Computer-On-Modules."
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM_mx6 = "file://Licenses/README;md5=0507cd7da8e7ad6d6701926ec9b84c95"
LIC_FILES_CHKSUM_stm32mp1 = "file://Licenses/README;md5=30503fd321432fc713238f582193b78e"
PROVIDES += "u-boot"
RPROVIDES_${PN} += "u-boot"
DEPENDS_append = " bc-native"
DEPENDS_append_stm32mp1 = " bison-native"
SRCBRANCH_mx6 = "master"
SRC_URI_mx6 = "git://github.com/karo-electronics/karo-tx-uboot.git;protocol=https;branch=${SRCBRANCH}"
SRCREV_mx6 = "6d7e3f066d2b977b02f6a471e749030d62ae5bde"
SRCBRANCH_stm32mp1 = "master"
SRC_URI_stm32mp1 = "git://git.denx.de/u-boot.git;protocol=git;branch=${SRCBRANCH}"
SRCREV_stm32mp1 = "e0718b3ab754860bd47677e6b4fc5b70da42c4ab"
S = "${WORKDIR}/git"
# append git hash to u-boot name
SCMVERSION ??= "y"
LOCALVERSION ??= "+karo"
UBOOT_LOCALVERSION = "${LOCALVERSION}"
do_compile_prepend() {
if [ "${SCMVERSION}" = "y" ]; then
# Add GIT revision to the local version
head=`cd ${S} ; git rev-parse --verify --short HEAD 2> /dev/null`
printf "%s%s%s" "${UBOOT_LOCALVERSION}" +g $head > ${S}/.scmversion
printf "%s%s%s" "${UBOOT_LOCALVERSION}" +g $head > ${B}/.scmversion
else
printf "%s" "${UBOOT_LOCALVERSION}" > ${S}/.scmversion
printf "%s" "${UBOOT_LOCALVERSION}" > ${B}/.scmversion
fi
}
# -----------------------------------------------------------------------------
# Append deploy to handle specific device tree binary deployement
#
do_deploy_append_stm32mp1 () {
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
install -m 644 ${B}/${config}/u-boot-${type}.bin ${DEPLOYDIR}
# As soon as SPL binary exists, install it
# This allow to mix u-boot configuration, with and without SPL
if [ -f ${B}/${config}/u-boot-spl.stm32 ]; then
install -m 644 ${B}/${config}/u-boot-spl.stm32 ${DEPLOYDIR}
fi
fi
done
unset j
done
unset i
else
bbfatal "Wrong u-boot-stm32mp configuration: please make sure to use UBOOT_CONFIG through BOOTSCHEME_LABELS config"
fi
}
# ---------------------------------------------------------------------
# Avoid QA Issue: No GNU_HASH in the elf binary
INSANE_SKIP_${PN} += "ldflags"
# ---------------------------------------------------------------------
# Avoid QA Issue: ELF binary has relocations in .text
# (uboot no need -fPIC option : remove check)
INSANE_SKIP_${PN} += "textrel"
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE_tx6 = "(tx6[qsu]-.*)"
COMPATIBLE_MACHINE_txul = "(txul-.*)"
COMPATIBLE_MACHINE_stm32mp1 = "(txmp-.*|qsmp-.*)"
UBOOT_NAME = "u-boot-${MACHINE}.bin"
I also added the following lines to the local.conf:
PREFERRED_PROVIDER_u-boot-fw-utils = "u-boot-fw-utils-karo"
PREFERRED_RPROVIDER_u-boot-fw-utils = "u-boot-fw-utils-karo"
I think the problem lies in the u-boot-fw-utils-karo_git.bb file. As you can see from the error message, there appears to be a problem with one of the Mender U-Boot patches. I had to make some minor changes to the patch because the U-Boot fork was slightly different than what the patch expected. I don’t think this is what is causing the error above, but I have posted the modified patch below in case it’s relevant:
From f8cc3e077230572b4a0b557435833d24b89933f5 Mon Sep 17 00:00:00 2001
From: Marcin Pasinski <marcin.pasinski@northern.tech>
Date: Wed, 31 Jan 2018 18:10:04 +0100
Subject: [PATCH 3/4] Integration of Mender boot code into U-Boot.
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
Signed-off-by: Marcin Pasinski <marcin.pasinski@northern.tech>
---
include/env_default.h | 3 +++
scripts/Makefile.autoconf | 3 ++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/env_default.h b/include/env_default.h
index 56a8bae39a..472e2fda9a 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -10,6 +10,8 @@
#include <env_callback.h>
+#include <env_mender.h>
+
#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
env_t environment __PPCENV__ = {
ENV_CRC, /* CRC Sum */
@@ -22,6 +24,7 @@ static char default_environment[] = {
#else
const uchar default_environment[] = {
#endif
+ MENDER_ENV_SETTINGS
#ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT
ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0"
#endif
diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf
index 00b8fb34aa..e312c8037d 100644
--- a/scripts/Makefile.autoconf
+++ b/scripts/Makefile.autoconf
@@ -95,7 +95,8 @@ define filechk_config_h
echo \#include \<config_uncmd_spl.h\>; \
echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>; \
echo \#include \<asm/config.h\>; \
- echo \#include \<config_fallbacks.h\>;)
+ echo \#include \<config_fallbacks.h\>; \
+ echo \#include \<config_mender.h\>;)
endef
include/config.h: scripts/Makefile.autoconf create_symlink FORCE
--
2.17.1
Here is the BSP that makes up my image if that helps. I’d appreciate any help