lib/sysroot: Support /usr/lib/modules/$kver for kernel/initramfs

This is the new Fedora kernel standard layout; it has the advantage
of being in `/usr` like `/usr/lib/ostree-boot`, but it's not OSTree
specific.

Further, I think in practice forcing tree builders to compute the checksum is an
annoying stumbling block; since we already switched to e.g. computing checksums
always when doing pulls, the cost of doing another checksum for the
kernel/initramfs is tiny. The "bootcsum" becomes more of an internal
implementation detail.

Now, there is a transition; my current thought for this is that rpm-ostree will
change to default to injecting into both `/usr/lib/ostree-boot` and
`/usr/lib/modules`, and stop doing `/boot`, then maybe next year say we drop the
`/usr/lib/ostree-boot` by default.

A twist here is that the default Fedora kernel RPM layout (and what's in
rpm-ostree today) includes a kernel but *not* an initramfs in
`/usr/lib/modules`. If we looked only there, we'd just find the kernel. So we
need to look in both, and then special case this - pick the legacy layout if we
have `/usr/lib/modules` but not an initramfs.

While here, rework the code to have an `OstreeKernelLayout` struct which makes
dealing with all of the variables nicer.

Closes: #1079
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-08-18 17:34:36 +00:00
1 parent 984d22303d
commit 3ab0d5e664
5 files changed
+364 -128

No files matched your search

+7 -2
View File
@@ -43,8 +43,13 @@ to a filesystem tree that represents the underlying basis of a
deployment. For short, we will call this the "tree", to
distinguish it from the concept of a deployment.
First, the tree must include a kernel stored as
`vmlinuz(-.*)?-$checksum` in either `/boot` or `/usr/lib/ostree-boot`.
First, the tree must include a kernel (and optionally an initramfs). The
current standard locations for these are `/usr/lib/modules/$kver/vmlinuz` and
`/usr/lib/modules/$kver/initramfs`. The "boot checksum" will be computed
automatically. This follows the current Fedora kernel layout, and is
the current recommended path. However, older versions of libostree don't
support this; you may need to also put kernels in the previous (legacy)
paths, which are `vmlinuz(-.*)?-$checksum` in either `/boot` or `/usr/lib/ostree-boot`.
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