  
  #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
  	#devtypel #instance " "
-@@ -90,6 +89,7 @@
+@@ -91,6 +90,7 @@
  	func(DHCP, dhcp, na)
  
  #define CONFIG_BOOTCOMMAND \
 +	"run mender_setup; " \
- 	"run findfdt; " \
- 	"run init_console; " \
- 	"run envboot; " \
-@@ -102,7 +102,6 @@
+ 	"if test ${boot_fit} -eq 1; then "	\
+ 		"run update_to_fit;"	\
+ 	"fi;"	\
+@@ -106,7 +106,6 @@
  	DEFAULT_LINUX_BOOT_ENV \
  	DEFAULT_MMC_TI_ARGS \
- 	"boot_fdt=try\0" \
+ 	DEFAULT_FIT_TI_ARGS \
 -	"bootpart=0:2\0" \
  	"bootdir=/boot\0" \
  	"bootfile=zImage\0" \
  	"fdtfile=undefined\0" \
-@@ -126,9 +125,9 @@
+@@ -130,7 +129,7 @@
  		"${optargs} " \
  		"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" \
 +	"loadramdisk=load ${mender_uboot_root} ${rdaddr} ramdisk.gz\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 " \
-@@ -143,9 +142,9 @@
- 		"else " \
- 			"bootz; " \
- 		"fi;\0" \
--	"mmcboot=mmc dev ${mmcdev}; " \
-+	"mmcboot=mmc dev ${mender_uboot_dev}; " \
- 		"if mmc rescan; then " \
--			"echo SD/MMC found on device ${mmcdev};" \
-+			"echo SD/MMC found on device ${mender_uboot_dev};" \
- 			"run envboot; " \
- 			"if run loadimage; then " \
- 				"run mmcloados;" \
-@@ -208,7 +207,7 @@
+ 	"spiboot=echo Booting from spi ...; " \
+ 		"run spiargs; " \
+ 		"sf probe ${spibusno}:0; " \
+@@ -188,7 +187,7 @@
  #ifndef CONFIG_NOR_BOOT
  /* Bootcount using the RTC block */
  #define CONFIG_BOOTCOUNT_LIMIT

From 8986470842c52823160c96a7d3c09a62fd386158 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      | 30 ++++++++++--------------------
 include/configs/ti_armv7_common.h | 14 +++++++-------
 2 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index ec70b72..a4b0eb4 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -66,9 +66,8 @@
 
 #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
 	"bootcmd_" #devtypel #instance "=" \

+	"importbootenv=echo Importing environment from ${mender_uboot_boot} ...; " \
 		"env import -t ${loadaddr} ${filesize}\0" \
-	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \
-	"loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
-	"loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
-	"envboot=mmc dev ${mmcdev}; " \
+	"loadbootenv=fatload ${mender_uboot_boot} ${loadaddr} ${bootenvfile}\0" \
+	"loadimage=load ${mender_uboot_root} ${loadaddr} ${bootdir}/${bootfile}\0" \
+	"loadfdt=load ${mender_uboot_root} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+	"envboot=mmc dev ${mender_uboot_dev}; " \
 		"if mmc rescan; then " \
-			"echo SD/MMC found on device ${mmcdev};" \
