Create Demo Image for Sama7G54-EK Board

Hello All,

This is my first time setting up Mender, so please be kind as I learn the process… :slight_smile: thank you!

I’m using Yocto Project (Branch Kirkstone) and Building for Demo documentation (https://docs.mender.io/operating-system-updates-yocto-project/build-for-demo).

My target board is Microchip’s Sama7G54-EK which is running U-Boot and Linux4Sam OS (https://www.linux4sam.org/bin/view/Linux4SAM/Sama7g5EKMainPage#Build_Yocto_Poky_rootfs_from_sou).

Following all the steps as described in the documentation, I get following error:

Blockquote
$ MACHINE=sama7g5ek-sd bitbake microchip-headless-image
Loading cache: 100% | | ETA: --:–:–
Loaded 0 entries from dependency cache.
Parsing recipes: 100% |################################################################################################################| Time: 0:01:45
Parsing of 2726 .bb files complete (0 cached, 2726 parsed). 4230 targets, 423 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION = “2.0.0”
BUILD_SYS = “x86_64-linux”
NATIVELSBSTRING = “universal”
TARGET_SYS = “arm-poky-linux-gnueabi”
MACHINE = “sama7g5ek-sd”
DISTRO = “poky-atmel”
DISTRO_VERSION = “4.0.8”
TUNE_FEATURES = “arm vfp cortexa7 neon vfpv4 callconvention-hard”
TARGET_FPU = “hard”
meta
meta-poky
meta-yocto-bsp = “kirkstone:85661be8ff3623faf05525bc9f27a2457381f8e9”
meta-oe
meta-networking
meta-webserver
meta-python
meta-initramfs = “kirkstone:9cf4ebeb3de524009a73f49722489dc4aa183adb”
meta-atmel = “kirkstone:772408b60c483e6157077699c42f10e1b817029d”
meta-multimedia = “kirkstone:9cf4ebeb3de524009a73f49722489dc4aa183adb”
meta-arm
meta-arm-toolchain = “kirkstone:a0216a41bde3f191037332a9238648bedfbc61bd”
meta-aws = “HEAD:3c62e017e5174abd689fc2e6042f053a950a7384”
meta-quectel = “master:15998a647c7fe4112cb5e21a2ab6f25ad250c422”
meta-mender-core
meta-mender-demo = “kirkstone:ab2a9f135979e5d6ec6bd431cbd4d43408112eeb”

Initialising tasks: 100% |#############################################################################################################| Time: 0:00:09
Sstate summary: Wanted 348 Local 318 Mirrors 0 Missed 30 Current 2569 (91% match, 98% complete)
Removing 16 stale sstate objects for arch sama7g5ek_sd: 100% |#########################################################################| Time: 0:00:01
Removing 10 stale sstate objects for arch cortexa7hf-neon-vfpv4: 100% |################################################################| Time: 0:00:00
NOTE: Executing Tasks
WARNING: mender-client-3.5.0-r0 do_compile: You are building with the mender-demo layer, which is not intended for production use
ERROR: microchip-headless-image-1.0-r1 do_image_bootimg: ExecutionError(‘/home/nitesh/Projects/yocto/build-sama7-aws-2/tmp/work/sama7g5ek_sd-poky-linux-gnueabi/microchip-headless-image/1.0-r1/temp/run.do_image_bootimg.436412’, 1, None, None)
ERROR: Logfile of failure stored in: /home/nitesh/Projects/yocto/build-sama7-aws-2/tmp/work/sama7g5ek_sd-poky-linux-gnueabi/microchip-headless-image/1.0-r1/temp/log.do_image_bootimg.436412
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are [‘/home/nitesh/Projects/yocto/poky/meta/recipes-core/glibc/cross-localedef-native_2.35.bb:do_populate_sysroot’, ‘/home/nitesh/Projects/yocto/poky/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb:do_populate_sysroot’, ‘/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/binutils/binutils-cross_2.38.bb:do_populate_sysroot’, ‘/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/cdrtools/cdrtools-native_3.01.bb:do_populate_sysroot’, ‘/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb:do_populate_sysroot’, ‘/home/nitesh/Projects/yocto/poky/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/dosfstools/dosfstools_4.2.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/makedevs/makedevs_1.0.1.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/mtools/mtools_4.0.38.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/opkg-utils/opkg-utils_0.5.0.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/opkg/opkg_0.5.0.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-extended/pbzip2/pbzip2_1.1.13.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-extended/pigz/pigz_2.7.bb:do_populate_sysroot’, ‘virtual:native:/home/nitesh/Projects/yocto/poky/meta/recipes-support/bmap-tools/bmap-tools_git.bb:do_populate_sysroot’]
| NOTE: Installed into sysroot: [‘dosfstools-native’]
| NOTE: Skipping as already exists in sysroot: [‘cross-localedef-native’, ‘ldconfig-native’, ‘binutils-cross-arm’, ‘cdrtools-native’, ‘qemuwrapper-cross’, ‘depmodwrapper-cross’, ‘update-rc.d-native’, ‘btrfs-tools-native’, ‘e2fsprogs-native’, ‘makedevs-native’, ‘mtools-native’, ‘opkg-utils-native’, ‘opkg-native’, ‘pseudo-native’, ‘squashfs-tools-native’, ‘syslinux-native’, ‘pbzip2-native’, ‘pigz-native’, ‘bmap-tools-native’, ‘qemu-native’, ‘xz-native’, ‘shadow-native’, ‘systemd-systemctl-native’, ‘bzip2-native’, ‘perl-native’, ‘gdk-pixbuf-native’, ‘kmod-native’, ‘attr-native’, ‘util-linux-native’, ‘gettext-minimal-native’, ‘texinfo-dummy-native’, ‘libtool-native’, ‘shared-mime-info-native’, ‘openssl-native’, ‘debianutils-native’, ‘zlib-native’, ‘nasm-native’, ‘python3-setuptools-native’, ‘lzo-native’, ‘python3-native’, ‘coreutils-native’, ‘python3-six-native’, ‘python3-installer-native’, ‘python3-wheel-native’, ‘libsolv-native’, ‘libarchive-native’, ‘lz4-native’, ‘zstd-native’, ‘flex-native’, ‘gnu-config-native’, ‘nss-native’, ‘glib-2.0-native’, ‘make-native’, ‘gdbm-native’, ‘libjpeg-turbo-native’, ‘gobject-introspection-native’, ‘libpng-native’, ‘util-linux-libuuid-native’, ‘libcap-ng-native’, ‘ncurses-native’, ‘libpcre2-native’, ‘itstool-native’, ‘libxml2-native’, ‘groff-native’, ‘libnsl2-native’, ‘libtirpc-native’, ‘readline-native’, ‘sqlite3-native’, ‘libffi-native’, ‘python3-flit-core-native’, ‘unzip-native’, ‘cmake-native’, ‘expat-native’, ‘m4-native’, ‘nspr-native’, ‘gettext-native’, ‘libpcre-native’, ‘curl-native’]
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing python function set_image_size
| DEBUG: 522188.000000 = 522188 * 1.000000
| DEBUG: 32677888.000000 = max(522188.000000, 32677888)[32677888.000000] + 0
| DEBUG: 32677888.000000 = int(32677888.000000)
| DEBUG: 32677888 = aligned(32677888)
| DEBUG: returning 32677888
| DEBUG: Python function set_image_size finished
| DEBUG: Executing shell function do_image_bootimg
| 0+0 records in
| 0+0 records out
| 0 bytes copied, 2.5382e-05 s, 0.0 kB/s
| mkfs.fat: Warning: lowercase labels might not work properly on some systems
| mkfs.fat 4.2 (2021-01-31)
| Disk full
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/nitesh/Projects/yocto/poky/…/meta-atmel/recipes-atmel/images/microchip-headless-image.bb:do_image_bootimg) failed with exit code ‘1’
NOTE: Tasks Summary: Attempted 7328 tasks of which 7261 didn’t need to be rerun and 1 failed.

Summary: 1 task failed:
/home/nitesh/Projects/yocto/poky/…/meta-atmel/recipes-atmel/images/microchip-headless-image.bb:do_image_bootimg
Summary: There was 1 WARNING message.
Summary: There was 1 ERROR message, returning a non-zero exit code.

I got no idea why it says “Disk full” while I have plenty of HDD space left. My goal is to just build a demo image so I can run on the board and demonstrate Mender.

Any help will be highly appreciated.

Cheers,
Nitesh

Hi @ndivecha,

Thanks for reaching out! The error message is not about the storage on your harddisk, but the resulting image. If I understand correctly, then the boot partition default is too small. You can increase it by adding this to a config file (like local.conf, or your distro/machine configuration):

MENDER_BOOT_PART_SIZE_MB = "64"

It is documented here.

Greetz,
Josef

Hello @TheYoctoJester ,

Thanks for your reply… Much appreciated.

So adding this line did the trick and I was able to generate *.sdimg:

MENDER_BOOT_PART_SIZE_MB = "64"

Here is my local.conf:

#Example: Memory card storage
MENDER_STORAGE_DEVICE = “/dev/mmcblk0”
#Example: Memory card with 2GiB of storage.
#MENDER_STORAGE_TOTAL_SIZE_MB = “29476”
#MENDER_STORAGE_TOTAL_SIZE_MB = “14738”
MENDER_STORAGE_TOTAL_SIZE_MB = “2048”

#MENDER_UBOOT_STORAGE_INTERFACE = “mmc”
#MENDER_UBOOT_STORAGE_DEVICE = “0”

#From @TheYoctoJester Mender

MENDER_BOOT_PART_SIZE_MB = “64”

MENDER_BOOT_PART = “${MENDER_STORAGE_DEVICE_BASE}1”
MENDER_DATA_PART = “${MENDER_STORAGE_DEVICE_BASE}4”
MENDER_ROOTFS_PART_A = “${MENDER_STORAGE_DEVICE_BASE}2”
MENDER_ROOTFS_PART_B = “${MENDER_STORAGE_DEVICE_BASE}3”

Flash the SD card and booted up but got into loop with AT91Bootstrap and U-boot.

RomBOOT
MCK: mck domains initialization complete.
TZC400: Initialization complete.
PUBL: Training complete.
UMCTL2: Initialization complete.
Backup mode enabled

AT91Bootstrap 4.0.5 (2022-11-09 13:05:42)

SD/MMC: Image: Read file u-boot.bin to 0x66f00000
MMC: ADMA supported
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image

U-Boot 2022.01-linux4sam-2022.10 (Nov 09 2022 - 13:45:10 +0000)

CPU: SAMA7G5
Crystal frequency: 24 MHz
CPU clock : 800 MHz
Master clock : 200 MHz

Model: Microchip SAMA7G5-EK
DRAM: 512 MiB
MMC: mmc@e1204000: 0, mmc@e1208000: 1
Loading Environment from MMC… OK
In: serial@200
Out: serial@200
Err: serial@200
Net: eth0: ethernet@e2800000, eth1: ethernet@e2804000
Hit any key to stop autoboot: 0
load - load binary file from a filesystem

Usage:
load [<dev[:part]> [ [ [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.
data abort
pc : [<7ff73854>] lr : [<7ff79480>]
reloc pc : [<66f01854>] lr : [<66f07480>]
sp : 7fb49260 ip : 7fffffff fp : 7ff8b954
r10: 7fb71f50 r9 : 7fb51eb0 r8 : 7fb71f54
r7 : 7ffe7284 r6 : 00000000 r5 : 7ffe9278 r4 : 00000001
r3 : 0000002d r2 : 7fb4927c r1 : 7fb49278 r0 : 00000000
Flags: nZCv IRQs off FIQs off Mode SVC_32
Code: e5903094 e59000a0 e12fff13 e92d4010 (e5d0c025)
Resetting CPU …

I think my U-Boot environment is messed up… Or it can not find ${MENDER_STORAGE_DEVICE_BASE} which is causing the issue.

=> printenv
altbootcmd=run mender_altbootcmd; run bootcmd
arch=arm
baudrate=115200
board=sama7g5ek
board_name=sama7g5ek
bootargs=console=ttyS0,115200 rw rootwait
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=2
bootlimit=1
cpu=armv7
eth1addr=04:91:62:f2:a4:c9
ethaddr=04:91:62:f2:ae:88
fdtcontroladdr=7fb494f0
loadaddr=0x62000000
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; setenv mender_boot_part_hex 3; else setenv mender_boot_part 2; sete
nv mender_boot_part_hex 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_boot_part_hex=2
mender_check_saveenv_canary=1
mender_dtb_name=at91-sama7g5ek.dtb
mender_kernel_name=zImage
mender_saveenv_canary=1
mender_setup=if test “${mender_saveenv_canary}” != “1”; then setenv mender_saveenv_canary 1; saveenv; fi; if test “${mender_pre_setup_commands}” != “”
; then run mender_pre_setup_commands; fi; if test “${mender_systemd_machine_id}” != “”; then setenv bootargs “systemd.machine_id=${mender_systemd_mach
ine_id} ${bootargs}”; fi; setenv mender_kernel_root /dev/mmcblk0p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_na
me /dev/mmcblk0p2; else setenv mender_boot_part_name /dev/mmcblk0p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_
root mmc 0:${mender_boot_part_hex}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs “setenv bootargs \”${bootargs}\“”
; run expand_bootargs; setenv expand_bootargs; if test “${mender_post_setup_commands}” != “”; then run mender_post_setup_commands; fi
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 0:1
mender_uboot_dev=0
mender_uboot_if=mmc
soc=at91
stderr=serial@200
stdin=serial@200
stdout=serial@200=
upgrade_available=0
vendor=atmel

Environment size: 2178/131067 bytes

Cheers,
Nitesh

Looking at the partitions, files are there but load is failing:

load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name};

boot partition:

=> fatls mmc 0:1
    27365   BOOT.BIN
  4767128   sama7g5ek.itb
   571252   u-boot.bin
    16384   uboot.env

4 file(s), 0 dir(s)

root fs:

=> ext4ls mmc 0:2
<DIR>       1024 .
<DIR>       1024 ..
<DIR>      12288 lost+found
<DIR>       3072 bin
<DIR>       1024 boot
<DIR>       1024 dev
<DIR>       1024 etc
<DIR>       1024 home
<DIR>       1024 lib
<DIR>       1024 media
<DIR>       1024 mnt
<DIR>       1024 proc
<DIR>       1024 run
<DIR>       3072 sbin
<DIR>       1024 srv
<DIR>       1024 sys
<DIR>       1024 tmp
<DIR>       1024 usr
<DIR>       1024 var
=> ext4ls mmc 0:2 boot
<DIR>       1024 .
<DIR>       1024 ..
         4767128 sama7g5ek.itb
            3664 sama7g5ek.its
            1323 sama7g5ek_i2s0_pcm5102a.dtbo
            1398 sama7g5ek_i2s0_proto.dtbo
            4251 sama7g5ek_isc_imx219.dtbo
            2718 sama7g5ek_isc_imx274.dtbo
            1415 sama7g5ek_pdmc0.dtbo
            1808 sama7g5ek_wilc3000.dtbo
<SYM>         41 zImage
         4706176 zImage-6.1.22-linux4microchip-2023.04-rc2
=>

Looking at the environment variables by running run mender_setup and partitions fatls mmc 0:1 and ext4ls mmc 0:2, things do not line up.

  • Something really strange about the DTB file… Filename at91-sama7g5ek.dtb shows on my host machine that it does exists under /boot/ but when I plug the SD Card on target board and do ext4ls mmc 0:2 boot it does not show, as shown in earlier post.

  • Variable ${kernel_addr_r} and ${fdt_addr_r} does not exists. Do I have to create these two variables manually and define the address? When I boot without Mender layer, I see Linux4SAM Linux kernel is load address 0x62000000 and SAMA7G5-EK Flattened Device Tree blob Load Address: 0x61000000

Right now my head is just spinning, trying to figure out how can I make Mender demo work on this board. I dont know what I am missing to make this work!

=> run mender_setup
=> printenv
altbootcmd=run mender_altbootcmd; run bootcmd
arch=arm
baudrate=115200
board=sama7g5ek
board_name=sama7g5ek
bootargs=console=ttyS0,115200 rw rootwait
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=2
bootlimit=1
cpu=armv7
eth1addr=04:91:62:f2:a4:c9
ethaddr=04:91:62:f2:ae:88
fdtcontroladdr=7fb494f0
loadaddr=0x62000000
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; setenv mender_boot_part_hex 3; else setenv mender_boot_part 2; setenv mender_boot_part_hex 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_boot_part_hex=2
mender_boot_part_name=/dev/mmcblk0p2
mender_check_saveenv_canary=1
mender_dtb_name=at91-sama7g5ek.dtb
mender_kernel_name=zImage
mender_kernel_root=/dev/mmcblk0p2
mender_kernel_root_name=/dev/mmcblk0p2
mender_saveenv_canary=1
mender_setup=if test "${mender_saveenv_canary}" != "1"; then setenv mender_saveenv_canary 1; saveenv; fi; if test "${mender_pre_setup_commands}" != ""; then run mender_pre_setup_commands; fi; if test "${mender_systemd_machine_id}" != ""; then setenv bootargs "systemd.machine_id=${mender_systemd_machine_id} ${bootargs}"; fi; setenv mender_kernel_root /dev/mmcblk0p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk0p2; else setenv mender_boot_part_name /dev/mmcblk0p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 0:${mender_boot_part_hex}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""
; run expand_bootargs; setenv expand_bootargs; if test "${mender_post_setup_commands}" != ""; then run mender_post_setup_commands; fi mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 0:1
mender_uboot_dev=0
mender_uboot_if=mmc
mender_uboot_root=mmc 0:2
mender_uboot_root_name=/dev/mmcblk0p2
soc=at91
stderr=serial@200
stdin=serial@200
stdout=serial@200
upgrade_available=0
vendor=atmel

Hi @ndivecha,

Sorry to hear you’re having problems getting started. Can you please share your configuration so far, e.g. Mender-related settings that you added to local.conf, probably? Just judging from the meta-mender-atmel layer in meta-mender-community, the usual way to work with the SAM boards seems to be manually setting u-boot up.

On a side note, does the board boot from SD card, eMMC, or something UBI?

Greetz,
Josef

Hello @TheYoctoJester

Much appreciate for your feedback.

Here is my local.conf:

MENDER_ARTIFACT_NAME = "release-1"
INHERIT += "mender-full"
DISTRO_FEATURES:append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""

ARTIFACTIMG_FSTYPE = "ext4"
MENDER_STORAGE_DEVICE = "/dev/mmcblk0"
MENDER_STORAGE_TOTAL_SIZE_MB = "2048"
MENDER_UBOOT_STORAGE_INTERFACE = "mmc"
MENDER_UBOOT_STORAGE_DEVICE = "0"

# from @TheYoctoJester Mender
MENDER_BOOT_PART_SIZE_MB = "64"

MENDER_STORAGE_DEVICE_BASE = "${MENDER_STORAGE_DEVICE}"
MENDER_BOOT_PART = "${MENDER_STORAGE_DEVICE_BASE}1"
MENDER_ROOTFS_PART_A = "${MENDER_STORAGE_DEVICE_BASE}2"
MENDER_ROOTFS_PART_B = "${MENDER_STORAGE_DEVICE_BASE}3"
MENDER_DATA_PART = "${MENDER_STORAGE_DEVICE_BASE}4"

MENDER_FEATURES_ENABLE:append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE:append = " mender-grub mender-image-uefi"

MACHINE_ESSENTIAL_EXTRA_RDEPENDS:append = " kernel-image kernel-devicetree"

MENDER_SERVER_URL = "https://hosted.mender.io"
MENDER_TENANT_TOKEN = "<TOKEN>"

Also I did add following lines to my ../meta-atmel/recipes-bsp/u-boot/u-boot-at91_2022.10.bb file since I m forking U-Boot as per the doc:

$ bitbake -e core-image-minimal | egrep '^PREFERRED_PROVIDER_(virtual/bootloader|u-boot)='
PREFERRED_PROVIDER_u-boot="u-boot-at91"
PREFERRED_PROVIDER_virtual/bootloader="u-boot-at91"
require /home/nitesh/Projects/yocto/meta-mender/meta-mender-core/recipes-bsp/u-boot/u-boot-mender.inc
# Mender
PROVIDES += "u-boot"
RPROVIDES_${PN} += "u-boot"
BOOTENV_SIZE = "0x20000"

And I got following layers on:

$ bitbake-layers show-layers
NOTE: Starting bitbake server...
layer                 path                                      priority
==========================================================================
meta                  /home/nitesh/Projects/yocto/poky/meta     5
meta-poky             /home/nitesh/Projects/yocto/poky/meta-poky  5
meta-yocto-bsp        /home/nitesh/Projects/yocto/poky/meta-yocto-bsp  5
meta-oe               /home/nitesh/Projects/yocto/poky/../meta-openembedded/meta-oe  5
meta-networking       /home/nitesh/Projects/yocto/poky/../meta-openembedded/meta-networking  5
meta-webserver        /home/nitesh/Projects/yocto/poky/../meta-openembedded/meta-webserver  5
meta-python           /home/nitesh/Projects/yocto/poky/../meta-openembedded/meta-python  5
meta-initramfs        /home/nitesh/Projects/yocto/poky/../meta-openembedded/meta-initramfs  5
meta-atmel            /home/nitesh/Projects/yocto/poky/../meta-atmel  10
meta-multimedia       /home/nitesh/Projects/yocto/poky/../meta-openembedded/meta-multimedia  5
meta-arm              /home/nitesh/Projects/yocto/poky/../meta-arm/meta-arm  5
meta-arm-toolchain    /home/nitesh/Projects/yocto/poky/../meta-arm/meta-arm-toolchain  5
meta-aws              /home/nitesh/Projects/yocto/meta-aws      6
meta-quectel          /home/nitesh/Projects/yocto/meta-quectel  6
meta-mender-core      /home/nitesh/Projects/yocto/meta-mender/meta-mender-core  6
meta-mender-demo      /home/nitesh/Projects/yocto/meta-mender/meta-mender-demo  10

Sama7G54-EK got both options for SD Card and eMMC.

I hope this info helps to find me a solution so I can boot up with Mender :-).

Cheers,
Nitesh

Hello @TheYoctoJester

Hope all is well… Just checking if you had any insights on how to fix this?

I did look into meta-mender-community and it is for Sama5’s… I wonder if it will work for Sama7G54-EK… Might give it a try!

Cheers,
Nitesh

Hello @ndivecha,

Sorry for the belated response. What we noticed, you’re manually setting

MENDER_STORAGE_DEVICE_BASE
MENDER_BOOT_PART
MENDER_ROOTFS_PART_A
MENDER_ROOTFS_PART_B
MENDER_DATA_PART

Unless you have a specific need to modify those, it is advisable to stick with the defaults. In your case it actually breaks, because you miss the p between MENDER_STORAGE_DEVICE_BASE and the digit. A common block node on mmc is for example /dev/mmcblk0p1.

Try to remove those assignments for a start.

Greetz,
Josef

Ah! :bulb: make sense… Much appreciated for pointing out.

Nah, I don’t have any preference. I was just following the docs but I will go ahead and comment those lines out and re-bitbake the image.

Keep you posted.

Cheers,
Nitesh

Hello @TheYoctoJester

So it worked out great and now I see correct partitions with “p” but ran into dtb file issue. And I know this from before also and it is a strange one.

On my host (dev) machine when I plug the SD card I can see that dtb file exists in /boot/at91-sama7g5ek.dtb:

$ ls -l /media/nitesh/4377c493-5112-4a22-888b-da731bac4c7b/boot/
total 9100
-rw-r--r-- 1 root root   43360 Mar  9  2018 at91-sama7g5ek.dtb
-rwxr-xr-x 1 root root    1323 Mar  9  2018 sama7g5ek_i2s0_pcm5102a.dtbo
-rwxr-xr-x 1 root root    1398 Mar  9  2018 sama7g5ek_i2s0_proto.dtbo
-rwxr-xr-x 1 root root    4251 Mar  9  2018 sama7g5ek_isc_imx219.dtbo
-rwxr-xr-x 1 root root    2718 Mar  9  2018 sama7g5ek_isc_imx274.dtbo
-rwxr-xr-x 1 root root 4648288 Mar  9  2018 sama7g5ek.itb
-rwxr-xr-x 1 root root    3664 Mar  9  2018 sama7g5ek.its
-rwxr-xr-x 1 root root    1415 Mar  9  2018 sama7g5ek_pdmc0.dtbo
-rwxr-xr-x 1 root root    1808 Mar  9  2018 sama7g5ek_wilc3000.dtbo
lrwxrwxrwx 1 root root      38 Mar  9  2018 zImage -> zImage-5.15.68-linux4microchip-2022.10
-rw-r--r-- 1 root root 4588032 Mar  9  2018 zImage-5.15.68-linux4microchip-2022.10

But when I plug the SD Card on Sama7 board, it fails to find /boot/at91-sama7g5ek.dtb:

Model: Microchip SAMA7G5-EK
DRAM:  512 MiB
MMC:   mmc@e1204000: 0, mmc@e1208000: 1
Loading Environment from MMC... OK
In:    serial@200
Out:   serial@200
Err:   serial@200
Net:   eth0: ethernet@e2800000, eth1: ethernet@e2804000
Hit any key to stop autoboot:  0 
Failed to load '/boot/at91-sama7g5ek.dtb'
4706176 bytes read in 295 ms (15.2 MiB/s)
Kernel image @ 0x62000000 [ 0x000000 - 0x47cf80 ]
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree

and when I try to list mmc:

=> ext4ls mmc 0:2
<DIR>       1024 .
<DIR>       1024 ..
<DIR>      12288 lost+found
<DIR>       3072 bin
<DIR>       1024 boot
<DIR>       1024 dev
<DIR>       1024 etc
<DIR>       1024 home
<DIR>       1024 lib
<DIR>       1024 media
<DIR>       1024 mnt
<DIR>       1024 proc
<DIR>       1024 run
<DIR>       3072 sbin
<DIR>       1024 srv
<DIR>       1024 sys
<DIR>       1024 tmp
<DIR>       1024 usr
<DIR>       1024 var
=> ext4ls mmc 0:2 boot
<DIR>       1024 .
<DIR>       1024 ..
         4767128 sama7g5ek.itb
            3664 sama7g5ek.its
            1323 sama7g5ek_i2s0_pcm5102a.dtbo
            1398 sama7g5ek_i2s0_proto.dtbo
            4251 sama7g5ek_isc_imx219.dtbo
            2718 sama7g5ek_isc_imx274.dtbo
            1415 sama7g5ek_pdmc0.dtbo
            1808 sama7g5ek_wilc3000.dtbo
<SYM>         41 zImage
         4706176 zImage-6.1.22-linux4microchip-2023.04-rc2
=> 

Not found… Everything else is there except /boot/at91-sama7g5ek.dtb.

Thoughts?

Cheers,
Nitesh

Btw, here is update printenv

=> printenv 
altbootcmd=run mender_altbootcmd; run bootcmd
arch=arm
baudrate=115200
board=sama7g5ek
board_name=sama7g5ek
bootargs=root=/dev/mmcblk0p2 root=/dev/mmcblk0p2 console=ttyS0,115200 rw rootwait
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=2
bootlimit=1
cpu=armv7
eth1addr=04:91:62:f2:a4:c9
ethaddr=04:91:62:f2:ae:88
fdt_addr_r=0x61000000
fdtcontroladdr=7fb494f0
fileaddr=62000000
filesize=47cf80
kernel_addr_r=0x62000000
loadaddr=0x62000000
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; setenv mender_boot_part_hex 3; else setenv mender_boot_part 2; sete
nv mender_boot_part_hex 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_boot_part_hex=2
mender_boot_part_name=/dev/mmcblk0p2
mender_check_saveenv_canary=1
mender_dtb_name=at91-sama7g5ek.dtb
mender_kernel_name=zImage
mender_kernel_root=/dev/mmcblk0p2
mender_kernel_root_name=/dev/mmcblk0p2
mender_saveenv_canary=1
mender_setup=if test "${mender_saveenv_canary}" != "1"; then setenv mender_saveenv_canary 1; saveenv; fi; if test "${mender_pre_setup_commands}" != ""
; then run mender_pre_setup_commands; fi; if test "${mender_systemd_machine_id}" != ""; then setenv bootargs "systemd.machine_id=${mender_systemd_machine_id} ${bootargs}"; fi; setenv mender_kernel_root /dev/mmcblk0p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk0p2; else setenv mender_boot_part_name /dev/mmcblk0p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 0:${mender_boot_part_hex}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs; if test "${mender_post_setup_commands}" != ""; then run mender_post_setup_commands; fi
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 0:1
mender_uboot_dev=0
mender_uboot_if=mmc
mender_uboot_root=mmc 0:2
mender_uboot_root_name=/dev/mmcblk0p2
soc=at91
stderr=serial@200
stdin=serial@200
stdout=serial@200
upgrade_available=0
vendor=atmel

Environment size: 2473/131067 bytes

Hi @ndivecha,

As there is an .itb (e.g. a fitImage), you actually shouldn’t need a separate device tree file. Can you try setting

MENDER_KERNEL_IMAGETYPE = "fitImage"

and check if it already does the trick?

Greetz,
Josef

Hey @TheYoctoJester,

Roger… adding and re-compiling.

Just on side notes… Any thoughts why /boot/at91-sama7g5ek.dtb won’t show on Sama7 board but when SD Card plugged into host (dev) machine it shows?

This is good learning experience… Much appreciate for been patiences with me.

Cheers,
Nitesh

Got following warning message:

WARNING: "MENDER_KERNEL_IMAGETYPE" is not a recognized MENDER_ variable. Typo?

Or should it be this (mender_kernel_imagetype_force): Variables | Mender documentation

No change… same issue:

AT91Bootstrap 4.0.5 (2022-11-09 13:05:42)

SD/MMC: Image: Read file u-boot.bin to 0x66f00000
MMC: ADMA supported
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image


U-Boot 2022.01-linux4sam-2022.10 (Nov 09 2022 - 13:45:10 +0000)

CPU:   SAMA7G5
Crystal frequency:       24 MHz
CPU clock        :      800 MHz
Master clock     :      200 MHz

Model: Microchip SAMA7G5-EK
DRAM:  512 MiB
MMC:   mmc@e1204000: 0, mmc@e1208000: 1
Loading Environment from MMC... OK
In:    serial@200
Out:   serial@200
Err:   serial@200
Net:   eth0: ethernet@e2800000, eth1: ethernet@e2804000
Hit any key to stop autoboot:  0 
Failed to load '/boot/at91-sama7g5ek.dtb'
4706176 bytes read in 295 ms (15.2 MiB/s)
Kernel image @ 0x62000000 [ 0x000000 - 0x47cf80 ]
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
=> ext4ls mmc 0:2 boot
<DIR>       1024 .
<DIR>       1024 ..
         4767128 sama7g5ek.itb
            3664 sama7g5ek.its
            1323 sama7g5ek_i2s0_pcm5102a.dtbo
            1398 sama7g5ek_i2s0_proto.dtbo
            4251 sama7g5ek_isc_imx219.dtbo
            2718 sama7g5ek_isc_imx274.dtbo
            1415 sama7g5ek_pdmc0.dtbo
            1808 sama7g5ek_wilc3000.dtbo
<SYM>         41 zImage
         4706176 zImage-6.1.22-linux4microchip-2023.04-rc2
=> 

HI @ndivecha,

I’m currently setting up a somewhat similar build to look at it, but my current guess is that the best way is changing KERNEL_IMAGETYPE and IMAGE_INSTALL such that both kernel and dtb end up in the partition. Technically, the fitImage bundles those, but as the Mender boot script expects both to be present, it falls over. Theoretically you could change the boot script to something more suitable, but I think changing the kernel image type is easier.

Just so I can verify my assumptions, can you drop bitbake -e of your images somewhere? In case you fear this leaking sensible information, you can either mail it to me directly (josef.holzmayr@northern.tech), or filter it depending on your needs.

Greetz,
Josef

Happy Sunday Josef,

Thanks for your time and support.

Sent you email with bitbake -e info. Let me know your thoughts!.

Where are these two variables? IMAGE_INSTALL and KERNEL_IMAGETYPE, I did not find anywhere in docs or .inc file.

Hoping we can get this demo image boot-up this week… I gotta demo this week :grimacing:

Cheers,
Nitesh

Hi @ndivecha,

Got the bitbake -e dump, thanks. Looking a bit at it, it seems that especially microchip-headless-image is just huge. I usually do my tests on core-image-minimal to cut down build time. Once this boots, the rest is quite easy. By now I’ve a kind-of replica of the build, and both kernel and device tree get installed to /boot:

jd@j-kaitain:~/builds/sam/build$ ls -alh t/boot/
total 9.3M
drwxr-xr-x  2 root root 4.0K Mar  9  2018 .
drwxr-xr-x 21 root root 4.0K May 12 16:12 ..
-rw-r--r--  1 root root  44K Mar  9  2018 at91-sama7g5ek.dtb
-rwxr-xr-x  1 root root 4.6M Mar  9  2018 sama7g5ek.itb
-rwxr-xr-x  1 root root 3.6K Mar  9  2018 sama7g5ek.its
-rwxr-xr-x  1 root root 1.3K Mar  9  2018 sama7g5ek_i2s0_pcm5102a.dtbo
-rwxr-xr-x  1 root root 1.4K Mar  9  2018 sama7g5ek_i2s0_proto.dtbo
-rwxr-xr-x  1 root root 4.2K Mar  9  2018 sama7g5ek_isc_imx219.dtbo
-rwxr-xr-x  1 root root 2.7K Mar  9  2018 sama7g5ek_isc_imx274.dtbo
-rwxr-xr-x  1 root root 1.4K Mar  9  2018 sama7g5ek_pdmc0.dtbo
-rwxr-xr-x  1 root root 1.8K Mar  9  2018 sama7g5ek_wilc3000.dtbo
lrwxrwxrwx  1 root root   41 Mar  9  2018 zImage -> zImage-6.1.22-linux4microchip-2023.04-rc4
-rw-r--r--  1 root root 4.6M Mar  9  2018 zImage-6.1.22-linux4microchip-2023.04-rc4

I’ll send you the image by mail so you can give it a try.

For IMAGE_INSTALL and KERNEL_IMAGETYPE, those are generic Yocto variables, they apply to any build, not just Mender. Thats why we do not replicate their documentation - you can find the Yocto docs for them here and here.

Greetz,
Josef