  #define CONFIG_SYS_BOOTCOUNT_BE
  
  /* USB gadget RNDIS */
-@@ -274,9 +275,7 @@
+@@ -274,9 +273,7 @@
  					"-(NAND.file-system)"
  #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x000c0000
  #undef CONFIG_ENV_IS_NOWHERE

 	"run findfdt; " \
 	"run distro_bootcmd"
 
@@ -135,8 +136,8 @@
 		"root=${ramroot} " \
 		"rootfstype=${ramrootfstype}\0" \
 	"loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
-	"loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
-	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+	"loadimage=load ${mender_uboot_root} ${loadaddr} ${bootdir}/${bootfile}\0" \
+	"loadfdt=load ${mender_uboot_root} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
 	"mmcloados=run args_mmc; " \
 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
 			"if run loadfdt; then " \
@@ -226,7 +227,7 @@
 
 /* Bootcount using the RTC block */
 #define CONFIG_BOOTCOUNT_LIMIT

From 23d7802eecc8c21471df83fbe18f4d6be9310eec Mon Sep 17 00:00:00 2001
From: Kristian Amlie <kristian.amlie@mender.io>
Date: Fri, 12 Aug 2016 10:13:46 +0200
Subject: [PATCH] BBB: Use Mender boot code for selecting boot device and
 partition.

Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
---
 include/configs/am335x_evm.h      | 29 +++++++++++++----------------
 include/configs/ti_armv7_common.h |  2 +-
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 6ebe0b3..0157f97 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -69,9 +69,8 @@
 
 #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
 	"bootcmd_" #devtypel #instance "=" \
-	"setenv mmcdev " #instance"; "\
-	"setenv bootpart " #instance":2 ; "\
-	"run mmcboot\0"
+	"run mmcboot; " \
+	"run mender_try_to_recover\0"
 
 #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
 	#devtypel #instance " "
@@ -93,6 +92,7 @@
 	func(DHCP, dhcp, na)
 
 #define CONFIG_BOOTCOMMAND \
