From ab424dd74098de8e8704c238d305f0983016c8cf Mon Sep 17 00:00:00 2001
From: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
Date: Wed, 22 Mar 2017 11:48:58 +0100
Subject: [PATCH 2/3] Forward-port parabola patch

Like in the original patch:
- The default boot partition is changed
- The kernel image name has been changed to comply with parabola naming
- An initrd path has been added
- A base directory where to find the dtb has been added.
  Here's are the sed scripts that I ran to help do that:
  sed 's#setenv fdtbase #setenv fdtbase ${fdtdir}/#g' -i include/configs/am335x_evm.h
  sed 's#setenv fdtfile #setenv fdtfile ${fdtdir}/#g' -i include/configs/am335x_evm.h

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
---
 include/configs/am335x_evm.h | 47 +++++++++++++++++++++++---------------------
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 399b25f47a..1a7d3e88a3 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -105,10 +105,13 @@
 	DEFAULT_LINUX_BOOT_ENV \
 	DEFAULT_MMC_TI_ARGS \
 	DEFAULT_FIT_TI_ARGS \
-	"bootpart=0:2\0" \
+	"bootpart=0:1\0" \
 	"bootdir=/boot\0" \
-	"bootfile=zImage\0" \
+	"bootfile=vmlinuz-linux-libre\0" \
+	"ramdiskfile=initramfs-linux-libre.img\0" \
 	"fdtfile=undefined\0" \
+	"fdtdir=/boot/dtbs/linux-libre\0" \
+	"rdfile=initramfs-linux-libre.img\0" \
 	"console=ttyO0,115200n8\0" \
 	"partitions=" \
 		"uuid_disk=${uuid_gpt_disk};" \
@@ -141,50 +144,50 @@
 	"findfdt="\
 		"echo board_name=[$board_name] ...; " \
 		"if test $board_name = A335BONE; then " \
-			"setenv fdtfile am335x-bone.dtb; setenv fdtbase am335x-bone; fi; " \
+			"setenv fdtfile ${fdtdir}/am335x-bone.dtb; setenv fdtbase ${fdtdir}/am335x-bone; fi; " \
 		"if test $board_name = A335BNLT; then " \
 			"echo board_rev=[$board_rev] ...; " \
 			"if test $board_rev = GH01; then " \
-				"setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack; " \
+				"setenv fdtfile ${fdtdir}/am335x-boneblack.dtb; setenv fdtbase ${fdtdir}/am335x-boneblack; " \
 			"elif test $board_rev = BBG1; then " \
-				"setenv fdtfile am335x-bonegreen.dtb; setenv fdtbase am335x-bonegreen; " \
+				"setenv fdtfile ${fdtdir}/am335x-bonegreen.dtb; setenv fdtbase ${fdtdir}/am335x-bonegreen; " \
 			"elif test $board_rev = BP00; then " \
-				"setenv fdtfile am335x-pocketbone.dtb; setenv fdtbase am335x-pocketbone; " \
+				"setenv fdtfile ${fdtdir}/am335x-pocketbone.dtb; setenv fdtbase ${fdtdir}/am335x-pocketbone; " \
 			"elif test $board_rev = GW1A; then " \
-				"setenv fdtfile am335x-bonegreen-wireless.dtb; setenv fdtbase am335x-bonegreen-wireless; " \
+				"setenv fdtfile ${fdtdir}/am335x-bonegreen-wireless.dtb; setenv fdtbase ${fdtdir}/am335x-bonegreen-wireless; " \
 			"elif test $board_rev = AIA0; then " \
-				"setenv fdtfile am335x-abbbi.dtb; setenv fdtbase am335x-abbbi; " \
+				"setenv fdtfile ${fdtdir}/am335x-abbbi.dtb; setenv fdtbase ${fdtdir}/am335x-abbbi; " \
 			"elif test $board_rev = EIA0; then " \
-				"setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack; " \
+				"setenv fdtfile ${fdtdir}/am335x-boneblack.dtb; setenv fdtbase ${fdtdir}/am335x-boneblack; " \
 			"elif test $board_rev = SE0A; then " \
