diff mbox

[U-Boot,v4] env: export fdt_blob to the environment variable

Message ID 1444956291-18944-1-git-send-email-thomas@wytron.com.tw
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Thomas Chou Oct. 16, 2015, 12:44 a.m. UTC
Export fdt_blob to the environment variable. So that we may
use it to boot Linux.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v2
  move the code to per board, nios2-generic.c.
v3
  move the code to generic, board_r.c.
v4
  use fdtcontroladdr as Simon suggested.

 common/board_r.c       | 3 +++
 doc/README.fdt-control | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Simon Glass Oct. 18, 2015, 12:47 p.m. UTC | #1
On 15 October 2015 at 18:44, Thomas Chou <thomas@wytron.com.tw> wrote:
> Export fdt_blob to the environment variable. So that we may
> use it to boot Linux.
>
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v2
>   move the code to per board, nios2-generic.c.
> v3
>   move the code to generic, board_r.c.
> v4
>   use fdtcontroladdr as Simon suggested.
>
>  common/board_r.c       | 3 +++
>  doc/README.fdt-control | 5 ++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Oct. 18, 2015, 11:16 p.m. UTC | #2
On 18 October 2015 at 06:47, Simon Glass <sjg@chromium.org> wrote:
> On 15 October 2015 at 18:44, Thomas Chou <thomas@wytron.com.tw> wrote:
>> Export fdt_blob to the environment variable. So that we may
>> use it to boot Linux.
>>
>> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
>> ---
>> v2
>>   move the code to per board, nios2-generic.c.
>> v3
>>   move the code to generic, board_r.c.
>> v4
>>   use fdtcontroladdr as Simon suggested.
>>
>>  common/board_r.c       | 3 +++
>>  doc/README.fdt-control | 5 ++++-
>>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/common/board_r.c b/common/board_r.c
index a4facf8..d722081 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -449,6 +449,9 @@  static int initr_env(void)
 		env_relocate();
 	else
 		set_default_env(NULL);
+#ifdef CONFIG_OF_CONTROL
+	setenv_addr("fdtcontroladdr", gd->fdt_blob);
+#endif
 
 	/* Initialize from environment */
 	load_addr = getenv_ulong("loadaddr", 16, load_addr);
diff --git a/doc/README.fdt-control b/doc/README.fdt-control
index e6d5ed0..29fd56a 100644
--- a/doc/README.fdt-control
+++ b/doc/README.fdt-control
@@ -156,7 +156,10 @@  address of the fdt binary blob, and will override either of the options.
 Be aware that this environment variable is checked prior to relocation,
 when only the compiled-in environment is available. Therefore it is not
 possible to define this variable in the saved SPI/NAND flash
-environment, for example (it will be ignored).
+environment, for example (it will be ignored). After relocation, this
+variable will be set to the address of the newly relocated fdt blob.
+It is read-only and cannot be changed. It can optionally be used to
+control the boot process of Linux with bootm/bootz commands.
 
 To use this, put something like this in your board header file: