<commit_before>From e8cdcff366ab7b24d60360ec3bfd9fcc7bdd09cc Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Wed, 2 Mar 2016 13:38:57 +0100
Subject: [PATCH] beaglebone mender specific configuration

---
 include/configs/am335x_evm.h | 136 +++++++++++++++++--------------------------
 1 file changed, 54 insertions(+), 82 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 3cf768e..540a82a 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -46,6 +46,21 @@
 #define CONFIG_CMD_GPT
 #define CONFIG_EFI_PARTITION
 
+#define CONFIG_EXTRA_ENV_SETTINGS_MENDER "bootlimit=1\0" \
+                                  "upgrade_available=0\0" \
+                                  "boot_part=2\0" \
+                                  "altbootcmd=if test ${boot_part} = 2; then setenv boot_part 3; else setenv boot_part 2; fi; setenv upgrade_available 0; saveenv; run bootcmd\0"
+
+#define CONFIG_ENV_IS_IN_FAT            1
+#define FAT_ENV_INTERFACE               "mmc"
+#define FAT_ENV_DEVICE_AND_PART         "0:1"
+#define FAT_ENV_FILE                    "uboot.env"
+#define CONFIG_FAT_WRITE
+
+#undef CONFIG_SYS_PROMPT 
+#define CONFIG_SYS_PROMPT "mender u-boot > "
+
+
 #ifdef CONFIG_NAND
 #define NANDARGS \
 	"mtdids=" MTDIDS_DEFAULT "\0" \
@@ -71,9 +86,11 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	DEFAULT_LINUX_BOOT_ENV \
 	DEFAULT_MMC_TI_ARGS \
+        "bootdelay=3\0" \
 	"boot_fdt=try\0" \
-	"bootpart=0:2\0" \
+	"bootpart=0:1\0" \
 	"bootdir=/boot\0" \
+        "fdtdir=/boot\0" \
 	"bootfile=zImage\0" \
 	"fdtfile=undefined\0" \
 	"console=ttyO0,115200n8\0" \
@@ -98,14 +115,14 @@
 		"source ${loadaddr}\0" \
 	"loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
 	"importbootenv=echo Importing environment from mmc ...; " \
-		"env import -t -r $loadaddr $filesize\0" \
+		"env import -t $loadaddr $filesize\0" \
 	"ramargs=setenv bootargs console=${console} " \
 		"${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" \
+	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}\0" \
 	"mmcloados=run args_mmc; " \
 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
 			"if run loadfdt; then " \
@@ -120,56 +137,43 @@
 		"else " \
 			"bootz; " \
 		"fi;\0" \
-	"mmcboot=mmc dev ${mmcdev}; " \
-		"if mmc rescan; then " \
-			"echo SD/MMC found on device ${mmcdev};" \
-			"if run loadbootscript; then " \
-				"run bootscript;" \
-			"else " \
-				"if run loadbootenv; then " \
-					"echo Loaded environment from ${bootenv};" \
-					"run importbootenv;" \
-				"fi;" \
-				"if test -n $uenvcmd; then " \
-					"echo Running uenvcmd ...;" \
-					"run uenvcmd;" \
-				"fi;" \
-				"if run loadimage; then " \
-					"run mmcloados;" \
-				"fi;" \
-			"fi ;" \
-		"fi;\0" \
-	"spiboot=echo Booting from spi ...; " \
-		"run spiargs; " \
-		"sf probe ${spibusno}:0; " \
-		"sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
-		"bootz ${loadaddr}\0" \
-	"ramboot=echo Booting from ramdisk ...; " \
-		"run ramargs; " \
-		"bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
-	"findfdt="\
-		"if test $board_name = A335BONE; then " \
-			"setenv fdtfile am335x-bone.dtb; fi; " \
-		"if test $board_name = A335BNLT; then " \
-			"setenv fdtfile am335x-boneblack.dtb; fi; " \
-		"if test $board_name = A33515BB; then " \
-			"setenv fdtfile am335x-evm.dtb; fi; " \
-		"if test $board_name = A335X_SK; then " \
-			"setenv fdtfile am335x-evmsk.dtb; fi; " \
-		"if test $fdtfile = undefined; then " \
-			"echo WARNING: Could not determine device tree to use; fi; \0" \
+        "mmcboot=mmc dev ${mmcdev}; " \
+                "if mmc rescan; then " \
+                        "echo SD/MMC found on device ${mmcdev};" \
+                        "if run loadbootenv; then " \
+                                "echo Loaded environment from ${bootenv};" \
+                                "run importbootenv;" \
+                        "fi;" \
+                        "if test -n $cape; then " \
+                                "if test -e mmc ${bootpart} ${fdtdir}/$fdtbase-$cape.dtb; then " \
+                                        "setenv fdtfile $fdtbase-$cape.dtb;" \
+                                "fi;" \
+                                "echo using: $fdtfile...;" \
+                        "fi;" \
+                        "echo Checking if uenvcmd is set ...;" \
+                        "if test -n $uenvcmd; then " \
+                                "echo Running uenvcmd ...;" \
+                                "run uenvcmd;" \
+                        "fi;" \
+                        "echo; echo uenvcmd was not defined in uEnv.txt ...;" \
+                "fi;\0" \
+        "mmcdev=0\0" \
+        "mmcpart=1\0" \
+        CONFIG_EXTRA_ENV_SETTINGS_MENDER \
 	NANDARGS \
 	NETARGS \
 	DFUARGS
 #endif
 
 #define CONFIG_BOOTCOMMAND \
