How to set CONFIG_EXTRA_ENV_SETTINGS kernel_addr_r=0x80800000 without to modify uboot_auto_patch.sh?

1,813 views
Skip to first unread message

Ks89

unread,
May 29, 2018, 5:29:39 PM5/29/18
to Mender List mender.io
Hi,
to support my hardware, a colleague changed uboot_auto_patch.sh. I know that this is not a best practice, so I'm here to ask how to do this change without to touch that file.

This is my diff of uboot_auto_patch (red = removed and green = added):

diff --git a/meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_patch.sh b/meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_patch.sh
index 7409e47..6603789 100755
--- a/meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_patch.sh
+++ b/meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_patch.sh
@@ -279,34 +279,7 @@ patch_all_candidates() {
             "fdt_addr_r"
     fi
 
-    # Find load address for kernel and make sure it's in kernel_addr_r.
-    if kernel_addr="$(extract_kernel_addr)"; then
-        if [ "$kernel_addr" != "kernel_addr_r" ]; then
-            remove_bootvar \
-                "kernel_addr_r"
-        fi
-        rename_bootvar \
-            "$kernel_addr" \
-            "kernel_addr_r"
-    else
-        # Alright, no dedicated address. Let's try the second best, find it by
-        # looking at existing boot commands.
-        addr=$(sed -nre '/boot[miz] *(0x[0-9a-fA-F]+)/ {s/.*boot[miz] *(0x[0-9a-fA-F]+).*/\1/; p}' "$COMPILED_ENV" | head -n1)
-
-        # Using the :- syntax is because "set -u" is in effect.
-        if [ -n "${addr:-}" ]; then
-            if definition_exists "CONFIG_EXTRA_ENV_SETTINGS"; then
-                append_to_definition "CONFIG_EXTRA_ENV_SETTINGS" "\"kernel_addr_r=$addr\\\\0\""
-            else
-                add_definition "CONFIG_EXTRA_ENV_SETTINGS" "\"kernel_addr_r=$addr\\\\0\""
-            fi
-        else
-            echo "Could not find kernel load address!" 1>&2
-            echo "This is the obtained environment:"
-            cat "$COMPILED_ENV"
-            # Continue without, some boot commands don't use addresses at all.
-        fi
-    fi
+    append_to_definition "CONFIG_EXTRA_ENV_SETTINGS" "\"kernel_addr_r=0x80800000\\\\0\""
 }

With the changes above mender is working perfectly, but I don't like this solution.

Thank u.
 

Kristian Amlie

unread,
May 30, 2018, 2:26:14 AM5/30/18
to men...@lists.mender.io, Ks89

All this section does is look for an already existing kernel_addr_r address, so you should be able to patch it into CONFIG_EXTRA_ENV_SETTINGS using a regular patch in SRC_URI, and then uboot_auto_patch.sh will pick it up once it runs.

An alternative is save the auto configured patch using the save_mender_auto_configured_patch bitbake task, and then modify it according to needs and turn off autopatching.

--
Kristian
signature.asc

Ks89

unread,
May 31, 2018, 2:30:24 AM5/31/18
to Mender List mender.io
Thank you I'll try it

Ks89

unread,
Jun 5, 2018, 3:17:14 PM6/5/18
to Mender List mender.io
I tried but without success.

I'm able to boot my sd and mender is working. But when I try to release an update, I'm not able to reboot again.
With " append_to_definition "CONFIG_EXTRA_ENV_SETTINGS" "\"kernel_addr_r=0x80800000\\\\0\""" inside the mender patch it works very well, but not with my solution based on your suggestion.

In my custom meta layer I have a structure like this one:
meta-layer
  |---recipes-bsp
         |---------------u-boot
             |----------------------u-boot-myplatform_2017.03.bbappend
             |----------------------u-boot-myplatform
                                                  |------------------------ my-patch.patch


u-boot-myplatform.bbappend contains something like this:

SRC_URI += "
            file://my-patch.patch \
            "


and my patch file is:
---
 include/configs/myplatform.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/myplatform.h b/include/configs/myplatform.h
index b485470..a4c994d 100644
--- a/include/configs/myplatform.h
+++ b/include/configs/myplatform.h
@@ -74,6 +74,10 @@
 #define MFG_NAND_PARTITION ""
 #endif
 
+
+#define ENV_MEM_LAYOUT_SETTINGS \
+ "kernel_addr_r=0x80800000\0" \
+
 #define CONFIG_MFG_ENV_SETTINGS \
  "mfgtool_args=setenv bootargs console=${console},${baudrate} " \
      BOOTARGS_CMA_SIZE \
@@ -96,6 +100,7 @@
  "fdt_addr=0x83000000\0" \
  "fdt_high=0xffffffff\0"   \
  "console=ttymxc0\0" \
+ ENV_MEM_LAYOUT_SETTINGS \
  "bootargs=console=ttymxc0,115200 ubi.mtd=4 "  \
  "root=ubi0:rootfs rootfstype=ubifs "      \
  BOOTARGS_CMA_SIZE \
@@ -117,6 +122,7 @@
  "boot_fdt=try\0" \
  "ip_dyn=yes\0" \
  "panel=TFT43AB\0" \
