[U-Boot] [PATCH v2 24/29] riscv: store device tree passed by prior boot stage in environment

Alexander Graf agraf at suse.de
Tue Oct 30 13:19:29 UTC 2018



On 30.10.18 13:55, Lukas Auer wrote:
> The device tree passed by the prior boot stage can be used to boot
> Linux. Store it as environment variable "prior_stage_dtb", so that it
> can be used as part of the boot command.
> 
> Signed-off-by: Lukas Auer <lukas.auer at aisec.fraunhofer.de>
> ---
> 
> Changes in v2:
> - New patch
> 
>  arch/Kconfig                          | 1 +
>  arch/riscv/cpu/cpu.c                  | 7 +++++++
>  arch/riscv/include/asm/u-boot-riscv.h | 1 +
>  3 files changed, 9 insertions(+)
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 9fdd2f7e66..883e4a9308 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -74,6 +74,7 @@ config RISCV
>  	imply MTD
>  	imply TIMER
>  	imply CMD_DM
> +	imply ARCH_MISC_INIT
>  
>  config SANDBOX
>  	bool "Sandbox"
> diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
> index d9f820c44c..e06a8c6bab 100644
> --- a/arch/riscv/cpu/cpu.c
> +++ b/arch/riscv/cpu/cpu.c
> @@ -53,3 +53,10 @@ int print_cpuinfo(void)
>  
>  	return 0;
>  }
> +
> +int arch_misc_init(void)
> +{
> +	env_set_hex("prior_stage_dtb", prior_stage_fdt_address);

Please reuse one of the many other variable names we have for this
already, such as "fdtaddr".

One thing I would always recommend is that if you have a prior stage DT
passed on to U-Boot is that U-Boot makes use of that (CONFIG_OF_BOARD).
That again means that the DT is already available in $fdtcontroladdr and
there is very little use for yet another env variable.


Alex

> +
> +	return 0;
> +}
> diff --git a/arch/riscv/include/asm/u-boot-riscv.h b/arch/riscv/include/asm/u-boot-riscv.h
> index 49febd5881..937b2682dc 100644
> --- a/arch/riscv/include/asm/u-boot-riscv.h
> +++ b/arch/riscv/include/asm/u-boot-riscv.h
> @@ -13,6 +13,7 @@
>  
>  /* cpu/.../cpu.c */
>  int cleanup_before_linux(void);
> +int arch_misc_init(void);
>  
>  /* board/.../... */
>  int board_init(void);
> 


More information about the U-Boot mailing list