[U-Boot] [PATCH 04/07] fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE

Peter Robinson pbrobinson at gmail.com
Tue Jan 9 03:37:56 UTC 2018


On Fri, Jan 5, 2018 at 10:29 AM, Jorge Ramirez-Ortiz
<jorge.ramirez-ortiz at linaro.org> wrote:
> From: Rob Clark <robdclark at gmail.com>
>
> Similar to CONFIG_OF_BOARD, but in this case the fdt is still built by
> u-boot build.  This allows the board to patch the fdt, etc.
>
> In the specific case of dragonboard 410c, we pass the u-boot generated
> fdt to the previous stage of bootloader (by embedding it in the
> u-boot.img that is loaded by lk/aboot), which patches the fdt and passes
> it back to u-boot.
>
> Signed-off-by: Rob Clark <robdclark at gmail.com>
> ---
>  include/fdtdec.h |  3 ++-
>  lib/fdtdec.c     | 35 +++++++++++++++++++++++------------
>  2 files changed, 25 insertions(+), 13 deletions(-)
>
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index 0fb3e07..4afb9ac 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -990,7 +990,8 @@ int fdtdec_setup(void);
>
>  /**
>   * Board-specific FDT initialization. Returns the address to a device tree blob.
> - * Called when CONFIG_OF_BOARD is defined.
> + * Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined
> + * and the board implements it.
>   */
>  void *board_fdt_blob_setup(void);
>
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 30ec6b9..cc3dfd6 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -1272,6 +1272,28 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)
>  # endif
>  #endif
>
> +#if CONFIG_IS_ENABLED(OF_SEPARATE)
> +/*
> + * For CONFIG_OF_SEPARATE, the board may optionally implement this to
> + * provide and/or fixup the fdt.
> + */
> +__weak void *board_fdt_blob_setup(void)
> +{
> +       void *fdt_blob = NULL;
> +#ifdef CONFIG_SPL_BUILD
> +       /* FDT is at end of BSS unless it is in a different memory region */
> +       if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
> +               fdt_blob = (ulong *)&_image_binary_end;
> +       else
> +               fdt_blob = (ulong *)&__bss_end;
> +#else
> +       /* FDT is at end of image */
> +       fdt_blob = (ulong *)&_end;
> +#endif
> +       return fdt_blob;
> +}
> +#endif

For some reason now with 2018.01 I'm getting the following error when
building on Fedora 28

/builddir/build/BUILD/u-boot-2018.01/lib/fdtdec.c:1312: undefined
reference to `board_fdt_blob_setup'
/builddir/build/BUILD/u-boot-2018.01/lib/fdtdec.c:1312:(.text.fdtdec_setup+0x10):
relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
`board_fdt_blob_setup'

I'm going to have a further look into it from my side (could be tweaks
to compile flags etc) but just FYI.

Peter

>  int fdtdec_setup(void)
>  {
>  #if CONFIG_IS_ENABLED(OF_CONTROL)
> @@ -1285,18 +1307,7 @@ int fdtdec_setup(void)
>  #  else
>         gd->fdt_blob = __dtb_dt_begin;
>  #  endif
> -# elif defined CONFIG_OF_SEPARATE
> -#  ifdef CONFIG_SPL_BUILD
> -       /* FDT is at end of BSS unless it is in a different memory region */
> -       if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
> -               gd->fdt_blob = (ulong *)&_image_binary_end;
> -       else
> -               gd->fdt_blob = (ulong *)&__bss_end;
> -#  else
> -       /* FDT is at end of image */
> -       gd->fdt_blob = (ulong *)&_end;
> -#  endif
> -# elif defined(CONFIG_OF_BOARD)
> +# elif defined(CONFIG_OF_BOARD) || defined (CONFIG_OF_SEPARATE)
>         /* Allow the board to override the fdt address. */
>         gd->fdt_blob = board_fdt_blob_setup();
>  # elif defined(CONFIG_OF_HOSTFILE)
> --
> 2.7.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list