+ ENV_MEM_LAYOUT_SETTINGS \
  "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
  "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
  "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
-- 
2.7.4


probably ENV_MEM_LAYOUT_SETTINGS is useless and I can put kernel_addr directly, but I copied from another .h file :)

So my  patched .h contains this:

          ....
#define ENV_MEM_LAYOUT_SETTINGS \
"kernel_addr_r=0x80800000\0" \

#if defined(CONFIG_NAND_BOOT)
#define CONFIG_EXTRA_ENV_SETTINGS \
CONFIG_MFG_ENV_SETTINGS \
"panel=TFT43AB\0" \
"fdt_addr=0x83000000\0" \
"fdt_high=0xffffffff\0"   \
"console=ttymxc0\0" \
ENV_MEM_LAYOUT_SETTINGS \
"bootargs=console=ttymxc0,115200 ubi.mtd=4 "  \
"root=ubi0:rootfs rootfstype=ubifs "      \
BOOTARGS_CMA_SIZE \
"mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),1m(misc),-(rootfs)\0"\
"bootcmd=nand read ${loadaddr} 0x4000000 0x800000;"\
"nand read ${fdt_addr} 0x5000000 0x100000;"\
"bootz ${loadaddr} - ${fdt_addr}\0"

#else
#define CONFIG_EXTRA_ENV_SETTINGS \
CONFIG_MFG_ENV_SETTINGS \
"script=boot.scr\0" \
"image=zImage\0" \
"console=ttymxc0\0" \
"fdt_high=0xffffffff\0" \
"initrd_high=0xffffffff\0" \
"fdt_file=undefined\0" \
"fdt_addr=0x83000000\0" \
"boot_fdt=try\0" \
"ip_dyn=yes\0" \
"panel=TFT43AB\0" \
ENV_MEM_LAYOUT_SETTINGS \
"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
"mmcautodetect=yes\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
BOOTARGS_CMA_SIZE \
"root=${mmcroot}\0" \
"loadbootscript=" \
"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
"bootscript=echo Running bootscript from mmc ...; " \
"source\0" \
"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
"mmcboot=echo Booting from mmc ...; " \
"run mmcargs; " \
"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
"if run loadfdt; then " \
"bootz ${loadaddr} - ${fdt_addr}; " \
"else " \
"if test ${boot_fdt} = try; then " \
"bootz; " \
"else " \
"echo WARN: Cannot load the DT; " \
"fi; " \
"fi; " \
"else " \
"bootz; " \
"fi;\0" \
"netargs=setenv bootargs console=${console},${baudrate} " \
BOOTARGS_CMA_SIZE \
"root=/dev/nfs " \
"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
"netboot=echo Booting from net ...; " \
"run netargs; " \
"if test ${ip_dyn} = yes; then " \
"setenv get_cmd dhcp; " \
"else " \
"setenv get_cmd tftp; " \
"fi; " \
"${get_cmd} ${image}; " \
"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
"bootz ${loadaddr} - ${fdt_addr}; " \
"else " \
"if test ${boot_fdt} = try; then " \
"bootz; " \
"else " \
"echo WARN: Cannot load the DT; " \
"fi; " \
"fi; " \
"else " \
"bootz; " \
"fi;\0" \
"findfdt="\
"if test $fdt_file = undefined; then " \
"if test $board_name = EVK && test $board_rev = 9X9; then " \
"setenv fdt_file imx6ull-9x9-evk.dtb; fi; " \
"if test $board_name = EVK && test $board_rev = 14X14; then " \
"setenv fdt_file imx6ull-14x14-evk.dtb; fi; " \
"if test $fdt_file = undefined; then " \
"echo WARNING: Could not determine dtb to use; fi; " \
"fi;\0" \
                              ....


Searching with "grep -r "0x80800000" ." inside my /build/temp folder after a full build I found this file (the address seems correct) tmp-src/u-boot.cfg with this line "#define CONFIG_LOADADDR 0x80800000"

also, in "tmp-src/compiled-environment.txt": 
...
loadaddr=0x80800000
...
kernel_addr_r=0x80800000
...

Probably I'm doing something wrong. I'm not an expert in embedded linux.

How can I check the kernel_addr on a running device to be able to know if the build is ok before to deploy a new update?

Thank u.

Mirza Krak

unread,
Jun 5, 2018, 3:30:43 PM6/5/18
to mender
On 5 June 2018 at 21:17, Ks89 <stefano.c...@gmail.com> wrote:
> I tried but without success.
>

< snip >

>
> Probably I'm doing something wrong. I'm not an expert in embedded linux.
>
> How can I check the kernel_addr on a running device to be able to know if
> the build is ok before to deploy a new update?

You can halt U-boot and run:

printenv kernel_addr_r

--
Med Vänliga Hälsningar / Best Regards

Mirza Krak

Kristian Amlie

unread,
Jun 6, 2018, 1:50:45 AM6/6/18
to men...@lists.mender.io, Ks89
Replies below.

On 05/06/18 21:17, Ks89 wrote:
> I tried but without success.
>
> I'm able to boot my sd and mender is working. But when I try to release
> an update, I'm not able to reboot again.

