pub enum ComposefsCmdline<ObjectID: FsVerityHashValue> {
V2 {
digest: ObjectID,
insecure: bool,
},
V1 {
digest: ObjectID,
insecure: bool,
},
}Expand description
A composefs kernel argument identifying which EROFS image to mount at boot.
Two variants exist to distinguish EROFS format versions:
ComposefsCmdline::V2: V2 EROFS — eithercomposefs=<digest>(legacy shorthand) orcomposefs.digest=v2-<hash>-<lg>:<digest>(explicit form)ComposefsCmdline::V1: V1 EROFS —composefs.digest=v1-<hash>-<lg>:<digest>
The initramfs checks for composefs.digest= first (accepting both v1 and v2
descriptors), then falls back to the legacy composefs= shorthand.
Multiple composefs.digest= entries may appear on the cmdline (different
format/algorithm combinations); the initramfs tries each in order, mounting
the first image that exists.
NOTE: The equivalent parsing logic in bootc’s crates/initramfs/src/lib.rs must be
kept in sync with this file manually, since bootc does not yet depend on composefs-boot
directly.
Variants§
V2
V2 EROFS image: embedded as composefs=<hex-digest> in the UKI cmdline.
The insecure flag, when true, means the digest is prefixed with ?
(e.g. composefs=?<hex>), making fs-verity verification optional.
Fields
digest: ObjectIDThe fs-verity hash of the EROFS image.
V1
V1 EROFS image: embedded as composefs.digest=v1-<hash>-<lg>:<hex-digest> in the UKI cmdline.
The value encodes the algorithm, e.g. composefs.digest=v1-sha256-12:<hex>
or composefs.digest=v1-sha512-12:<hex>.
The insecure flag, when true, means the value is prefixed with ?
(e.g. composefs.digest=?v1-sha512-12:<hex>), making fs-verity verification optional.
Implementations§
Source§impl<ObjectID: FsVerityHashValue> ComposefsCmdline<ObjectID>
impl<ObjectID: FsVerityHashValue> ComposefsCmdline<ObjectID>
Sourcepub fn digest(&self) -> &ObjectID
pub fn digest(&self) -> &ObjectID
Returns a reference to the hex digest, regardless of variant.
Useful for looking up the image in composefs/images/<digest>.
Sourcepub fn validate_digest<'a>(
&self,
acceptable: impl IntoIterator<Item = &'a ObjectID>,
) -> Result<&ObjectID>where
ObjectID: 'a,
pub fn validate_digest<'a>(
&self,
acceptable: impl IntoIterator<Item = &'a ObjectID>,
) -> Result<&ObjectID>where
ObjectID: 'a,
Validates that this UKI cmdline’s digest matches one of the acceptable boot image digests.
With dual V1+V2 EROFS, a single composefs image is stored as two boot
EROFS serializations with distinct digests; a UKI is sealed carrying
exactly one of them. This accepts the UKI if its digest matches ANY of
acceptable. Returns the matched (UKI’s own) digest on success.
Sourcepub fn is_insecure(&self) -> bool
pub fn is_insecure(&self) -> bool
Returns whether this karg is in insecure mode (fs-verity verification skipped).
Sourcepub fn new_v2(digest: ObjectID, insecure: bool) -> Self
pub fn new_v2(digest: ObjectID, insecure: bool) -> Self
Constructs a V2 cmdline value (composefs=<hex>).
Sourcepub fn new_v1(digest: ObjectID, insecure: bool) -> Self
pub fn new_v1(digest: ObjectID, insecure: bool) -> Self
Constructs a V1 cmdline value (composefs.digest=v1-<hash>-<lg>:<hex>).
Sourcepub fn from_cmdline(cmdline: &str) -> Result<Option<Self>>
pub fn from_cmdline(cmdline: &str) -> Result<Option<Self>>
Parses a ComposefsCmdline from a kernel command line string.
Scans for composefs.digest= tokens first (→ ComposefsCmdline::V1). Multiple
such tokens may appear on the cmdline (different algorithms); the first one whose
format descriptor matches the ObjectID algorithm is returned. Then falls back to
composefs= (→ ComposefsCmdline::V2). Returns None if no matching token is
present.
§Errors
Returns an error if a matching karg is found but the hex digest cannot be parsed
for the given ObjectID type.
Sourcepub fn to_cmdline_arg(&self) -> String
pub fn to_cmdline_arg(&self) -> String
Renders this value as a kernel command line fragment.
ComposefsCmdline::V1(secure) →"composefs.digest=v1-<hash>-<lg>:<hex>"ComposefsCmdline::V1(insecure) →"composefs.digest=?v1-<hash>-<lg>:<hex>"ComposefsCmdline::V2(secure) →"composefs=<hex>"ComposefsCmdline::V2(insecure) →"composefs=?<hex>"
Trait Implementations§
Source§impl<ObjectID: Clone + FsVerityHashValue> Clone for ComposefsCmdline<ObjectID>
impl<ObjectID: Clone + FsVerityHashValue> Clone for ComposefsCmdline<ObjectID>
Source§fn clone(&self) -> ComposefsCmdline<ObjectID>
fn clone(&self) -> ComposefsCmdline<ObjectID>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<ObjectID: Debug + FsVerityHashValue> Debug for ComposefsCmdline<ObjectID>
impl<ObjectID: Debug + FsVerityHashValue> Debug for ComposefsCmdline<ObjectID>
impl<ObjectID: Eq + FsVerityHashValue> Eq for ComposefsCmdline<ObjectID>
Source§impl<ObjectID: PartialEq + FsVerityHashValue> PartialEq for ComposefsCmdline<ObjectID>
impl<ObjectID: PartialEq + FsVerityHashValue> PartialEq for ComposefsCmdline<ObjectID>
Source§fn eq(&self, other: &ComposefsCmdline<ObjectID>) -> bool
fn eq(&self, other: &ComposefsCmdline<ObjectID>) -> bool
self and other values to be equal, and is used by ==.