DarkElvenAngel
Posts: 384
Joined: Tue Mar 20, 2018 9:53 pm

Missing libfdt.so

Fri Mar 27, 2020 1:17 am

Hello everyone,

I'm hoping someone may have come across this problem before. My dtoverlays aren't working.
I ran ldd /usr/bin/dtoverlay

Code: Select all

      libdtovl.so => /usr/lib/libdtovl.so (0xb6ec4000)
      libfdt.so => not found
      libc.so.6 => /lib/libc.so.6 (0xb6d82000)
      /lib/ld-linux-armhf.so.3 (0xb6edb000)
      libfdt.so => not found
I built this in Buildroot I'm just not sure what I missed checking off. I thought it was a bug in the last version I used as it too was giving issues in this area.

I searched the forum here and found one mention of this library but it's 8 years old so useless. I checked my Raspbian Buster and Stretch installations neither have or need this library.

Any insight would be greatly appreciated.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8076
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Missing libfdt.so

Fri Mar 27, 2020 10:31 am

Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8076
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Missing libfdt.so

Fri Mar 27, 2020 10:32 am

Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

DarkElvenAngel
Posts: 384
Joined: Tue Mar 20, 2018 9:53 pm

Re: Missing libfdt.so

Fri Mar 27, 2020 12:24 pm

6by9,

Sorry if this should be obvious, I read through the make file for the upstream release and it looks like this should work.

Code: Select all

make libfdt
Will that build the missing library if I did that from a Raspbian Buster install. Or do I have to use the Buildroot cross compiler?

Thanks

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8076
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Missing libfdt.so

Fri Mar 27, 2020 12:39 pm

DarkElvenAngel wrote:
Fri Mar 27, 2020 12:24 pm
Will that build the missing library if I did that from a Raspbian Buster install. Or do I have to use the Buildroot cross compiler?
Normally cloning userland, installing cmake, and running the ./buildme script.
It looks like dtoverlay is normally building libfdt statically. I have build/lib/libfdt.a. Where did your dtoverlay binary come from?

I've cloned https://github.com/dgibson/dtc.git, run make, and libfdt-1.5.0.so is sitting in the libfdt directory. That may work for you.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

DarkElvenAngel
Posts: 384
Joined: Tue Mar 20, 2018 9:53 pm

Re: Missing libfdt.so

Fri Mar 27, 2020 3:19 pm

I built the busybox 2.2020 long-term version

I dug through the output directory and I found that the missing library was built but not copied.

I keep having the same problem when I use Buildroot the overlay doesn't seem to work.

Now when I run dtoverlay -l

Code: Select all

* Failed to find overlays directory
Any idea what to do next?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8076
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Missing libfdt.so

Fri Mar 27, 2020 3:40 pm

Sorry, no. We support the version in https://github.com/raspberrypi/userland ... /dtoverlay
Whilst busybox may be pulling in from there, I'm afraid you're pretty much on your own or need to ask for assistance fromthe busybox folk.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

DarkElvenAngel
Posts: 384
Joined: Tue Mar 20, 2018 9:53 pm

Re: Missing libfdt.so

Fri Mar 27, 2020 4:57 pm

Thanks for your help,

I'll see what I can sort from the Buildroot community and on my own now that I have working binaries.

How does the overlay folder get generated? Is this perhaps something missing from my kernel or should something be called during boot from userland.

These are next steps to answer, I will post progress here as I make it.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8076
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Missing libfdt.so

Fri Mar 27, 2020 5:47 pm

https://github.com/raspberrypi/userland ... ain.c#L209

Either a -d <directory> option, or it expects to find them in one of the standard locations listed at https://github.com/raspberrypi/userland ... main.c#L63
Have you mounted /boot?
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

DarkElvenAngel
Posts: 384
Joined: Tue Mar 20, 2018 9:53 pm

Re: Missing libfdt.so

Fri Mar 27, 2020 6:16 pm

6by9 wrote:
Fri Mar 27, 2020 5:47 pm
https://github.com/raspberrypi/userland ... ain.c#L209

Either a -d <directory> option, or it expects to find them in one of the standard locations listed at https://github.com/raspberrypi/userland ... main.c#L63
Have you mounted /boot?
So I have progress /boot wasn't mounted by default so I've corrected this and now

Code: Select all

mount: mounting none on /config/device-tree failed: No such file or directory
 * Failed to mount configure - 2
 

DarkElvenAngel
Posts: 384
Joined: Tue Mar 20, 2018 9:53 pm

Re: Missing libfdt.so

Fri Mar 27, 2020 7:04 pm

So now I've got some more progress to share.

If I do this

Code: Select all

mount -t configfs none /sys/kernel/config
And then run dtoverlay -l

Code: Select all

No overlays loaded
So now I need the overlays in config.txt to load somehow...

DarkElvenAngel
Posts: 384
Joined: Tue Mar 20, 2018 9:53 pm

Re: Missing libfdt.so

Fri Mar 27, 2020 10:48 pm

I'm thinking that loading overlays from the config.txt is some rpi-fu that I don't have.

I can now load overlays and I have to manually modprobe kernel drivers.

An example is the i2c1 overlay if I have the i2c kernel module loaded nothing is available until I load the overlay.

There is an automated way for this all to work perhaps udev? I have eudev missing rules?

Back to it.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8076
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Missing libfdt.so

Sat Mar 28, 2020 10:33 am

The firmware parses any dtoverlay or dtparam lines and updates the base DT that is passed to the kernel. The dtoverlay command will not see those things as being loaded as overlays. As per the docs
Only overlays and parameters applied at run-time can be unloaded - an overlay or parameter applied by the firmware becomes "baked in" such that it won't be listed by dtoverlay and can't be removed.
I seem to recall the query previously as to how the relevant kernel modules get loaded via DT. I don't know the answer, but it's probably some udev magic.

Actually I'm going to move this thread to the Device Tree sub-forum as then Phil is likely to join in.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

DarkElvenAngel
Posts: 384
Joined: Tue Mar 20, 2018 9:53 pm

Re: Missing libfdt.so

Sat Mar 28, 2020 3:45 pm

Thank you for moving this thread.

I had a segment fault trying to load the i2c-rtc overlays via the console. I'm not sure how to correctly pass the ds1307 parameters from the command line. I've started writing inittab scripts to load my overlays and kernel modules.

Mostly I need to have the RTC clock working.

I'm slowly making progress here thanks for all your help thus far!

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2656
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Missing libfdt.so

Sat Mar 28, 2020 5:12 pm

As I understand it, when the kernel finds an enabled node in the DT (there are other restrictions, but this will do for now), it takes the values of the "compatible" property and uses them to form a udev event. The udev process receives these events, extracts the strings and looks them up as "of:..." aliases in /lib/modules/<version>/modules.alias. If it finds a matching module it will load it and call the "init" method, which will trigger the kernel to match it against the devices that don't yet have a driver. This loading and matching is also what happens when you use modprobe?

Are you saying that the kernel doesn't automatically load any driver modules, or is just yours that are affected? It's worth looking in modules.alias to see if the compatible strings are present; if not, run "sudo depmod" to update it.

Return to “Device Tree”