So you are able to boot the first time? Then the kernel_addr_r has to be
correct somehow, because you would not be able to boot at all without it.

Perhaps u-boot and u-boot-fw-utils are out of sync, which is a common
problem. What is PREFERRED_PROVIDER_u-boot-fw-utils set to? It should be
set to "u-boot-fw-utils-mender-auto-provided". You can check it with:

bitbake -e core-image-minimal | \
grep ^PREFERRED_PROVIDER_u-boot-fw-utils=
> *#define ENV_MEM_LAYOUT_SETTINGS \*
> *"kernel_addr_r=0x80800000\0" \*
>
> #if defined(CONFIG_NAND_BOOT)
> #define CONFIG_EXTRA_ENV_SETTINGS \
> CONFIG_MFG_ENV_SETTINGS \
> "panel=TFT43AB\0" \
> "fdt_addr=0x83000000\0" \
> "fdt_high=0xffffffff\0"  \
> "console=ttymxc0\0" \
> *ENV_MEM_LAYOUT_SETTINGS \*
> "bootargs=console=ttymxc0,115200 ubi.mtd=4 "  \
> "root=ubi0:rootfs rootfstype=ubifs "     \
> BOOTARGS_CMA_SIZE \
> "mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),1m(misc),-(rootfs)\0"\
> "bootcmd=nand read ${loadaddr} 0x4000000 0x800000;"\
> "nand read ${fdt_addr} 0x5000000 0x100000;"\
> "bootz ${loadaddr} - ${fdt_addr}\0"
>
> #else
> #define CONFIG_EXTRA_ENV_SETTINGS \
> CONFIG_MFG_ENV_SETTINGS \
> "script=boot.scr\0" \
> "image=zImage\0" \
> "console=ttymxc0\0" \
> "fdt_high=0xffffffff\0" \
> "initrd_high=0xffffffff\0" \
> "fdt_file=undefined\0" \
> "fdt_addr=0x83000000\0" \
> "boot_fdt=try\0" \
> "ip_dyn=yes\0" \
> "panel=TFT43AB\0" \
> *ENV_MEM_LAYOUT_SETTINGS \*
> *tmp-src/u-boot.cfg* with this line "#define CONFIG_LOADADDR 0x80800000"
>
> also, in "*tmp-src/compiled-environment.txt*": 
> ...
> loadaddr=0x80800000
> ...
> kernel_addr_r=0x80800000
> ...
>
> Probably I'm doing something wrong. I'm not an expert in embedded linux.

From what I can see it looks like you did the procedure correctly.

> *How can I check the kernel_addr on a running device to be able to know
> if the build is ok before to deploy a new update?*

If it boots, then the address is ok, for sure. I cannot see anything
obviously wrong.

Have you gone through the integration checklist? [1] It basically goes
through all the steps that Mender needs, but in a manual fashion. It
might be easier to pinpoint the exact error.

[1]
https://docs.mender.io/1.5/devices/integrating-with-u-boot/integration-checklist

--
Kristian

signature.asc

Ks89

unread,
Jun 8, 2018, 4:17:27 PM6/8/18
to Mender List mender.io, stefano.c...@gmail.com
Hi, I'm sorry for the delay but I wanted to re-build everything from scratch without cache with the modified mender patch and with the CONFIG_EXTRA_ENV_SETTINGS.
I'm not completed the mender integration checklist for both scenarios, but I'll do it if necessary.
These are the results.

1) with mender patch modified manually as shown above everything works and I'm able to update
2) with CONFIG_EXTRA_ENV_SETTINGS I can boot the initial sdimg, but after the update I cannot re-boot again

These are some logs:

Scenario 1 (with modified mender patch):

root@myPlatform:~# fw_setenv
## Error: variable name missing
root@myPlatform:~# fw_printenv
Warning: Bad CRC, using default environment
altbootcmd=run mender_altbootcmd; run bootcmd
bootlimit=1
bootcount=0
upgrade_available=0
mender_mtd_ubi_dev_name=
mender_boot_part=2
mender_uboot_boot=mmc 1:1
mender_uboot_if=mmc
mender_uboot_dev=1
mender_boot_kernel_type=bootz
mender_kernel_name=zImage
mender_dtb_name=imx6ull-14x14-evk.dtb
mender_setup=setenv mender_kernel_root /dev/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; else setenv mender_boot_part 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover
bootdelay=3
baudrate=115200
loadaddr=0x82000000
script=boot.scr
image=zImage
console=ttymxc0
fdt_high=0xffffffff
initrd_high=0xffffffff
fdt_file=imx6ull-14x14-evk.dtb
fdt_addr_r=0x83000000
boot_fdt=try
ip_dyn=yes
videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
mmcautodetect=yes
mmcargs=setenv bootargs console=${console},${baudrate}
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
bootscript=echo Running bootscript from mmc ...; source
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
netargs=setenv bootargs console=${console},${baudrate} ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
kernel_addr_r=0x80800000

Scenario 2 (with CONFIG_EXTRA_ENV_SETTINGS):

