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

Upcoming Device Tree changes

Fri Mar 11, 2016 8:02 pm

Consider this advance warning of some upcoming changes to Device Tree usage on Raspberry Pi:
  • 1) The use of whitespace as a delimiter in dtoverlay and dtparam lines is deprecated and will cease to work shortly - stick to commas; the utility of being able to put whitespace in a parameter value outweighs the syntax flexibility. In other words,

    Code: Select all

    dtoverlay=foo,param1=long name with spaces,param2=another one
    will set two parameters (param1 and param2) not 6 (param1, name, with spaces, param2 and one).

    2) A friendly reminder - don't include the "-overlay" when loading an overlay. This will stop working in the near future when...

    3) We will shortly release a kernel with Dynamic Device Tree enabled. This will allow the loading (and unloading) of overlays at runtime, using a "dtoverlay" command. For some overlays this will work well, while for others it will be a one way trip - you can load but not unload. As part of this change the internal format of the overlay files has to be modified slightly, so to facilitate switching back and forth around the changeover point a new format for overlay filenames will be introduced: "myoverlay-overlay.dtb" will become "myoverlay.dtbo". This allows old and new overlays to coexist in the same /boot folder. A tag on the kernel image indicating if it supports Dynamic DT will tell the firmware which variant to look for.

User avatar
DougieLawson
Posts: 35823
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Upcoming Device Tree changes

Fri Mar 11, 2016 9:52 pm

Hi Phil, is that going in BRANCH=next first? Seven out of ten of my raspberries are running with that.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

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

Re: Upcoming Device Tree changes

Sat Mar 12, 2016 9:03 am

Yes - it will go into rpi-4.4.y, which will be released as BRANCH=next initially. I'm not anticipating any observable change for users who don't try the dtoverlay command. The switch to 4.4 for all users will happen shortly afterwards, assuming no problems - again, I'm not expecting any.

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

Re: Upcoming Device Tree changes

Sat Mar 12, 2016 8:56 pm

As discussed, the kernel changes supporting Dynamic Device Tree are now in rpi-4.4.y. A BRANCH=next update will probably happen in the next few days. A precompiled "dtoverlay" command is available here, and a required shared library here; the source for both will be available in the userland repo soon. Use the command much as you would the dtoverlay config.txt directive:

Code: Select all

Usage:
  dtoverlay <overlay> [<param>=<val>...]
                           Add an overlay (with parameters)
  dtoverlay -r <overlay>   Remove an overlay
  dtoverlay -l             List active overlays
  dtoverlay -a             List all overlays (marking the active)
  dtoverlay -h             Show this usage message
  dtoverlay -h <overlay>   Display help on an overlay
A dtparam command may appear later for patching parameters in the base DTBs.

There are no guarantees that all overlays will work well when dynamically loaded (or, more likely, unloaded). If you have any kernel panics that you think can be attributed to the kernel changes then please create a new github issue. Otherwise, for issues regarding individual overlays, can you comment here initially.

Updated with shared library link.

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

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 9:10 am

We pushed an experimental build including these patches last night. If you have backed up your data and are happy with a higher level of risk than the already slightly risky "sudo rpi-update", you can try "sudo BRANCH=next rpi-update" which will get you a Linux 4.4 kernel including the Dynamic Device Tree support. See the previous post for details of the dtoverlay command and where to get it.

User avatar
richardski
Posts: 13
Joined: Fri Mar 22, 2013 1:51 am
Location: MARLBOROUGH, Wiltshire, UK
Contact: Website

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 10:02 am

I am getting:

0curl: (60) SSL certificate problem: certificate is not yet valid

when using rpi-update:)

Richard

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 10:17 am

Ran into a problem straight away...
I have a Pi zero with an enc28j60 module which was running happily on 4.4.5 (updated with BRANCH=next a couple of days ago). It uses a fixed IP address.
After running rpi-update today I cannot connect to it anymore. It's running completely headless, but when I connected a screen I could not see eth0 coming up.

