# Beaglebone missing default u-boot environment in MMC

**URL:** <https://hub.mender.io/t/beaglebone-missing-default-u-boot-environment-in-mmc/1505>\
**Category:** General Discussions\
**Tags:** yocto, beaglebone-black, warrior, u-boot\
**Created:** [February 5, 2020, 8:43pm UTC](https://hub.mender.io/t/beaglebone-missing-default-u-boot-environment-in-mmc/1505 "2020-02-05T20:43:52Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![pacpowmatthew](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/pacpowmatthew/32/494_2.png) [@pacpowmatthew](https://hub.mender.io/u/pacpowmatthew)\
**Post date:** [February 11, 2020, 6:12pm UTC](https://hub.mender.io/t/beaglebone-missing-default-u-boot-environment-in-mmc/1505/6 "2020-02-11T18:12:44Z")

</div>

> [@kacf](#):
>
> This also means that we don’t test U-Boot on Beaglebone.

Perhaps we should remove “For U-Boot-based boards, the [integration checklist](https://docs.mender.io/devices/yocto-project/bootloader-support/u-boot/integration-checklist?target=_blank) has been verified.” from the [Beaglebone Black integration page](https://hub.mender.io/t/beaglebone-black/83)?

> [@kacf](#):
>
> You should probably check that `mender_setup` and in particular the `mender_saveenv_canary` code is executed as expected.

From a freshly-flashed Beaglebone (using .sdimg file) I observe

```
U-Boot SPL 2019.01 (Feb 05 2020 - 16:04:48 +0000)
Trying to boot from MMC2
Loading Environment from FAT... Card did not respond to voltage select!
Loading Environment from MMC... *** Warning - bad CRC, using default environment

U-Boot 2019.01 (Feb 05 2020 - 16:04:48 +0000)

CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT... Card did not respond to voltage select!
Loading Environment from MMC... *** Warning - bad CRC, using default environment

<ethaddr> not set. Validating first E-fuse MAC
Net: cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds

```

So we see that it cannot load the environment from MMC due to bad CRC, and that it uses the default env instead. (as expected)

So I experimented with manually running `mender_setup`:

```
=> printenv bootcmd
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

=> printenv mender_setup
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/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_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

=> print mender_saveenv_canary
## Error: "mender_saveenv_canary" not defined

=> run mender_setup
Saving Environment to FAT... Card did not respond to voltage select!
Failed (1)

=> print mender_saveenv_canary
mender_saveenv_canary=1

=> reset
resetting ...

U-Boot SPL 2019.01 (Feb 05 2020 - 16:04:48 +0000)
Trying to boot from MMC2
Loading Environment from FAT... Card did not respond to voltage select!
Loading Environment from MMC... *** Warning - bad CRC, using default environment

U-Boot 2019.01 (Feb 05 2020 - 16:04:48 +0000)

CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT... Card did not respond to voltage select!
Loading Environment from MMC... *** Warning - bad CRC, using default environment

<ethaddr> not set. Validating first E-fuse MAC
Net: cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
=> printenv mender_saveenv_canary
## Error: "mender_saveenv_canary" not defined

```

So it appears that the `saveenv` inside the `mender_setup` command did not actually save the env to MMC flash?

Perhaps I should configure u-boot to disable env FAT support, as it should only be using MMC for my environment? Perhaps that is what is causing the problem with `saveenv`?

Or maybe I should just switch to GRUB as that seems to be the favored approach going forward.

Thanks for your help!

---

_[View the full topic](https://hub.mender.io/t/beaglebone-missing-default-u-boot-environment-in-mmc/1505)._