a) booting sdimg without updates with mender:
root@ myPlatform:~# fw_printenv
Warning: Bad CRC, using default environment
altbootcmd=run mender_altbootcmd; run bootcmd
bootlimit=1
bootcount=0
upgrade_available=0
mender_mtd_ubi_dev_name=
mender_boot_part=2
mender_uboot_boot=mmc 1:1
mender_uboot_if=mmc
mender_uboot_dev=1
mender_boot_kernel_type=bootz
mender_kernel_name=zImage
mender_dtb_name=imx6ull-14x14-evk.dtb
mender_setup=setenv mender_kernel_root /dev/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; else setenv mender_boot_part 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover
bootdelay=3
baudrate=115200
loadaddr=0x82000000
script=boot.scr
image=zImage
console=ttymxc0
fdt_high=0xffffffff
initrd_high=0xffffffff
fdt_file=imx6ull-14x14-evk.dtb
fdt_addr_r=0x83000000
boot_fdt=try
ip_dyn=yes
videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
mmcautodetect=yes
mmcargs=setenv bootargs console=${console},${baudrate}
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
bootscript=echo Running bootscript from mmc ...; source
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
netargs=setenv bootargs console=${console},${baudrate} ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
kernel_addr_r=0x80800000
root@myPlatform:~# fw_setenv
## Error: variable name missing

b) after the mender update (blocked, so I get this data via serial debug port):

=> printenv
altbootcmd=run mender_altbootcmd; run bootcmd
baudrate=115200
board_name=EVK
board_rev=14X14
boot_fdt=try
bootargs=root=/dev/mmcblk1p2
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover
bootcount=1
bootdelay=3
bootlimit=1
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
fdt_addr_r=0x83000000
fdt_file=imx6ull-14x14-evk.dtb
fdt_high=0xffffffff
fdtcontroladdr=9ef230f8
fileaddr=83000000
filesize=89d1
image=zImage
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x82000000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; else setenv mender_boot_part 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_boot_part_hex=3
mender_boot_part_name=/dev/mmcblk1p2
mender_dtb_name=imx6ull-14x14-evk.dtb
mender_kernel_name=zImage
mender_kernel_root=/dev/mmcblk1p2
mender_kernel_root_name=/dev/mmcblk1p2
mender_setup=setenv mender_kernel_root /dev/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 1:1
mender_uboot_dev=1
mender_uboot_if=mmc
mender_uboot_root=mmc 1:2
mender_uboot_root_name=/dev/mmcblk1p2
mmcargs=setenv bootargs console=${console},${baudrate} 
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
script=boot.scr
upgrade_available=0
videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0

Environment size: 3208/131067 bytes
=> 
altbootcmd=run mender_altbootcmd; run bootcmd
baudrate=115200
board_name=EVK
board_rev=14X14
boot_fdt=try
bootargs=root=/dev/mmcblk1p2
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover
bootcount=1
bootdelay=3
bootlimit=1
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
fdt_addr_r=0x83000000
fdt_file=imx6ull-14x14-evk.dtb
fdt_high=0xffffffff
fdtcontroladdr=9ef230f8
fileaddr=83000000
filesize=89d1
image=zImage
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x82000000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; else setenv mender_boot_part 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_boot_part_hex=3
mender_boot_part_name=/dev/mmcblk1p2
mender_dtb_name=imx6ull-14x14-evk.dtb
mender_kernel_name=zImage
mender_kernel_root=/dev/mmcblk1p2
mender_kernel_root_name=/dev/mmcblk1p2
mender_setup=setenv mender_kernel_root /dev/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 1:1
mender_uboot_dev=1
mender_uboot_if=mmc
mender_uboot_root=mmc 1:2
mender_uboot_root_name=/dev/mmcblk1p2
mmcargs=setenv bootargs console=${console},${baudrate} 
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
script=boot.scr
upgrade_available=0
videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0

Environment size: 3208/131067 bytes



I don't know if these logs are enough.

thank u.


Ks89

unread,
Jun 8, 2018, 4:20:31 PM6/8/18
to Mender List mender.io, stefano.c...@gmail.com
I forgot to say that I used mender 1.4.0 with rocko to do this tests.

Kristian Amlie

unread,
Jun 11, 2018, 3:51:57 AM6/11/18
to men...@lists.mender.io, Ks89
kernel_addr_r appears to be missing from the variable list in the last
two of the environment dumps below. This is almost certainly the reason
why you cannot boot. The reason why is mysterious though. I see no
reason why it should disappear, especially since the rest of the
variables seem to be preserved.

How are you doing the updates? Via the standalone "-rootfs" argument or
via the web frontend? It might be worth trying the "-rootfs" argument,
since this won't reboot immediately, and then do a fw_printenv between
every step, to look for differences.

--
Kristian

