Boot from MMC1 on Microchip SAMA5d27-SOM1-EK1


By default an image is built for booting from MMC0 . How can I change boot source to MMC1 (change configuration before compiling for at91bootstrap and u-boot-at91)?

I’ve changed boot source of at91bootstrap in meta-atmel/conf/machine/sama5d27-som1-ek-sd.conf file and it’s ok - device boots from microSD card:

AT91Bootstrap 3.8.13 (Tue 15 Oct 2019 01:58:37 PM UTC)

SDHC: fix in place for SAMA5D2 SoM VDDSDMMC over-consumption errata
SD/MMC: Image: Read file u-boot.bin to 0x23f00000
MMC: ADMA supported
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image

U-Boot 2019.04-linux4sam_6.1 (Sep 24 2019 - 17:09:53 +0000)

Crystal frequency:       24 MHz
CPU clock        :      492 MHz
Master clock     :      164 MHz
DRAM:  128 MiB
MMC:   sdio-host@a0000000: 0, sdio-host@b0000000: 1
Loading Environment from MMC... *** Warning - No block device, using default environment

But u-boot still tries to load the environment from MMC0. If I change u-boot configuration in the sama5d27-som1-ek-sd.conf for loading from MMC1 I get the next error (attached log file).

Did the right way I choose for solving this problem (I want to boot the system from MMC1 micro SD card instead MMC0 by default)?
Could you help me with it?

You need to update the device that the Mender integration will use. e.g

MENDER_STORAGE_DEVICE = "/dev/mmcblk1"

This should update all the relevant locations, but further integration effort might be necessary but this will get you on the right track.

Thanks a lot for a quick reply.

got it.

But then there is an error:

include/config_mender.h:73:5: error: #error CONFIG_SYS_MMC_ENV_DEV is not the same as MENDER_UBOOT_STORAGE_DEVICE

After changing CONFIG_SYS_MMC_ENV_DEV there is the same error.

I update these variables in the local.conf file:

MENDER_STORAGE_DEVICE = “/dev/mmcblk1”
CONFIG_SYS_MMC_ENV_DEV = “/dev/mmcblk1”

Any ideas? :slight_smile:

This is an U-Boot variable and this should automatically be set based on value in MENDER_STORAGE_DEVICE. But I am not familiar in this specific board integration and maybe @jorisoffouga might have some additional insights as he has done the integration and might have a board :slight_smile:

In fact this is my integration :wink:, @jorisoffouga duplicated this integration for the sama5d3.

@andrewtimoshenko, it seems you have to `undef`` CONFIG_SYS_MMC_ENV_DEV:

You can check here for an example:

In any case, it seems we have to create a specific patch for this ‘configuration’ with the right defconfig:

Hey guys,

@texierp @mirzak

Thanks a lot for your help.

If someone wants to boot sama5d27 and Mender from microSD, here is a brief manual:

  1. Add to your local.conf file the line:
MENDER_STORAGE_DEVICE = "/dev/mmcblk1"
  1. Add to meta-atmel/conf/machine/sama5d27-som1-ek-sd.conf for a at91bootstrap booting from MMC1:

If you do not, at91bootstrap will still boot from MMC0.

  1. Undefine CONFIG_SYS_MMC_ENV_DEV in the include/configs/at91-sama5_common.h file of the u-boot-at91:
From b51c78c57b95d3074c819ab2257f16dafddaec8c Mon Sep 17 00:00:00 2001
From: andrewtimoshenko <>
Date: Wed, 16 Oct 2019 14:34:27 +0300
Subject: [PATCH] Booting from MMC1 microSD

 include/configs/at91-sama5_common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h
index fc46540a10..1af5dbc02d 100644
--- a/include/configs/at91-sama5_common.h
+++ b/include/configs/at91-sama5_common.h
@@ -41,6 +41,7 @@
 #define CONFIG_ENV_OFFSET		0x2000
 #define CONFIG_ENV_SIZE			0x1000
 /* u-boot env in sd/mmc card */
 #define CONFIG_ENV_SIZE		0x4000

  1. And keep on rocking :slight_smile:

My build configuration:

BB_VERSION           = "1.40.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "sama5d27-som1-ek-sd"
DISTRO               = "poky-atmel"
DISTRO_VERSION       = "2.6.3"
TUNE_FEATURES        = "arm armv7a vfp thumb neon callconvention-hard cortexa5"
TARGET_FPU           = "hard"
meta-yocto-bsp       = "HEAD:e6949336479e611a142834b6d9241514cbaeaf80"
meta-networking      = "thud:9b3b907f30b0d5b92d58c7e68289184fda733d3e"
meta-mender-atmel    = "HEAD:c2f777bdccba7e8c281fdb520cde98b301ac7acd"
meta-mender-demo     = "thud:352cd81fe4dd6e44ba0819da1d8e189109e805e6"
meta-iot-cloud       = "feature/bsp_porting_RLPR-64:c4b12f6ca0ca5a5aa144c543a7464c921fb49efb"
meta-atmel           = "thud:d6773b92ae0805d941493a2950fd167d7bdfff1b"
meta-qt5             = "thud:1520d5b2b2beec5e1c3209d3178219e93ef08bca"

Thanks for sharing @andrewtimoshenko. Maybe this is something that can be integrated in to


Hi guys,
I want to add a new flexcom0 node for UART supporting to the device tree of at91-sama5d27_som1_ek board. I’ve described this node in the arch/arm/boot/dts/at91-sama5d27_som1_ek.dts file, but my changes are not included in the sdimage.

My flexcome0 UART node:

flx0: flexcom@f8034000 {
    compatible = "atmel,sama5d2-flexcom";
    reg = < 0xf8034000 0x200 >;
    clocks = < 0x51 >;
    #address-cells = < 0x01 >;
    #size-cells = < 0x01 >;
    ranges = < 0x00 0xf8034000 0x800 >;
    status = "okay";
    atmel,flexcom-mode = < 0x01 >;
    phandle = < 0xaa >;

    serial@200 {
        compatible = "atmel,at91sam9260-usart";
        reg = < 0x200 0x200 >;
        interrupts = < 0x13 0x04 0x07 >;
        clocks = < 0x51 >;
        clock-names = "usart";
        dmas = < 0x39 0xb004000 0x39 0xc004000 >;
        dma-names = "tx\0rx";
        pinctrl-names = "default";
        pinctrl-0 = < 0x52 >;
        atmel,fifo-size = < 0x20 >;
        status = "okay";
        phandle = < 0xab >;

Is there another way how to include new nodes to the device tree? Could you provide some examples for adding nodes with dt-overlay, perhaps it can be an alternative way for device tree editing?

Hi @andrewtimoshenko,

It is not related to Mender, but anyway, in fact you have to create a patch into your meta layer to include this specific node in your DTS file.

It means a specific ‘bbappend’ of linux-at91 (like this)

1 Like

Thank you anyway @texierp .
Just needs to remember about the cleaning of kernel build directory periodically :slight_smile: