diff mbox series

[04/07] fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE

Message ID 1515148197-30234-4-git-send-email-jorge.ramirez-ortiz@linaro.org
State New
Headers show
Series [01/07] db410c: configs: increase gunzip buffer size for the kernel | expand

Commit Message

Jorge Ramirez-Ortiz Jan. 5, 2018, 10:29 a.m. UTC
From: Rob Clark <robdclark@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@gmail.com>
---
 include/fdtdec.h |  3 ++-
 lib/fdtdec.c     | 35 +++++++++++++++++++++++------------
 2 files changed, 25 insertions(+), 13 deletions(-)

Comments

Peter Robinson Jan. 9, 2018, 3:37 a.m. UTC | #1
On Fri, Jan 5, 2018 at 10:29 AM, Jorge Ramirez-Ortiz
<jorge.ramirez-ortiz@linaro.org> wrote:
> From: Rob Clark <robdclark@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@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@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
Peter Robinson Jan. 9, 2018, 4:08 a.m. UTC | #2
On Tue, Jan 9, 2018 at 3:37 AM, Peter Robinson <pbrobinson@gmail.com> wrote:
> On Fri, Jan 5, 2018 at 10:29 AM, Jorge Ramirez-Ortiz
> <jorge.ramirez-ortiz@linaro.org> wrote:
>> From: Rob Clark <robdclark@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@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'

The full output is available here:

The relevant bit for the firefly-3399 is:

  gcc -Wp,-MD,spl/drivers/sysreset/.sysreset_rockchip.o.d  -nostdinc
-isystem /usr/lib/gcc/aarch64-redhat-linux/7/include -Iinclude
-I/builddir/build/BUILD/u-boot-2018.01/include
-I/builddir/build/BUILD/u-boot-2018.01/arch/arm/include -include
/builddir/build/BUILD/u-boot-2018.01/include/linux/kconfig.h
-I/builddir/build/BUILD/u-boot-2018.01/spl/drivers/sysreset
-Ispl/drivers/sysreset -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD
-Wall -Wstrict-prototypes -Wno-format-security -fno-builtin
-ffreestanding -fshort-wchar -Os -fno-stack-protector
-fno-delete-null-pointer-checks -g -fstack-usage
-Wno-format-nonliteral -Werror=date-time -ffunction-sections
-fdata-sections -D__ARM__ -mstrict-align -ffunction-sections
-fdata-sections -fno-common -ffixed-r9 -fno-common -ffixed-x18 -pipe
-march=armv8-a -D__LINUX_ARM_ARCH__=8
-I/builddir/build/BUILD/u-boot-2018.01/arch/arm/mach-rockchip/include
  -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(sysreset_rockchip)"
-D"KBUILD_MODNAME=KBUILD_STR(sysreset_rockchip)" -c -o
spl/drivers/sysreset/sysreset_rockchip.o
/builddir/build/BUILD/u-boot-2018.01/drivers/sysreset/sysreset_rockchip.c
   ld.bfd     -r -o spl/drivers/sysreset/built-in.o
spl/drivers/sysreset/sysreset-uclass.o
spl/drivers/sysreset/sysreset_rockchip.o
   ld.bfd     -r -o spl/drivers/ram/rockchip/built-in.o
spl/drivers/ram/rockchip/sdram_rk3399.o
   ld.bfd     -r -o spl/drivers/ram/built-in.o
spl/drivers/ram/ram-uclass.o spl/drivers/ram/rockchip/built-in.o
   ld.bfd     -r -o spl/drivers/serial/built-in.o
spl/drivers/serial/serial-uclass.o spl/drivers/serial/ns16550.o
   ld.bfd     -r -o spl/drivers/built-in.o spl/drivers/clk/built-in.o