On 08/06/18 22:20, Ks89 wrote:
> I forgot to say that I used mender 1.4.0 with rocko to do this tests.
>
>
> Il giorno venerdì 8 giugno 2018 22:17:27 UTC+2, Ks89 ha scritto:
>
> Hi, I'm sorry for the delay but I wanted to re-build everything from
> scratch without cache with the modified mender patch and with
> the CONFIG_EXTRA_ENV_SETTINGS.
> I'm not completed the mender integration checklist for both
> scenarios, but I'll do it if necessary.
> These are the results.
>
> 1) with mender patch modified manually as shown above everything
> works and I'm able to update
> 2) with CONFIG_EXTRA_ENV_SETTINGS I can boot the initial sdimg, but
> after the update I cannot re-boot again
>
> These are some logs:
>
> *Scenario 1 (with modified mender patch):*
> *Scenario 2 (with CONFIG_EXTRA_ENV_SETTINGS):*
> *
> *
> *a) booting sdimg without updates with mender:*
> *
> *
> *b) after the mender update (blocked, so I get this data via serial
> debug port):*
> <https://docs.mender.io/1.5/devices/integrating-with-u-boot/integration-checklist>
>
>
> --
> Kristian
>
> --
> You received this message because you are subscribed to the Google
> Groups "Mender List mender.io" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to mender+un...@lists.mender.io
> <mailto:mender+un...@lists.mender.io>.
> To post to this group, send email to men...@lists.mender.io
> <mailto:men...@lists.mender.io>.
> Visit this group at
> https://groups.google.com/a/lists.mender.io/group/mender/.


signature.asc

Ks89

unread,
Jun 11, 2018, 12:21:13 PM6/11/18
to Mender List mender.io
I'm using the web interface via mender server.

I never tried the rootfs option. Where can I find the procedure to try?

Thanks

Mirza Krak

unread,
Jun 11, 2018, 3:03:37 PM6/11/18
to mender
On 11 June 2018 at 18:21, Ks89 <stefano.c...@gmail.com> wrote:
> I'm using the web interface via mender server.
>
> I never tried the rootfs option. Where can I find the procedure to try?

It is in the docs,
https://docs.mender.io/1.5/architecture/standalone-deployments

This requires console/ssh access on the device.

/ Mirza

Ks89

unread,
Jun 13, 2018, 11:29:16 AM6/13/18
to Mender List mender.io
I'm sorry, I made a mistake.
I tried again from scratch.

I re-flashed the sdcard with CONFIG_EXTRA_ENV_SETTINGS and this is the log:

root@myProject:~# fw_printenv

kernel_addr_r is missing also before the update.

I'm sorry the wrong log in previous comments.

So, It seems that CONFIG_EXTRA_ENV_SETTINGS is not working to set kernel_addr_r, but I don't understand why. 

Kristian Amlie

unread,
Jun 14, 2018, 4:07:50 AM6/14/18
to men...@lists.mender.io, Ks89
Perhaps you can try to leave uboot_auto_patch alone, and change the
value of loadaddr instead? It should pick up that instead.

--
Kristian

signature.asc

Shawn Stevenson

unread,
Jun 28, 2018, 6:54:59 PM6/28/18
to Mender List mender.io, stefano.c...@gmail.com
Hi everyone.

I had a similar problem myself when getting Mender to run on a custom board using the NXP imx6ull (using Mender release 1.5 and fsl-community-bsp Rocko branch). In my case, kernel_addr_r was not defined in uboot (prior to Mender patching) and there was some problem with uboot_auto_patch.sh adding it to the environment variables. Instead of modifying the script, I edited my include/configs/mx6ull_custom_board.h file to add the following line to the #define for CONFIG_EXTRA_ENV_SETTINGS:

"kernel_addr_r=0x80800000\0" \

I hope this helps anyone who runs into the same problem.

Thanks,
Shawn

Ks89

unread,
Jun 29, 2018, 12:21:36 PM6/29/18
to Mender List mender.io
Thank u. It's interesting.
I'll try next week.

Ks89

unread,
Jul 4, 2018, 4:11:00 AM7/4/18
to Mender List mender.io, stefano.c...@gmail.com
I tried again updating all layers and poky to the latest commits on rocko branches (also mender to 1.5.0) and setting "kernel_addr_r=0x80800000\0" \ in CONFIG_EXTRA_ENV_SETTINGS but it didn't work. 
I'm using NXP imx6ull evk, I don't know if also Shawn Stevenson is using the same board.
It happend the same problem. I'm not able to reboot after an update.

However, this time I tried to do the integration checklist and I'm stacked at step 10. At that step I'm not able to reboot Linux:

=> run bootcmd
35538 bytes read in 95 ms (365.2 KiB/s)
load - load binary file from a filesystem

Usage:
load <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
    - Load binary file 'filename' from partition 'part' on device
       type 'interface' instance 'dev' to address 'addr' in memory.
      'bytes' gives the size to load in bytes.
      If 'bytes' is 0 or omitted, the file is read until the end.
      'pos' gives the file byte position to start reading from.
      If 'pos' is 0 or omitted, the file is read from the start.
Bad Linux ARM zImage magic!

These are my steps:
1) fw_printenv
it prints all variables
2) fw_setenv
## Error: variable name missing
3) fw_setenv mender_linux_test 1 
Warning: Bad CRC, using default environment

It's not an error, but I tried to run "fw_setenv mender_linux_test 1" again to be sure and it returned simply a new line, without new warnings or errors.

