[U-Boot] [PATCH] nios2: export fdt_blob to the environment variable

Thomas Chou thomas at wytron.com.tw
Fri Oct 9 13:46:57 CEST 2015


Export fdt_blob to the environment variable. So that we may
use it to boot Linux.

Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
---
 arch/nios2/lib/Makefile         |  1 +
 arch/nios2/lib/misc.c           | 16 ++++++++++++++++
 include/configs/nios2-generic.h |  1 +
 3 files changed, 18 insertions(+)
 create mode 100644 arch/nios2/lib/misc.c

diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile
index e35d2e9..05deea4 100644
--- a/arch/nios2/lib/Makefile
+++ b/arch/nios2/lib/Makefile
@@ -8,3 +8,4 @@
 obj-y	+= cache.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-y	+= libgcc.o
+obj-y	+= misc.o
diff --git a/arch/nios2/lib/misc.c b/arch/nios2/lib/misc.c
new file mode 100644
index 0000000..2cf8574
--- /dev/null
+++ b/arch/nios2/lib/misc.c
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2015 Thomas Chou <thomas at wytron.com.tw>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int misc_init_r(void)
+{
+	setenv_addr("fdt_blob", gd->fdt_blob);
+
+	return 0;
+}
diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index e4b5abb..14ab37f 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -15,6 +15,7 @@
 #include "../board/altera/nios2-generic/custom_fpga.h" /* fpga parameters */
 #define CONFIG_BOARD_NAME "nios2-generic" /* custom board name */
 #define CONFIG_BOARD_EARLY_INIT_F	/* enable early board-spec. init */
+#define CONFIG_MISC_INIT_R
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 #define CONFIG_SYS_NIOS_SYSID_BASE	CONFIG_SYS_SYSID_BASE
-- 
2.1.4



More information about the U-Boot mailing list