-	"run findfdt; " \
-	"run mmcboot;" \
-	"setenv mmcdev 1; " \
-	"setenv bootpart 1:2; " \
-	"run mmcboot;" \
-	"run nandboot;"
+       "i2c mw 0x24 1 0x3e;" \
+       "setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack;" \
+       "run mmcboot;" \
+       "setenv mmcdev 1; " \
+       "setenv bootpart 1:1; " \
+       "run mmcboot;" \
+       "run nandboot;"
+
 
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550_COM1		0x44e09000	/* Base EVM has UART0 */
@@ -195,9 +199,9 @@
 #define CONFIG_SPL_POWER_SUPPORT
 #define CONFIG_SPL_YMODEM_SUPPORT
 
-/* Bootcount using the RTC block */
+/* Bootcount using the environment */
 #define CONFIG_BOOTCOUNT_LIMIT
-#define CONFIG_BOOTCOUNT_AM33XX
+#define CONFIG_BOOTCOUNT_ENV
 #define CONFIG_SYS_BOOTCOUNT_BE
 
 /* USB gadget RNDIS */
@@ -245,10 +249,7 @@
 					"-(NAND.file-system)"
 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x000c0000
 #undef CONFIG_ENV_IS_NOWHERE
-#define CONFIG_ENV_IS_IN_NAND
-#define CONFIG_ENV_OFFSET		0x001c0000
-#define CONFIG_ENV_OFFSET_REDUND	0x001e0000
-#define CONFIG_SYS_ENV_SECT_SIZE	CONFIG_SYS_NAND_BLOCK_SIZE
+
 /* NAND: SPL related configs */
 #ifdef CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_NAND_AM33XX_BCH
@@ -392,35 +393,6 @@
  * 0x0E0000 - 0x442000 : Linux Kernel
  * 0x442000 - 0x800000 : Userland<commit_msg>MEN-307: BBB: Don't fall back on internal flash if boot fails.<commit_after>From e8cdcff366ab7b24d60360ec3bfd9fcc7bdd09cc Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Wed, 2 Mar 2016 13:38:57 +0100
Subject: [PATCH] beaglebone mender specific configuration

---
 include/configs/am335x_evm.h | 136 +++++++++++++++++--------------------------
 1 file changed, 54 insertions(+), 82 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 3cf768e..540a82a 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -46,6 +46,21 @@
 #define CONFIG_CMD_GPT
 #define CONFIG_EFI_PARTITION
 
+#define CONFIG_EXTRA_ENV_SETTINGS_MENDER "bootlimit=1\0" \
+                                  "upgrade_available=0\0" \
+                                  "boot_part=2\0" \
+                                  "altbootcmd=if test ${boot_part} = 2; then setenv boot_part 3; else setenv boot_part 2; fi; setenv upgrade_available 0; saveenv; run bootcmd\0"
+
+#define CONFIG_ENV_IS_IN_FAT            1
+#define FAT_ENV_INTERFACE               "mmc"
+#define FAT_ENV_DEVICE_AND_PART         "0:1"
+#define FAT_ENV_FILE                    "uboot.env"
+#define CONFIG_FAT_WRITE
+
+#undef CONFIG_SYS_PROMPT 
+#define CONFIG_SYS_PROMPT "mender u-boot > "
+
+
 #ifdef CONFIG_NAND
 #define NANDARGS \
 	"mtdids=" MTDIDS_DEFAULT "\0" \
@@ -71,9 +86,11 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	DEFAULT_LINUX_BOOT_ENV \
 	DEFAULT_MMC_TI_ARGS \
+        "bootdelay=3\0" \
 	"boot_fdt=try\0" \
-	"bootpart=0:2\0" \
+	"bootpart=0:1\0" \
 	"bootdir=/boot\0" \
+        "fdtdir=/boot\0" \
 	"bootfile=zImage\0" \
 	"fdtfile=undefined\0" \
 	"console=ttyO0,115200n8\0" \
@@ -98,14 +115,14 @@
 		"source ${loadaddr}\0" \
 	"loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
 	"importbootenv=echo Importing environment from mmc ...; " \
-		"env import -t -r $loadaddr $filesize\0" \
+		"env import -t $loadaddr $filesize\0" \
 	"ramargs=setenv bootargs console=${console} " \
 		"${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" \
+	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}\0" \
 	"mmcloados=run args_mmc; " \
 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
 			"if run loadfdt; then " \