4) reboot (and i blocked the booting process)
Normal Boot
Hit any key to stop autoboot:  3 ... 0 

5) printenv mender_linux_test
mender_linux_test=1

6) setenv mender_uboot_test 1
new empty line as response

7) saveenv
Saving Environment to MMC...
Writing to redundant MMC(1)... done

8) run bootcmd
35538 bytes read in 95 ms (365.2 KiB/s)
load - load binary file from a filesystem

Usage:
load <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
    - Load binary file 'filename' from partition 'part' on device
       type 'interface' instance 'dev' to address 'addr' in memory.
      'bytes' gives the size to load in bytes.
      If 'bytes' is 0 or omitted, the file is read until the end.
      'pos' gives the file byte position to start reading from.
      If 'pos' is 0 or omitted, the file is read from the start.
Bad Linux ARM zImage magic!


After this error, I cannot boot linux, also removing the power supply.


PS: im my local.conf I have these lines to configure mender:

... header with my info ....

MENDER_ARTIFACT_NAME = "1.0.0"

INHERIT += "mender-full"
MENDER_SERVER_URL = "https://my-server.com"

DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""

MENDER_BOOT_PART_SIZE_MB = "16"
IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = "2"
IMAGE_BOOTLOADER_FILE = "u-boot.imx"
MENDER_UBOOT_STORAGE_INTERFACE = "mmc"
MENDER_UBOOT_STORAGE_DEVICE = "1"
MENDER_STORAGE_DEVICE = "/dev/mmcblk1"

MENDER_STORAGE_TOTAL_SIZE_MB = "4096"
MENDER_DATA_PART_SIZE_MB = "64"

PACKAGE_EXCLUDE = "kernel-image-zimage-4.9.11-1.0.0+gc27010d"


Also, this is my .patch file used in a custom meta-layer 
---
 include/configs/mx6ullevk.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/mx6ullevk.h b/include/configs/mx6ullevk.h
index b485470..e12bc4f 100644
--- a/include/configs/mx6ullevk.h
+++ b/include/configs/mx6ullevk.h
@@ -92,6 +92,7 @@
 #if defined(CONFIG_NAND_BOOT)
 #define CONFIG_EXTRA_ENV_SETTINGS \
  CONFIG_MFG_ENV_SETTINGS \
+ "kernel_addr_r=0x80800000\0" \
  "panel=TFT43AB\0" \
  "fdt_addr=0x83000000\0" \
  "fdt_high=0xffffffff\0"   \
@@ -107,6 +108,7 @@
 #else
 #define CONFIG_EXTRA_ENV_SETTINGS \
  CONFIG_MFG_ENV_SETTINGS \
+        "kernel_addr_r=0x80800000\0" \
  "script=boot.scr\0" \
  "image=zImage\0" \
  "console=ttymxc0\0" \
-- 
2.7.4



When I'm not able to boot linux again (step 8 above) I can run printenv and the result is:

printenv
altbootcmd=run mender_altbootcmd; run bootcmd
baudrate=115200
board_name=EVK
board_rev=14X14
boot_fdt=try
bootargs=root=/dev/mmcblk1p2 root=/dev/mmcblk1p2
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover
bootcount=1
bootdelay=3
bootlimit=1
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
fdt_addr_r=0x83000000
fdt_file=imx6ull-14x14-evk.dtb
fdt_high=0xffffffff
fdtcontroladdr=9ef230f8
fileaddr=83000000
filesize=8ad2
image=zImage
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x82000000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; else setenv mender_boot_part 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_boot_part_name=/dev/mmcblk1p2
mender_dtb_name=imx6ull-14x14-evk.dtb
mender_kernel_name=zImage
mender_kernel_root=/dev/mmcblk1p2
mender_kernel_root_name=/dev/mmcblk1p2
mender_linux_test=1
mender_setup=setenv mender_kernel_root /dev/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 1:1
mender_uboot_dev=1
mender_uboot_if=mmc
mender_uboot_root=mmc 1:2
mender_uboot_root_name=/dev/mmcblk1p2
mender_uboot_test=1
mmcargs=setenv bootargs console=${console},${baudrate} 
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
script=boot.scr
upgrade_available=0
videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0

Environment size: 3247/131067 bytes
=> 
altbootcmd=run mender_altbootcmd; run bootcmd
baudrate=115200
board_name=EVK
board_rev=14X14
boot_fdt=try
bootargs=root=/dev/mmcblk1p2 root=/dev/mmcblk1p2
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover
bootcount=1
bootdelay=3
bootlimit=1
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
fdt_addr_r=0x83000000
fdt_file=imx6ull-14x14-evk.dtb
fdt_high=0xffffffff
fdtcontroladdr=9ef230f8
fileaddr=83000000
filesize=8ad2
image=zImage
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x82000000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; else setenv mender_boot_part 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_boot_part_name=/dev/mmcblk1p2
mender_dtb_name=imx6ull-14x14-evk.dtb
mender_kernel_name=zImage
mender_kernel_root=/dev/mmcblk1p2
mender_kernel_root_name=/dev/mmcblk1p2
mender_linux_test=1
mender_setup=setenv mender_kernel_root /dev/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 1:1
mender_uboot_dev=1
mender_uboot_if=mmc
mender_uboot_root=mmc 1:2
mender_uboot_root_name=/dev/mmcblk1p2
mender_uboot_test=1
mmcargs=setenv bootargs console=${console},${baudrate} 
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
script=boot.scr
upgrade_available=0
videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0

