Fat D
Posts: 32
Joined: Wed Feb 12, 2014 4:22 pm

No /proc/device-tree on self-compiled kernel

Thu Jan 29, 2015 9:52 am

I am running into a little trouble with the 3.18 kernel.
When I install it via rpi-update, I get a nice working version with a /proc/device-tree folder structure. All fine so far.
However, the version I want device tree support in the first place is that I have an STMPE610 breakout board from Adafruit for a touchscreen controller, and while the Linux driver for STMPE touchscreens can be compiled as a module, it is dependent on the STMPE multi-function device driver, which is not.

So I have decided to take the plunge, did a git clone https://github.com/raspberrypi/linux.git, fetched the .config from the rpi-update kernel using zcat /proc/config.gz > ./.config in the linux folder, did make oldconfig and make menuconfig to enable the STMPE driver, then make to compile the whole thing. Copied linux/arch/arm/boot/zImage (and linux/arch/arm/boot/Image in a separate attempt) to /boot/kernel.img, made sure config.txt does not load a different kernel file (and does not disable the device tree), did a sudo make modules_install, rebooted, and suddenly, no more /proc/device-tree.

In my troubleshooting, I even skipped the menuconfig step to just compile a plain source-built kernel, still no success. The source is branch rpi-3.18.y, checked out about two or three days ago, so nothing too old. Still, I can get a device tree from the pre-built image, but not from images I build myself. What am I doing wrong?

ross
Posts: 13
Joined: Fri Aug 26, 2011 8:18 pm

Re: No /proc/device-tree on self-compiled kernel

Thu Jan 29, 2015 11:36 am

Copied linux/arch/arm/boot/zImage (and linux/arch/arm/boot/Image in a separate attempt) to /boot/kernel.img
There appears to be an extra step in the middle that isn't necessarily obvious without careful reading of the device-tree documentation (it is easy to miss)
https://github.com/raspberrypi/document ... spberry-pi
To guard against this, the loader checks kernel images for DT-compatibility, which is marked by a trailer added by the mkknlimg utility
So - do this:

Code: Select all

./mkknlimg zImage kernel.img
... and then copy kernel.img into your /boot partition. (If you don't run this script over the zImage / kernel.img file then the bootloader (start.elf) will assume that the kernel isn't a DT-enabled one and so you won't get /proc/devicetree appearing).

If you look at the output of dmesg then the 7th line or so you should see a line starting 'Machine model'. If it says something like "Raspberry Pi B+" then you are DT-enabled ("2708" is the non-DT equivalent).

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

Re: No /proc/device-tree on self-compiled kernel

Thu Jan 29, 2015 11:59 am

What have you got in /boot/config.txt?

Try adding

Code: Select all

device_tree=bcm2708-rpi-b.dtb
# or device_tree=bcm2708-rpi-b-plus.dtb for a B+
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.

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: No /proc/device-tree on self-compiled kernel

Thu Jan 29, 2015 12:31 pm

Thanks for that tip, ross.

Fat D
Posts: 32
Joined: Wed Feb 12, 2014 4:22 pm

Re: No /proc/device-tree on self-compiled kernel

Thu Jan 29, 2015 12:38 pm

ross wrote:
Copied linux/arch/arm/boot/zImage (and linux/arch/arm/boot/Image in a separate attempt) to /boot/kernel.img
There appears to be an extra step in the middle that isn't necessarily obvious without careful reading of the device-tree documentation (it is easy to miss)
https://github.com/raspberrypi/document ... spberry-pi
To guard against this, the loader checks kernel images for DT-compatibility, which is marked by a trailer added by the mkknlimg utility
So - do this:

Code: Select all

./mkknlimg zImage kernel.img
... and then copy kernel.img into your /boot partition. (If you don't run this script over the zImage / kernel.img file then the bootloader (start.elf) will assume that the kernel isn't a DT-enabled one and so you won't get /proc/devicetree appearing).

If you look at the output of dmesg then the 7th line or so you should see a line starting 'Machine model'. If it says something like "Raspberry Pi B+" then you are DT-enabled ("2708" is the non-DT equivalent).
Thanks, that worked. I read something about the trailer, but I thought that was part of the kbuild process. I was mistaken. Device tree works, now I just need to get GPIO interrupts working for the STMPE.

notro
Posts: 695
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Re: No /proc/device-tree on self-compiled kernel

Thu Jan 29, 2015 4:57 pm

I use this overlay for the Adafruit pitft: https://github.com/notro/fbtft/blob/mas ... verlay.dts

Fat D
Posts: 32
Joined: Wed Feb 12, 2014 4:22 pm

Re: No /proc/device-tree on self-compiled kernel

Fri Jan 30, 2015 11:20 pm

notro wrote:I use this overlay for the Adafruit pitft: https://github.com/notro/fbtft/blob/mas ... verlay.dts
Thanks, that was just what I consulted to get the IRQ working. From a device tree perspective, the type of bus does not matter if the driver is the same, and the chip used by PiTFT is identical except for the bus.
This is getting a bit off-topic though, this has nothing to do with how to create a kernel image that supports the device tree.

Return to “Advanced users”