AfterMidnight
Posts: 5
Joined: Tue Jun 30, 2020 6:53 pm

looking for information on kernel programming and device trees for the Raspberry Pi 4 in Ubuntu

Tue Jun 30, 2020 7:53 pm

I'm attempting to come up to speed with kernel programming for the Raspberry Pi 4 in Ubuntu, starting from zero, but having extensive experience with kernel programming in a different operating system in the past.

I've learned a modest amount by general web searches, reading source code, inserting debugging/logging code into the kernel, etc., but it's a laborious "fog-of-war" process, and the signal-to-noise ratio is pretty low.

Here are specific areas in which I could use help:

(1) device tree usage in the Ubuntu Pi 4 kernel - There's good info here at raspberrypi.org on device trees in general and the Pi OS's use of them, but the ubuntu kernel's device tree files look different, and it would be super-helpful to have some basic orientation to navigating the ocean of information there.

(2) pointers to forums or other venues for learning and asking questions - There are loci of expertise about the raspberry pi, about the linux kernel, and about the ubuntu distro, but the kinds of questions I'd like to ask are very much at the periphery of each of these different venues. I suspect there are very few people who work at the intersection; where would be the best place to post a question and have them see it?

User avatar
waveform80
Posts: 359
Joined: Mon Sep 23, 2013 1:28 pm
Location: Manchester, UK
Contact: Website Twitter

Re: looking for information on kernel programming and device trees for the Raspberry Pi 4 in Ubuntu

Thu Jul 02, 2020 1:59 pm

AfterMidnight wrote:
Tue Jun 30, 2020 7:53 pm
(2) pointers to forums or other venues for learning and asking questions - There are loci of expertise about the raspberry pi, about the linux kernel, and about the ubuntu distro, but the kinds of questions I'd like to ask are very much at the periphery of each of these different venues. I suspect there are very few people who work at the intersection; where would be the best place to post a question and have them see it?
On the subject of your second question: not sure if this is any help, but I'm the Ubuntu Foundations team member with responsibility for the Pi. I try and keep up with the content of various forums, including this one but typically on a rather "patchy" basis; I check in here about once a week and burn through any topics I think I can lend a hand with. Hence, if you post here I can flag stuff for the attention of the kernel team when relevant (they're obviously the ones that deal primarily with our device-trees), or try and get answers to questions you may have.

I also monitor Pi-related tags on askubuntu.com (but for some reason the notifications on there have stopped working for me - I need to look into that), and of course Launchpad itself (although that's less useful for questions than bug reports).

Finally, there's always good ol' IRC on which the #raspberrypi and #ubuntu-kernel channels on Freenode may be of interest.
AfterMidnight wrote:
Tue Jun 30, 2020 7:53 pm
(1) device tree usage in the Ubuntu Pi 4 kernel - There's good info here at raspberrypi.org on device trees in general and the Pi OS's use of them, but the ubuntu kernel's device tree files look different, and it would be super-helpful to have some basic orientation to navigating the ocean of information there.
Sorry for the reverse order! On this question, the Pi's own pages (which you've already found) are probably the most relevant resource I know of, though Ubuntu does currently lack the userland package (with the dtoverlay and dtmerge utilities). That's currently winding its way through a review process for inclusion in groovy and I'll be SRUing that to focal once that's done (relevant bug is LP: #1883111) so hopefully we should have most of the same tools as Raspbian before long.
Author of / contributor to a few pi related things (picamera, Sense HAT emulator, gpio-zero, piwheels, etc.), and currently a software engineer at Canonical responsible for Ubuntu Server and Core on the Raspberry Pi.

AfterMidnight
Posts: 5
Joined: Tue Jun 30, 2020 6:53 pm

Re: looking for information on kernel programming and device trees for the Raspberry Pi 4 in Ubuntu

Mon Jul 06, 2020 8:57 pm

Thanks very much for your reply!

At the moment, I have a very basic question:
I pulled a copy of the the source tree for the pi 4 a while back, maybe a couple of months ago, by doing this:
git clone --depth=1 git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal -b raspi
I was able to build and run kernels and see changes I'd made working.

Today, I tried to build and run a kernel I'd built but failed, because I had updated my system in the interim, and uname -r now prints 5.4.0-1012-raspi, whereas my source tree is still at version 1009.

A git pull yielded no results, and, looking at:
https://git.launchpad.net/~ubuntu-kerne ... l/?h=raspi
I see that the raspi branch hasn't changed in 8 weeks and is still at version 1009.
Apparently, the kernels in the system updates are being built from more recent source than the git repo+branch I'm pulling from.

How would you advise me to proceed?
I could just change the number in the first line of debian.raspi/changelog, but that would be a pretty ugly hack.
[ edit: I tried just changing the number - it breaks the build ]
I'd prefer to be building a kernel that matches the one in the most recent system update.

AfterMidnight
Posts: 5
Joined: Tue Jun 30, 2020 6:53 pm

Re: looking for information on kernel programming and device trees for the Raspberry Pi 4 in Ubuntu

Tue Jul 07, 2020 8:41 am

I dug up a saved image I'd made of an installation of the system with kernel version 1008, and I am thus able to run kernels I've built from 1009-vintage source again, but I'd still like to know where to get the most recent version of the kernel source. Thanks.

Return to “Ubuntu”