Add support for devicetree files alongside the kernel and initramfs

Much like the (optional) initramfs at
`/usr/lib/ostree-boot/initramfs-<SHA256>` or
`/usr/lib/modules/$kver/initramfs` you can now optionally include a
flattened devicetree (.dtb) file alongside the kernel at
`/usr/lib/ostree-boot/devicetree-<SHA256>` or
`/usr/lib/modules/$kver/devicetree`.

This is useful for embedded ARM systems which need the devicetree file
loaded by the bootloader for the kernel to discover and initialise
hardware.  See https://en.wikipedia.org/wiki/Device_tree for more
information.

This patch was mostly produced by copy-pasting code for initramfs handling
and renaming `s/initramfs/devicetree/g`.  It's not beautiful, but it is
fairly straightforward.

It may be useful to extend device-tree support in a number ways in the
future.  Device trees dependant on many details of the hardware they
support.  This makes them unlike kernels, which may support many different
hardware variants as long as the instruction-set matches.  This means that
a ostree tree created with a device-tree in this manner will only boot on
a single model of hardware.  This is sufficient for my purposes, but may
not be for others'.

I've tested this on my NVidia Tegra TK1 device which has u-boot running
in syslinux-compatible mode.

Closes: #1411
Approved by: cgwalters
This commit is contained in:
William Manley authored and Atomic Bot committed 2018-01-16 22:54:53 +00:00
1 parent c5112c25e4
commit 720e2ec9bc
4 files changed
+96 -14

No files matched your search

+1 -1
View File
@@ -95,7 +95,7 @@ collected at any point.
## The /ostree/boot directory
However, we want to optimize for the case where the set of
kernel/initramfs pairs is the same between both the old and new
kernel/initramfs/devicetree sets is the same between both the old and new
deployment lists. This happens when doing an upgrade that does not
include the kernel; think of a simple translation update. OSTree
optimizes for this case because on some systems `/boot` may be on a
+5 -4
View File
@@ -53,10 +53,11 @@ paths, which are `vmlinuz(-.*)?-$checksum` in either `/boot` or `/usr/lib/ostree
The checksum should be a SHA256 hash of the kernel contents; it must be
pre-computed before storing the kernel in the repository. Optionally,
the directory can also contain an initramfs, stored as
`initramfs(-.*)?-$checksum`. If this exists, the checksum must include
both the kernel and initramfs contents. OSTree will use this to
determine which kernels are shared. The rationale for this is to avoid
computing checksums on the client by default.
`initramfs(-.*)?-$checksum` and/or a device tree, stored as
`devicetree(-.*)?-$checksum`. If an initramfs or devicetree exist,
the checksum must include all of the kernel, initramfs and devicetree contents.
OSTree will use this to determine which kernels are shared. The rationale for
this is to avoid computing checksums on the client by default.
The deployment should not have a traditional UNIX `/etc`; instead, it
should include `/usr/etc`. This is the "default configuration". When