Error when integrating u-boot patch 0003-Integration-of-Mender-boot-code-into-U-Boot

Hi all,
i have an existing yocto project (zeus) and i want to add mender to it.
Im using a fork of u-boot, so i am following the manual u-boot integration page: Manual U-Boot integration | Mender documentation

When i get to the part where i need to extract the patch:
bitbake -c save_mender_auto_configured_patch u-boot

I get the following Error:

ERROR: u-boot-secc-secc-1.0-r0 do_patch: Command Error: ‘quilt --quiltrc /home/seccdev/secc-yocto/build/tmp/work/secc_secc-poky-linux-gnueabi/u-boot-secc-secc/1.0-r0/recipe-sysroot-native/etc/quiltrc push’ exited with 0 Output:
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 2 (offset 1 line).
Hunk #2 FAILED at 23.
1 out of 2 hunks FAILED – rejects in file include/env_default.h
patching file scripts/Makefile.autoconf
Hunk #1 succeeded at 111 (offset 2 lines).
Patch 0003-Integration-of-Mender-boot-code-into-U-Boot.patch does not apply (enforce with -f)
ERROR: Logfile of failure stored in: /home/seccdev/secc-yocto/build/tmp/work/secc_secc-poky-linux-gnueabi/u-boot-secc-secc/1.0-r0/temp/log.do_patch.6410
ERROR: Task (/home/seccdev/secc-yocto/sources/meta-secc-secc/recipes-bsp/u-boot/ failed with exit code ‘1’

I looked at patch 0003-Integration-of-Mender-boot-code-into-U-Boot, and it looks like that one line does not match with the env_default.h file that it is attempting to patch:
Relevant extract from patch file:

@@ -21,6 +23,7 @@ static char default_environment[] = {
 const uchar default_environment[] = {
 #ifndef CONFIG_USE_DEFAULT_ENV_FILE        <<<---- This line does not exist in header file

Does anyone know how to solve this?

Hi @KolyaHD,

You probably will need a customized version of that patch that works for your particular U-Boot version. This is not an uncommon change. You can see how it is handled for the Toradex platforms here.

Generally, when I need to make those kinds of changes, I use git am to attempt to apply the patch. This will fail but set up the commit log and such. Then you can use patch directly against the 0003-Integration-of-Mender-boot-code-into-U-Boot.patch file. Then you can find the *.rej files which are the portions of the patch that do not cleanly apply. You’ll need to figure out an equivalent change for each of these. Then remove all the *.orig and *.rej files, run git add -A and git am --continue.


1 Like