spl/drivers/core/built-in.o spl/drivers/misc/built-in.o
spl/drivers/sysreset/built-in.o spl/drivers/firmware/built-in.o
spl/drivers/mmc/built-in.o spl/drivers/pinctrl/built-in.o
spl/drivers/ram/built-in.o spl/drivers/serial/built-in.o
spl/drivers/block/built-in.o
  (cd spl && ld.bfd   -T u-boot-spl.lds  --gc-sections -Bstatic
--gc-sections  --no-dynamic-linker -Ttext 0xff8c2000
arch/arm/cpu/armv8/start.o --start-group
arch/arm/mach-rockchip/built-in.o arch/arm/cpu/armv8/built-in.o
arch/arm/cpu/built-in.o arch/arm/lib/built-in.o
board/rockchip/evb_rk3399/built-in.o common/spl/built-in.o
common/init/built-in.o common/built-in.o cmd/built-in.o env/built-in.o
lib/built-in.o drivers/built-in.o dts/built-in.o fs/built-in.o
--end-group -L /usr/lib/gcc/aarch64-redhat-linux/7 -lgcc -Map
u-boot-spl.map -o u-boot-spl)
lib/built-in.o: In function `fdtdec_setup':
/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'
make[2]: *** [/builddir/build/BUILD/u-boot-2018.01/scripts/Makefile.spl:343:
spl/u-boot-spl] Error 1
make[1]: *** [/builddir/build/BUILD/u-boot-2018.01/Makefile:1400:
spl/u-boot-spl] Error 2
make[1]: Leaving directory
'/builddir/build/BUILD/u-boot-2018.01/builds/firefly-rk3399'
Jorge Ramirez-Ortiz Jan. 9, 2018, 7:59 a.m. UTC | #3
On 01/09/2018 04:37 AM, Peter Robinson wrote:
>> +#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
>

is this after a clean build?
Peter Robinson Jan. 9, 2018, 8:09 a.m. UTC | #4
On Tue, Jan 9, 2018 at 7:59 AM, Jorge Ramirez
<jorge.ramirez-ortiz@linaro.org> wrote:
> On 01/09/2018 04:37 AM, Peter Robinson wrote:
>
> +#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
>
>
> is this after a clean build?

Yep, the Fedora build process starts from clean for each build.

Peter
Jorge Ramirez-Ortiz Jan. 9, 2018, 8:16 a.m. UTC | #5
On 01/09/2018 09:09 AM, Peter Robinson wrote:
> On Tue, Jan 9, 2018 at 7:59 AM, Jorge Ramirez
> <jorge.ramirez-ortiz@linaro.org> wrote:
>> On 01/09/2018 04:37 AM, Peter Robinson wrote:
>>
>> +#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
>>
>>
>> is this after a clean build?
> Yep, the Fedora build process starts from clean for each build.

if you can, could you try pulling https://github.com/ldts/u-boot 
(patches/v1) ?
it should be the exact same tree after all patches have been applied 
(git am ...)


>
> Peter
Jorge Ramirez-Ortiz Jan. 9, 2018, 9:09 a.m. UTC | #6
On 01/09/2018 09:16 AM, Jorge Ramirez wrote:
> On 01/09/2018 09:09 AM, Peter Robinson wrote:
>> On Tue, Jan 9, 2018 at 7:59 AM, Jorge Ramirez
>> <jorge.ramirez-ortiz@linaro.org> wrote:
>>> On 01/09/2018 04:37 AM, Peter Robinson wrote:
>>>
>>> +#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
>>>
>>>
>>> is this after a clean build?
>> Yep, the Fedora build process starts from clean for each build.
>
> if you can, could you try pulling https://github.com/ldts/u-boot 
> (patches/v1) ?
> it should be the exact same tree after all patches have been applied 
> (git am ...)


I have reapplied the patches on top of master [1], tested db410c and 
db820 and pushed the tree to https://github.com/ldts/u-boot (patches/v1)
will post the three sets again now using my gmail address but AFAICS 
there are no issues. I am a bit surprised you are seeing those (maybe 
you have some different configs and if so, could you share them so I 
test on my side?

thanks!


[1]
commit f3dd87e0b98999a78e500e8c6d2b063ebadf535a
Author: Tom Rini <trini@konsulko.com>
Date:   Mon Jan 8 20:25:29 2018 -0500

     Prepare v2018.01

     Signed-off-by: Tom Rini <trini@konsulko.com>

  Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Peter Robinson Jan. 9, 2018, 9:14 a.m. UTC | #7
>>> On Tue, Jan 9, 2018 at 7:59 AM, Jorge Ramirez
>>> <jorge.ramirez-ortiz@linaro.org> wrote:
>>>>
>>>> On 01/09/2018 04:37 AM, Peter Robinson wrote:
>>>>
>>>> +#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
>>>>
>>>>
>>>> is this after a clean build?
>>>
>>> Yep, the Fedora build process starts from clean for each build.
>>
>>
>> if you can, could you try pulling https://github.com/ldts/u-boot
>> (patches/v1) ?
>> it should be the exact same tree after all patches have been applied (git
>> am ...)
>
>
>
> I have reapplied the patches on top of master [1], tested db410c and db820
> and pushed the tree to https://github.com/ldts/u-boot (patches/v1)
> will post the three sets again now using my gmail address but AFAICS there
> are no issues. I am a bit surprised you are seeing those (maybe you have
> some different configs and if so, could you share them so I test on my side?

The 820c patch set applies cleanly from that branch, I'm just running
the build now to see where it fails. The  upstream config that failed
with the fdtdec patch was firefly-rk3399_defconfig

I'll update this once the process finishes.
Jorge Ramirez-Ortiz Jan. 9, 2018, 9:22 a.m. UTC | #8
On 01/09/2018 10:09 AM, Jorge Ramirez wrote:
> On 01/09/2018 09:16 AM, Jorge Ramirez wrote:
>> On 01/09/2018 09:09 AM, Peter Robinson wrote:
>>> On Tue, Jan 9, 2018 at 7:59 AM, Jorge Ramirez
>>> <jorge.ramirez-ortiz@linaro.org> wrote:
>>>> On 01/09/2018 04:37 AM, Peter Robinson wrote:
>>>>
>>>> +#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
>>>>
>>>>
>>>> is this after a clean build?
>>> Yep, the Fedora build process starts from clean for each build.
>>
>> if you can, could you try pulling https://github.com/ldts/u-boot 
>> (patches/v1) ?
>> it should be the exact same tree after all patches have been applied 
>> (git am ...)
>
>
> I have reapplied the patches on top of master [1], tested db410c and 
> db820 and pushed the tree to https://github.com/ldts/u-boot (patches/v1)
> will post the three sets again now using my gmail address 

argh! forgot to register my gmail address with the ML and after having 
sent more than 10 patches (loop send) the bot wont talk to me again till 
tomorrow :(

rather than re-send using linaro.org and create further confusion I'll 
wait till the bot lets me push the patches again.
in the meantime, would you mind to use my github tree? I can push any 
review fixes there if any.

or we can wait till tomorrow when I can access the mailing list again 
and I will repost using gmail.

sorry about it Peter.
diff mbox series

Patch

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
+
 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)