[PATCH 28/28] ARM: at91: sama5d27-giantboard: add default environment/bbu

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jul 1 05:11:22 EDT 2020


The board only has SD-Card as storage. Add a barebox update handler to
flash barebox to it, as well as an nv.boot.default=mmc1 to boot from it.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/boards/sama5d27-giantboard/Makefile    |  2 ++
 arch/arm/boards/sama5d27-giantboard/board.c     | 17 +++++++++++++++++
 .../defaultenv-giantboard/nv/boot.default       |  1 +
 arch/arm/dts/at91-sama5d27_giantboard.dts       |  6 ++++++
 4 files changed, 26 insertions(+)
 create mode 100644 arch/arm/boards/sama5d27-giantboard/board.c
 create mode 100644 arch/arm/boards/sama5d27-giantboard/defaultenv-giantboard/nv/boot.default

diff --git a/arch/arm/boards/sama5d27-giantboard/Makefile b/arch/arm/boards/sama5d27-giantboard/Makefile
index b08c4a93ca27..f5869c483978 100644
--- a/arch/arm/boards/sama5d27-giantboard/Makefile
+++ b/arch/arm/boards/sama5d27-giantboard/Makefile
@@ -1 +1,3 @@
 lwl-y += lowlevel.o
+obj-y += board.o
+bbenv-y += defaultenv-giantboard
diff --git a/arch/arm/boards/sama5d27-giantboard/board.c b/arch/arm/boards/sama5d27-giantboard/board.c
new file mode 100644
index 000000000000..1d4453ede35b
--- /dev/null
+++ b/arch/arm/boards/sama5d27-giantboard/board.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <init.h>
+#include <envfs.h>
+#include <bbu.h>
+
+static int giantboard_device_init(void)
+{
+	bbu_register_std_file_update("microSD", BBU_HANDLER_FLAG_DEFAULT,
+				     "/mnt/mmc1.0/barebox.bin",
+				     filetype_arm_barebox);
+
+	defaultenv_append_directory(defaultenv_giantboard);
+
+	return 0;
+}
+device_initcall(giantboard_device_init);
diff --git a/arch/arm/boards/sama5d27-giantboard/defaultenv-giantboard/nv/boot.default b/arch/arm/boards/sama5d27-giantboard/defaultenv-giantboard/nv/boot.default
new file mode 100644
index 000000000000..646f435652ef
--- /dev/null
+++ b/arch/arm/boards/sama5d27-giantboard/defaultenv-giantboard/nv/boot.default
@@ -0,0 +1 @@
+mmc1
diff --git a/arch/arm/dts/at91-sama5d27_giantboard.dts b/arch/arm/dts/at91-sama5d27_giantboard.dts
index 6ba094c3da1a..2ba3ff217101 100644
--- a/arch/arm/dts/at91-sama5d27_giantboard.dts
+++ b/arch/arm/dts/at91-sama5d27_giantboard.dts
@@ -25,6 +25,12 @@
 
 	chosen {
 		stdout-path = &uart1;
+
+		environment {
+			compatible = "barebox,environment";
+			device-path = &sdmmc1;
+			file-path = "barebox.env";
+		};
 	};
 
 	leds {
-- 
2.27.0




More information about the barebox mailing list