[PATCH 6/7] mach-snapdragon: board interface to enforce fdt

Caleb Connolly caleb.connolly at linaro.org
Mon Apr 7 12:02:31 CEST 2025


Hi Jorge,

On 4/7/25 10:19, Jorge Ramirez-Ortiz wrote:
> Some platforms might require the external fdt to boot.

The better way to do this is to use the u-boot-nodtb.bin to build your 
boot image rather than the one which includes the internal FDT. If that 
works I'd prefer it (and it can be mentioned in the build instructions). 
Otherwise it would be good to know what the issue is here.

Kind regards,>
> This change provides a mechanism to the board initializaion code to make
> the requet explicit.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez at oss.qualcomm.com>
> ---
>   arch/arm/mach-snapdragon/board.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> index 2ef936aab75..1bca9dce20f 100644
> --- a/arch/arm/mach-snapdragon/board.c
> +++ b/arch/arm/mach-snapdragon/board.c
> @@ -150,7 +150,13 @@ static void show_psci_version(void)
>   /* We support booting U-Boot with an internal DT when running as a first-stage bootloader
>    * or for supporting quirky devices where it's easier to leave the downstream DT in place
>    * to improve ABL compatibility. Otherwise, we use the DT provided by ABL.
> + *
> + * Alternatively the board can enforce the external fdt.
>    */
> +bool __weak qcom_board_fdt_external(void)
> +{
> +	return false;
> +}
>   int board_fdt_blob_setup(void **fdtp)
>   {
>   	struct fdt_header *fdt;
> @@ -161,6 +167,12 @@ int board_fdt_blob_setup(void **fdtp)
>   	external_valid = fdt && !fdt_check_header(fdt);
>   	internal_valid = !fdt_check_header(*fdtp);
>   
> +	if (qcom_board_fdt_external() && external_valid) {
> +		debug("Using external FDT\n");
> +		*fdtp = fdt;
> +		goto out;
> +	}
> +
>   	/*
>   	 * There is no point returning an error here, U-Boot can't do anything useful in this situation.
>   	 * Bail out while we can still print a useful error message.
> @@ -178,6 +190,7 @@ int board_fdt_blob_setup(void **fdtp)
>   		*fdtp = fdt;
>   	}
>   
> +out:
>   	/*
>   	 * Parse the /memory node while we're here,
>   	 * this makes it easy to do other things early.

-- 
Caleb (they/them)



More information about the U-Boot mailing list