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

Peter Robinson pbrobinson at gmail.com
Tue Jan 9 04:08:07 UTC 2018


On Tue, Jan 9, 2018 at 3:37 AM, Peter Robinson <pbrobinson at gmail.com> wrote:
> 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'

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'


More information about the U-Boot mailing list