Environment size: 3247/131067 bytes


Do you have any suggestions?
I really don't know how to fix this.

Thank u.

Mirza Krak

unread,
Jul 4, 2018, 4:17:33 AM7/4/18
to men...@lists.mender.io, stefano.c...@gmail.com
Why do you exclude the kernel image? This actually required. It will try to load a zImage image file from /boot on the active root file-system. And this is probably what is failing for you, because it can not find the zImage in /boot. 

Can you run the following in U-boot:

    ls $mender_uboot_root /boot

/ Mirza

Shawn Stevenson

unread,
Jul 4, 2018, 12:07:08 PM7/4/18
to Mender List mender.io, stefano.c...@gmail.com, mirza...@northern.tech
I'm am not using the NXP imx6ull evk, but my code is mostly the same because I used the evk code as a template.

In your "printenv" listing, I don't see the kernel_addr_r variable. Are you certain that your patch is being applied?

The bad CRC warning means that the u-boot variables have not yet been saved to the SD card. When you save the mender_linux_test variable for the first time, the u-boot code will save all the defaults to the SD card, along with the mender_linux_test variable. There is probably a way to copy the initial values to SD and avoid that warning. My build produces a "uboot.env" file, so perhaps that has the initial values in it. Mirza, can you comment?

You should also verify that your kernel and dtb file are in the /boot folder of the partitions called "primary" and "secondary". Initially I had the kernel and dtb file in the boot partition and only the kernel file in the /boot folder. I added this line to my local.conf file and the dtb file ended up in the /boot folder:

MACHINE_ESSENTIAL_EXTRA_RDEPENDS = "kernel-image kernel-devicetree"

I have not been able to remove the unnecessary copies of the kernel and dtb file from the boot partition. Really, I shouldn't need the boot partition at all since the u-boot binary goes in mmcblk1boot0 on my system (I'm using eMMC) and the u-boot environment is in an empty space in front of the first partition.

-Shawn

Ks89

unread,
Jul 5, 2018, 5:27:41 AM7/5/18
to Mender List mender.io, stefano.c...@gmail.com, mirza...@northern.tech
Thank u for all responses.

Mirza you are right, I forgot to remove that line after many experiments.
I remove that line from my local.conf and I recreated the sdimg from scratch, but I have the same problem. After that I executed "ls $mender_uboot_root /boot"

This is the result 
ls $mender_uboot_root /boot
<DIR>       4096 .
<DIR>       4096 ..
         7252648 zImage
           35538 imx6ull-14x14-evk.dtb
=> 
<DIR>       4096 .
<DIR>       4096 ..
         7252648 zImage
           35538 imx6ull-14x14-evk.dtb


Shawn Stevenson, yes the patch is applied because if I execute "printenv" at the first boot I receive this:
printenv
altbootcmd=run mender_altbootcmd; run bootcmd
baudrate=115200
board_name=EVK
board_rev=14X14
boot_fdt=try
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover
bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};
bootcount=1
bootdelay=3
bootlimit=1
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
ethprime=eth0
fdt_addr_r=0x83000000
fdt_file=undefined
fdt_high=0xffffffff
fdtcontroladdr=9ef230f8
findfdt=if test $fdt_file = undefined; then if test $board_name = EVK && test $board_rev = 9X9; then setenv fdt_file imx6ull-9x9-evk.dtb; fi; if test $board_name = EVK && test $board_rev = 14X14; then setenv fdt_file imx6ull-14x14-evk.dtb; fi; if test $fdt_file = undefined; then echo WARNING: Could not determine dtb to use; fi; fi;
image=zImage
initrd_addr=0x83800000
initrd_high=0xffffffff
ip_dyn=yes
kernel_addr_r=0x80800000
loadaddr=0x80800000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; else setenv mender_boot_part 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_dtb_name=imx6ull-14x14-evk.dtb
mender_kernel_name=zImage
mender_setup=setenv mender_kernel_root /dev/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 1:1
mender_uboot_dev=1
mender_uboot_if=mmc
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc g_mass_storage.stall=0 g_mass_storage.removable=1 g_mass_storage.file=/fat g_mass_storage.ro=1 g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF g_mass_storage.iSerialNumber="" clk_ignore_unused 
mmcargs=setenv bootargs console=${console},${baudrate} 
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
panel=TFT43AB
script=boot.scr
upgrade_available=0

