[U-Boot] building u-boot x86 with device tree disabled , still refers to device tree function

Simon Glass sjg at chromium.org
Fri Aug 12 19:20:56 CEST 2016


+Bin

Hi,



On 11 August 2016 at 08:36, Ding, ChiX <chix.ding at intel.com> wrote:
> Hi there
> I'm building u-boot as payload for x86 platform. I didn't enable device tree in menuconfig (CONFIG_OF_CONTROL is not set) because I use a board config file coreboot.h. When I built u-boot, it reports error during linking stage : undefined reference to dm_scan_fdt_dev
>
> arch/x86/lib/built-in.o:(.u_boot_list_2_uclass_2_lpc+0x8): undefined reference to `dm_scan_fdt_dev'
> common/built-in.o:(.u_boot_list_2_uclass_2_usb_hub+0x8): undefined reference to `dm_scan_fdt_dev'
> drivers/built-in.o:(.u_boot_list_2_uclass_2_pch+0x8): undefined reference to `dm_scan_fdt_dev'
> drivers/pci/built-in.o:(.u_boot_list_2_uclass_2_pci+0x8): undefined reference to `dm_scan_fdt_dev'
> drivers/spi/built-in.o:(.u_boot_list_2_uclass_2_spi+0x8): undefined reference to `dm_scan_fdt_dev'
> drivers/usb/host/built-in.o:(.u_boot_list_2_uclass_2_usb+0x8): more undefined references to `dm_scan_fdt_dev' follow
> Makefile:1189: recipe for target 'u-boot' failed
>
> I looked at the code and see arch/x86/lib/lpc-uclass.c refers to a function "dm_scan_fdt_dev " which is defined in drivers/core/root.c and it looks like a device tree function
>
>
> UCLASS_DRIVER(lpc) = {
>         .id             = UCLASS_LPC,
>         .name           = "lpc",
>         .post_bind      = dm_scan_fdt_dev,
> };
>
> Because device tree isn't enabled, the function isn't compiled and causes the problem while linking.
> It's only compiled when the following is true
> #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
> If I comment out the line, it would compile and build. But I'm not sure if it's the right way to do it.
>
> Is it normal behavior? I thought that when not enabling device tree, the code shouldn't use device tree function?
> Can anyone help on this please?

Even when running as a coreboot payload you should use DT. As Bin
says, this is described in README.x86 so you should be able to follow
along there.

If there is a specific reason for disabling the DT, can you explain it a bit?

Regards,
Simon


More information about the U-Boot mailing list