Skip to content

Commit 21bb739

Browse files
committed
initial fastboot
Use the fastboot CLI and add support for flashing from OCI Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
1 parent de377ea commit 21bb739

8 files changed

Lines changed: 1346 additions & 3 deletions

File tree

src/fls/automotive.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//! CentOS Automotive Suite OCI constant
2+
//!
3+
4+
/// OCI annotation keys used by automotive images for partition mapping
5+
pub mod annotations {
6+
pub const PARTITION_PREFIX: &str = "automotive.sdv.cloud.redhat.com/partition=";
7+
8+
pub const PARTITION_ANNOTATION: &str = "automotive.sdv.cloud.redhat.com/partition";
9+
10+
pub const DECOMPRESSED_SIZE: &str = "automotive.sdv.cloud.redhat.com/decompressed-size";
11+
12+
pub const TARGET: &str = "automotive.sdv.cloud.redhat.com/target";
13+
14+
pub const ARCH: &str = "automotive.sdv.cloud.redhat.com/arch";
15+
16+
pub const DISTRO: &str = "automotive.sdv.cloud.redhat.com/distro";
17+
18+
pub const MULTI_LAYER: &str = "automotive.sdv.cloud.redhat.com/multi-layer";
19+
20+
pub const PARTS: &str = "automotive.sdv.cloud.redhat.com/parts";
21+
}
22+
23+
pub mod targets {
24+
pub const RIDESX4: &str = "ridesx4";
25+
pub const AUTOSD: &str = "autosd";
26+
}
27+
28+
/// Extract partition name from layer annotations
29+
pub fn extract_partition_name(
30+
layer_annotations: &std::collections::HashMap<String, String>,
31+
) -> Option<String> {
32+
layer_annotations
33+
.get(annotations::PARTITION_ANNOTATION)
34+
.cloned()
35+
}
36+
37+
/// Extract decompressed size from layer annotations
38+
pub fn extract_decompressed_size(
39+
layer_annotations: &std::collections::HashMap<String, String>,
40+
) -> Option<u64> {
41+
layer_annotations
42+
.get(annotations::DECOMPRESSED_SIZE)
43+
.and_then(|s| s.parse().ok())
44+
}
45+
46+
/// Extract target platform from OCI annotations
47+
pub fn extract_target_from_annotations(
48+
annotations: &std::collections::HashMap<String, String>,
49+
) -> Option<String> {
50+
annotations.get(annotations::TARGET).cloned()
51+
}

0 commit comments

Comments
 (0)