I can't connect a keyboard (wireless kb dongle has wandered off to a dark corner of the house, I think), so I decided to start with a fresh Jessie Lite.
Updated first to 4.4.5 (just before the latest dtoverlay commit) with

Code: Select all

sudo rpi-update 73eaed044ef7b58ecf81a8b164ea09c59fab9c7a
Reboot and ethernet is still working.
Then updated to latest version with

Code: Select all

sudo BRANCH=next rpi-update
and the problem returns.

Next thing I will try is to use the enc28j60 on a Pi1 or Pi2 so that I can log in and check the logs.

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 10:19 am

richardski wrote:I am getting:

0curl: (60) SSL certificate problem: certificate is not yet valid

when using rpi-update:)

Richard
Check the date /time on your Pi.

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

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 10:33 am

I agree about the time & date.

@DirkS - Thanks for trying, and I'm sorry to hear it isn't working for you. Is it possible that you have included "-overlay" in the dtoverlay directive, or perhaps you are using spaces as separators? It should look like this:

Code: Select all

dtoverlay=enc28j60,int_pin=25,speed=12000000
where both int_pin and speed are optional and I've shown the defaults.

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 10:48 am

PhilE wrote:I agree about the time & date.

@DirkS - Thanks for trying, and I'm sorry to hear it isn't working for you. Is it possible that you have included "-overlay" in the dtoverlay directive, or perhaps you are using spaces as separators? It should look like this:

Code: Select all

dtoverlay=enc28j60,int_pin=25,speed=12000000
where both int_pin and speed are optional and I've shown the defaults.
No, I used

Code: Select all

dtoverlay=enc28j60
I did some more testing.
I tried it with a Pi2B and checked the vcdbg messages. It simply says

Code: Select all

001339.447: Failed to load overlay 'enc28j60'
Just for fun I changed config.txt to

Code: Select all

dtoverlay=enc28j60-overlay.dtb
and it works again.
I also tried without .dtb at the end and that fails.

Seems to be a problem with resolving the name of the overlay (?)

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 11:01 am

PhilE wrote:As discussed, the kernel changes supporting Dynamic Device Tree are now in rpi-4.4.y. A BRANCH=next update will probably happen in the next few days. A precompiled "dtoverlay" command is available here,
Now that I can get connected again I downloaded the program.
When I run it (from my home directory) I get the error message

Code: Select all

./dtoverlay: error while loading shared libraries: libdtovl.so: cannot open shared object file: No such file or directory

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

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 11:13 am

I'll look into the overlay resolution/loading problem.

You can grab the shared library here.

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 11:23 am

PhilE wrote:I'll look into the overlay resolution/loading problem.

You can grab the shared library here.
Cheers Phil.

On to the next problem :D
Running

Code: Select all

dtoverlay -l
I get

Code: Select all

mount: none is already mounted or /sys/kernel/config busy
* Failed to mount configfs - 2
Mounted devices:

Code: Select all

[email protected]:~$ mount
/dev/mmcblk0p2 on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=242508k,nr_inodes=60627,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

User avatar
DougieLawson
Posts: 35823
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 1:11 pm

It looks like the latest BRANCH=next rpi-update is "poisonous" for folks with the "official" touchscreen. It booted OK, but the mouse pointer won't move and dmesg | grep -i ft5406 gets no results.

I've reverted my RPi3B to 73eaed044ef7b58ecf81a8b164ea09c59fab9c7a
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 2:02 pm

DougieLawson wrote:It looks like the latest BRANCH=next rpi-update is "poisonous" for folks with the "official" touchscreen. It booted OK, but the mouse pointer won't move and dmesg | grep -i ft5406 gets no results.

I've reverted my RPi3B to 73eaed044ef7b58ecf81a8b164ea09c59fab9c7a
If it's loaded with a dtoverlay in config.txt then it's probably the same issue that I have with the enc28j60 (see above)

User avatar
DougieLawson
Posts: 35823
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 2:51 pm

