Changes in pi/pi-kernel DTB handling

Dear Ubuntu Core Raspberry Pi community,

The latest snapd 2.50 release (that is currently being released) contains a new feature that allows the gadget snap to reference DTB files that are part of the kernel snap. This fixes a long-standing issue that formerly required synchronous kernel and DTB updates.

The snapd version for this feature is in its stable channel, while the required pi gadget and pi-kernel kernel snaps are currently in their respective beta channels. If you wish to test this feature, please switch to the beta channels for the pi/pi-kernel and refresh your snaps. We welcome all feedback on the forum.

Important: for devices using a custom gadget with the pi-kernel, ensure the following is added to snapcraft.yaml or meta/snap.yaml:

assumes: [kernel-assets]

The above ensures the gadget is only refreshed when a new enough version of snapd is already in use.

In addition, the pi-kernel now declares that it provides “dtbs” assets in its “meta/kernel.yaml”. This means any custom gadgets need a corresponding consuming declaration in their “meta/gadget.yaml”.

The pi-kernel layout for the “dtbs/” folder is slightly different for arm64 and armhf architectures:

For arm64:

--- a/gadget.yaml
+++ b/gadget.yaml
@@ -10,6 +9,10 @@ volumes:
         type: 0C
         size: 1200M
         content:
+          - source: $kernel:dtbs/dtbs/broadcom/
+            target: /
+          - source: $kernel:dtbs/dtbs/overlays/
+            target: /overlays
           - source: boot-assets/
             target: /
       - name: ubuntu-boot

And for armhf:

--- a/gadget.yaml
+++ b/gadget.yaml
@@ -10,6 +9,8 @@ volumes:
         type: 0C
         size: 1200M
         content:
+          - source: $kernel:dtbs/dtbs/
+              target: /
           - source: boot-assets/
               target: /
       - name: ubuntu-boot

Technical details:

The kernel snap can now declare in its meta/kernel.yaml that it contains “assets” that should be updated in sync with the kernel. This could look like this:

assets:
 <name>:
   update: true 
   content:
a.bin
...

A gadget can now reference these kernel assets in the meta/gadget.yaml of the gadget like this:

volumes:
 Pi:
  Schema: mbr
  Structure:
Name: ubuntu-boot
Content:
    - source: $kernel:<name>/a.bin
      Target: ...
    - source: b.bin
      Target: ...

Note that a kernel that declares an asset with “update: true” requires a gadget that puts at least one of these assets into place via a gadget $kernel: reference.

4 Likes