Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,57 @@ Write complete: 5120.00 MB in 281.23s (18.21 MB/s)
Compression ratio: 9.80x
```

### OCI Images

`fls` can pull OCI images from registries and flash them either to a block device
or to fastboot partitions.

#### Flash an OCI image to a block device

Use `from-url` with an `oci://` prefix:

```bash
fls from-url \
-u "$REGISTRY_USER" \
-p "$REGISTRY_PASS" \
"oci://quay.io/org/image:latest" \
/dev/mmcblk1
```

#### Flash an OCI image via fastboot

`fls fastboot` pulls the OCI image, extracts partition images, and flashes them
using the system `fastboot` CLI:

```bash
fls fastboot oci://quay.io/org/image:latest
```

To avoid using `/tmp` for fastboot extraction, set `FLS_TMP_DIR` to a directory
on persistent storage (default is `/var/lib/fls`).

If the OCI manifest includes
`automotive.sdv.cloud.redhat.com/default-partitions` (comma-separated),
`fls fastboot` flashes only those partitions by default. Otherwise it flashes
all annotated partitions.

Provide explicit partition mappings when the OCI image contains multiple files:

```bash
fls fastboot oci://quay.io/org/image:latest \
-t boot_a:boot_a.simg \
-t system_a:system_a.simg
```

When `-t` is provided, `fls` applies those mappings on top of the OCI layer
annotations and includes those partitions in the flash set (e.g., add
`-t vbmeta_a:vbmeta_a.simg` to flash vbmeta). If the image lacks annotations,
it falls back to looking for the specified files directly in the image.

Registry credentials can be provided with `-u/--username` and `-p/--password`
(`FLS_REGISTRY_PASSWORD` env var is supported for the password). Both are
required for authenticated access.

## Command Options

### `fls from-url`
Expand Down
52 changes: 52 additions & 0 deletions src/fls/automotive.rs
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better suited for the jumpstarter driver...

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//! CentOS Automotive Suite OCI constant
//!

/// OCI annotation keys used by automotive images for partition mapping
pub mod annotations {
pub const PARTITION_ANNOTATION: &str = "automotive.sdv.cloud.redhat.com/partition";

pub const DECOMPRESSED_SIZE: &str = "automotive.sdv.cloud.redhat.com/decompressed-size";

pub const TARGET: &str = "automotive.sdv.cloud.redhat.com/target";

pub const ARCH: &str = "automotive.sdv.cloud.redhat.com/arch";

pub const DISTRO: &str = "automotive.sdv.cloud.redhat.com/distro";

pub const MULTI_LAYER: &str = "automotive.sdv.cloud.redhat.com/multi-layer";

pub const PARTS: &str = "automotive.sdv.cloud.redhat.com/parts";

/// Comma-separated list of default partitions to flash
pub const DEFAULT_PARTITIONS: &str = "automotive.sdv.cloud.redhat.com/default-partitions";
}

pub mod targets {
pub const RIDESX4: &str = "ridesx4";
pub const AUTOSD: &str = "autosd";
}

/// Extract partition name from layer annotations
pub fn extract_partition_name(
layer_annotations: &std::collections::HashMap<String, String>,
) -> Option<String> {
layer_annotations
.get(annotations::PARTITION_ANNOTATION)
.cloned()
}

/// Extract decompressed size from layer annotations
pub fn extract_decompressed_size(
layer_annotations: &std::collections::HashMap<String, String>,
) -> Option<u64> {
layer_annotations
.get(annotations::DECOMPRESSED_SIZE)
.and_then(|s| s.parse().ok())
}

/// Extract target platform from OCI annotations
pub fn extract_target_from_annotations(
manifest_annotations: &std::collections::HashMap<String, String>,
) -> Option<String> {
manifest_annotations.get(annotations::TARGET).cloned()
}
Loading