There's no overlay for the "official" screen, it just does some GPU black magic when the H/W detects it.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

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

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 2:54 pm

No - actually it loads the rpi-ft5406 and rpi-backlight overlays automatically, along with starting a task to read the touch information.

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

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 3:01 pm

@DirkS - that configfs output suggests that it is already mounted but that the device-tree part isn't present. What do the following show?

Code: Select all

ls /sys/kernel/config
uname -a
Thanks for your co-operation.

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 3:19 pm

PhilE wrote:@DirkS - that configfs output suggests that it is already mounted but that the device-tree part isn't present. What do the following show?

Code: Select all

ls /sys/kernel/config
uname -a
Thanks for your co-operation.

Code: Select all

[email protected]:~$ uname -a
Linux raspi01 4.4.5+ #856 Sat Mar 12 22:10:36 GMT 2016 armv6l GNU/Linux
[email protected]:~$ ls /sys/kernel/config
[email protected]:~$
Not a lot...

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 3:47 pm

@Phil
I tested with the 'fresh' Jessie Lite card I created this morning, updated with BRANCH=next.

Code: Select all

Linux raspberrypi 4.4.5+ #856 Sat Mar 12 22:10:36 GMT 2016 armv6l GNU/Linux
Result in Pi Zero: /sys/kernel/config is empty and 'dtoverlay' returns the error
Result in Pi2B: /sys/kernel/config/device-tree exists and dtoverlay runs without error.
Pi3B: same as Pi2B, no problems.
PiB (rev 000e): same result as Pi Zero

HTH
Dirk

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

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 4:05 pm

Ah, that's making more sense. On a PiZero the kernel is built using bcmrpi_defconfig, which is missing one option - CONFIG_OF_CONFIGFS. WIthout that, you don't get the device-tree directory inside /sys/kernel/config. That still doesn't explain the overlay loading problem since the kernel.img is still tagged with the DDTK flag (although arguably it shouldn't be).

What does "md5sum /boot/overlays/enc28j60*" show? I get:

Code: Select all

18e1331267fcbc9c1325f60d53c20640  /boot/overlays/enc28j60.dtbo
50a0c9d7238553115a684e0374227747  /boot/overlays/enc28j60-overlay.dtb

User avatar
DougieLawson
Posts: 35823
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 4:05 pm

PhilE wrote:No - actually it loads the rpi-ft5406 and rpi-backlight overlays automatically, along with starting a task to read the touch information.
That's what I said, it does some black magic.

Anyhow, it doesn't work with 4.4.5-v7+ #856.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 4:27 pm

PhilE wrote:What does "md5sum /boot/overlays/enc28j60*" show? I get:

Code: Select all

18e1331267fcbc9c1325f60d53c20640  /boot/overlays/enc28j60.dtbo
50a0c9d7238553115a684e0374227747  /boot/overlays/enc28j60-overlay.dtb

Code: Select all

50a0c9d7238553115a684e0374227747  /boot/overlays/enc28j60-overlay.dtb
I don't have a dtbo file... Odd, I can see them in the firmware repos, but rpi-update doesn't install them.

I manually downloaded enc28j60.dtbo and hey presto: it's working again with 'dtparam=enc28j60'
So it seems that rpi-update is the culprit here.

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

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 4:33 pm

Cool - I think that now explains all the odd behaviour you have seen. I've pushed a patch adding the missing config option to bcmrpi_defconfig, I'll raise the matter of rpi-update failing to install the new overlays (*), and I'll ask nicely if we can respin BRANCH=next.

Thanks again.

(*) Are there really no *.dtbo files? Is there space left on the device?

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Upcoming Device Tree changes

Sun Mar 13, 2016 4:50 pm

PhilE wrote:(*) Are there really no *.dtbo files? Is there space left on the device?
No .dtbo files to be seen at all and I would hope that 2GB free space would be enough ;)

The dtbo files are actually downloaded, but not copied to /boot/overlays.
I had a quick look at rpi-update and it does indeed look as if it's only handling dtb files.

Return to “Device Tree”