-				"setenv fdtfile am335x-sancloud-bbe.dtb; setenv fdtbase am335x-sancloud-bbe; " \
+				"setenv fdtfile ${fdtdir}/am335x-sancloud-bbe.dtb; setenv fdtbase ${fdtdir}/am335x-sancloud-bbe; " \
 			"elif test $board_rev = ME06; then " \
-				"setenv fdtfile am335x-bonegreen.dtb; setenv fdtbase am335x-bonegreen; " \
+				"setenv fdtfile ${fdtdir}/am335x-bonegreen.dtb; setenv fdtbase ${fdtdir}/am335x-bonegreen; " \
 			"elif test $board_rev = M10A; then " \
-				"setenv fdtfile am335x-vsc8531bbb.dtb; setenv fdtbase am335x-vsc8531bbb; " \
+				"setenv fdtfile ${fdtdir}/am335x-vsc8531bbb.dtb; setenv fdtbase ${fdtdir}/am335x-vsc8531bbb; " \
 			"else " \
-				"setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack; " \
+				"setenv fdtfile ${fdtdir}/am335x-boneblack.dtb; setenv fdtbase ${fdtdir}/am335x-boneblack; " \
 			"fi; " \
 		"fi; " \
 		"if test $board_name = BBG1; then " \
-			"setenv fdtfile am335x-bonegreen.dtb; setenv fdtbase am335x-bonegreen; fi; " \
+			"setenv fdtfile ${fdtdir}/am335x-bonegreen.dtb; setenv fdtbase ${fdtdir}/am335x-bonegreen; fi; " \
 		"if test $board_name = BBBW; then " \
-			"setenv fdtfile am335x-boneblack-wireless.dtb; setenv fdtbase am335x-boneblack-wireless; fi; " \
+			"setenv fdtfile ${fdtdir}/am335x-boneblack-wireless.dtb; setenv fdtbase ${fdtdir}/am335x-boneblack-wireless; fi; " \
 		"if test $board_name = BBBL; then " \
-			"setenv fdtfile am335x-boneblue.dtb; setenv fdtbase am335x-boneblue; fi; " \
+			"setenv fdtfile ${fdtdir}/am335x-boneblue.dtb; setenv fdtbase ${fdtdir}/am335x-boneblue; fi; " \
 		"if test $board_name = SBBE; then " \
-			"setenv fdtfile am335x-sancloud-bbe.dtb; setenv fdtbase am335x-sancloud-bbe; fi; " \
+			"setenv fdtfile ${fdtdir}/am335x-sancloud-bbe.dtb; setenv fdtbase ${fdtdir}/am335x-sancloud-bbe; fi; " \
 		"if test $board_name = A33515BB; then " \
-			"setenv fdtfile am335x-evm.dtb; fi; " \
+			"setenv fdtfile ${fdtdir}/am335x-evm.dtb; fi; " \
 		"if test $board_name = A335X_SK; then " \
-			"setenv fdtfile am335x-evmsk.dtb; fi; " \
+			"setenv fdtfile ${fdtdir}/am335x-evmsk.dtb; fi; " \
 		"if test $board_name = A335_ICE; then " \
-			"setenv fdtfile am335x-icev2.dtb; fi; " \
+			"setenv fdtfile ${fdtdir}/am335x-icev2.dtb; fi; " \
 		"if test $fdtfile = undefined; then " \
 			"setenv board_name A335BNLT; " \
 			"setenv board_rev EMMC; " \
-			"setenv fdtbase am335x-boneblack-emmc-overlay; " \
-			"setenv fdtfile am335x-boneblack-emmc-overlay.dtb; " \
+			"setenv fdtbase ${fdtdir}/am335x-boneblack-emmc-overlay; " \
+			"setenv fdtfile ${fdtdir}/am335x-boneblack-emmc-overlay.dtb; " \
 		"fi; \0" \
 	"init_console=" \
 		"if test $board_name = A335_ICE; then "\
-- 
2.12.1