@@ -120,56 +137,40 @@
 		"else " \
 			"bootz; " \
 		"fi;\0" \
-	"mmcboot=mmc dev ${mmcdev}; " \
-		"if mmc rescan; then " \
-			"echo SD/MMC found on device ${mmcdev};" \
-			"if run loadbootscript; then " \
-				"run bootscript;" \
-			"else " \
-				"if run loadbootenv; then " \
-					"echo Loaded environment from ${bootenv};" \
-					"run importbootenv;" \
-				"fi;" \
-				"if test -n $uenvcmd; then " \
-					"echo Running uenvcmd ...;" \
-					"run uenvcmd;" \
-				"fi;" \
-				"if run loadimage; then " \
-					"run mmcloados;" \
-				"fi;" \
-			"fi ;" \
-		"fi;\0" \
-	"spiboot=echo Booting from spi ...; " \
-		"run spiargs; " \
-		"sf probe ${spibusno}:0; " \
-		"sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
-		"bootz ${loadaddr}\0" \
-	"ramboot=echo Booting from ramdisk ...; " \
-		"run ramargs; " \
-		"bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
-	"findfdt="\
-		"if test $board_name = A335BONE; then " \
-			"setenv fdtfile am335x-bone.dtb; fi; " \
-		"if test $board_name = A335BNLT; then " \
-			"setenv fdtfile am335x-boneblack.dtb; fi; " \
-		"if test $board_name = A33515BB; then " \
-			"setenv fdtfile am335x-evm.dtb; fi; " \
-		"if test $board_name = A335X_SK; then " \
-			"setenv fdtfile am335x-evmsk.dtb; fi; " \
-		"if test $fdtfile = undefined; then " \
-			"echo WARNING: Could not determine device tree to use; fi; \0" \
+        "mmcboot=mmc dev ${mmcdev}; " \
+                "if mmc rescan; then " \
+                        "echo SD/MMC found on device ${mmcdev};" \
+                        "if run loadbootenv; then " \
+                                "echo Loaded environment from ${bootenv};" \
+                                "run importbootenv;" \
+                        "fi;" \
+                        "if test -n $cape; then " \
+                                "if test -e mmc ${bootpart} ${fdtdir}/$fdtbase-$cape.dtb; then " \
+                                        "setenv fdtfile $fdtbase-$cape.dtb;" \
+                                "fi;" \
+                                "echo using: $fdtfile...;" \
+                        "fi;" \
+                        "echo Checking if uenvcmd is set ...;" \
+                        "if test -n $uenvcmd; then " \
+                                "echo Running uenvcmd ...;" \
+                                "run uenvcmd;" \
+                        "fi;" \
+                        "echo; echo uenvcmd was not defined in uEnv.txt ...;" \
+                "fi;\0" \
+        "mmcdev=0\0" \
+        "mmcpart=1\0" \
+        CONFIG_EXTRA_ENV_SETTINGS_MENDER \
 	NANDARGS \
 	NETARGS \
 	DFUARGS
 #endif
 
 #define CONFIG_BOOTCOMMAND \
-	"run findfdt; " \
-	"run mmcboot;" \
-	"setenv mmcdev 1; " \
-	"setenv bootpart 1:2; " \
-	"run mmcboot;" \
-	"run nandboot;"
+       "i2c mw 0x24 1 0x3e;" \
+       "setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack;" \
+       "run mmcboot;" \
+       "reset;"
+
 
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550_COM1		0x44e09000	/* Base EVM has UART0 */
@@ -195,9 +199,9 @@
 #define CONFIG_SPL_POWER_SUPPORT
 #define CONFIG_SPL_YMODEM_SUPPORT
 
-/* Bootcount using the RTC block */
+/* Bootcount using the environment */
 #define CONFIG_BOOTCOUNT_LIMIT
-#define CONFIG_BOOTCOUNT_AM33XX
+#define CONFIG_BOOTCOUNT_ENV
 #define CONFIG_SYS_BOOTCOUNT_BE
 
 /* USB gadget RNDIS */
@@ -245,10 +249,7 @@
 					"-(NAND.file-system)"
 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x000c0000
 #undef CONFIG_ENV_IS_NOWHERE
-#define CONFIG_ENV_IS_IN_NAND
-#define CONFIG_ENV_OFFSET		0x001c0000
-#define CONFIG_ENV_OFFSET_REDUND	0x001e0000
-#define CONFIG_SYS_ENV_SECT_SIZE	CONFIG_SYS_NAND_BLOCK_SIZE
+
 /* NAND: SPL related configs */
 #ifdef CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_NAND_AM33XX_BCH
@@ -392,35 +393,6 @@
  * 0x0E0000 - 0x442000 : Linux Kernel
  * 0x442000 - 0x800000 : Userland
{'fraction_non_alphanumeric': 0.1614015834443835, 'fraction_numerical': 0.04985498157874108, 'mean_word_length': 2.1400443022397244, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4743066', 'n_tokens_mistral': 5579, 'n_tokens_neox': 4999, 'n_words': 1004}