Environment size: 3601/131067 bytes
=> 
altbootcmd=run mender_altbootcmd; run bootcmd
baudrate=115200
board_name=EVK
board_rev=14X14
boot_fdt=try
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover
bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};
bootcount=1
bootdelay=3
bootlimit=1
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
ethprime=eth0
fdt_addr_r=0x83000000
fdt_file=undefined
fdt_high=0xffffffff
fdtcontroladdr=9ef230f8
findfdt=if test $fdt_file = undefined; then if test $board_name = EVK && test $board_rev = 9X9; then setenv fdt_file imx6ull-9x9-evk.dtb; fi; if test $board_name = EVK && test $board_rev = 14X14; then setenv fdt_file imx6ull-14x14-evk.dtb; fi; if test $fdt_file = undefined; then echo WARNING: Could not determine dtb to use; fi; fi;
image=zImage
initrd_addr=0x83800000
initrd_high=0xffffffff
ip_dyn=yes
kernel_addr_r=0x80800000
loadaddr=0x80800000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; else setenv mender_boot_part 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_dtb_name=imx6ull-14x14-evk.dtb
mender_kernel_name=zImage
mender_setup=setenv mender_kernel_root /dev/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 1:1
mender_uboot_dev=1
mender_uboot_if=mmc
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc g_mass_storage.stall=0 g_mass_storage.removable=1 g_mass_storage.file=/fat g_mass_storage.ro=1 g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF g_mass_storage.iSerialNumber="" clk_ignore_unused 
mmcargs=setenv bootargs console=${console},${baudrate} 
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
panel=TFT43AB
script=boot.scr
upgrade_available=0

Environment size: 3601/131067 bytes

After the reboot during integration checklist, that variable disappears and I'm not able to start the kernel again.

PS: I cannot add MACHINE_ESSENTIAL_EXTRA_RDEPENDS, because I get errors while building about conflicts of kernel and dtb names.

Ks89

unread,
Jul 5, 2018, 5:41:54 AM7/5/18
to Mender List mender.io, stefano.c...@gmail.com, mirza...@northern.tech
When I'm blocked and I'm not able to start linux again, I tried to run these commands from uboot:

setenv kernel_addr_r 0x80800000
run bootcmd

and finally I can boot again into linux.

Why does kernel_addr_r disappear?

Mirza Krak

unread,
Jul 5, 2018, 5:49:58 AM7/5/18
to Ks89, Mender List mender.io
On Thu, Jul 5, 2018 at 11:41 AM, Ks89 <stefano.c...@gmail.com> wrote:
> When I'm blocked and I'm not able to start linux again, I tried to run these
> commands from uboot:
>
> setenv kernel_addr_r 0x80800000
> run bootcmd
>
>
> and finally I can boot again into linux.
>
> Why does kernel_addr_r disappear?

It might be that your u-boot-fw-utils do not share the same "default"
environment area. Are you making sure that your U-boot patch is
applied both to u-boot and u-boot-fw-utils?

If the patch is not applied to u-boot-fw-utils, that would mean that
if your use "fw_setenv" to save the initial environment to persistent
storage, and if u-boot-fw-utils does not have the kernel_addr_r
patch/variable it would disappear as you have seen.

--
Mirza Krak | Embedded Solutions Architect | https://mender.io

Northern.tech AS | @northerntechHQ

Ks89

unread,
Jul 5, 2018, 6:21:37 AM7/5/18
to Mender List mender.io, stefano.c...@gmail.com, mirza...@northern.tech
Are you making sure that your U-boot patch is 
applied both to u-boot and u-boot-fw-utils?

No, I applied the patch to u-boot.
How can I apply the kernel_addres to u-boot-fw-utils? Which variable I should change?


Thanks.

Mirza Krak

unread,
Jul 5, 2018, 6:55:19 AM7/5/18
to Ks89, Mender List mender.io
On Thu, Jul 5, 2018 at 12:21 PM, Ks89 <stefano.c...@gmail.com> wrote:
>> Are you making sure that your U-boot patch is
>> applied both to u-boot and u-boot-fw-utils?
>
>
> No, I applied the patch to u-boot.
> How can I apply the kernel_addres to u-boot-fw-utils? Which variable I
> should change?

One example can be found here [1] and here [2],

u-boot-fw-utils are compiled from u-boot source, so it is the exact
same change. But you need to make sure in Yocto that both the u-boot
and u-boot-fw-utils recipes include the patch.

[1]. https://github.com/mendersoftware/meta-mender/tree/master/meta-mender-raspberrypi/recipes-bsp/u-boot
[2]. https://github.com/mendersoftware/meta-mender/tree/pyro-v2017.11/meta-mender-beaglebone/recipes-bsp/u-boot

Ks89

unread,
Jul 5, 2018, 8:22:33 AM7/5/18
to Mender List mender.io, stefano.c...@gmail.com, mirza...@northern.tech
Good point.
I'll try it and I'll udpate this discussion with the result next week.

Ks89

unread,
Jul 10, 2018, 4:56:02 AM7/10/18
to Mender List mender.io, stefano.c...@gmail.com, mirza...@northern.tech
Hi guys.

I confirm that applying the same patch also for u-boot fw utils it worked.

Thank you very much to all of you (Mirza, Shawn and Kristian) for the amazing support. I opened this post more than a month ago and you supported me very patiently. 
This is really appreciated, in particular for free support for an open source project.

I'm really happy to chose mender months ago.
Good support is really important to improve the quality and users of a project.

Thanks again :),
Ks89
Reply all
Reply to author
Forward
0 new messages