1
0
forked from brl/citadel-tools

add kernel-version field to metainfo

This commit is contained in:
Bruce Leidl 2019-01-02 12:20:29 -05:00
parent 27758b9a1a
commit 011a4b80ea
3 changed files with 12 additions and 0 deletions

View File

@ -148,6 +148,7 @@ impl UpdateBuilder {
hdr.set_flag(ImageHeader::FLAG_DATA_COMPRESSED); hdr.set_flag(ImageHeader::FLAG_DATA_COMPRESSED);
let metainfo = self.generate_metainfo(); let metainfo = self.generate_metainfo();
fs::write(self.config.workdir_path("metainfo"), &metainfo)?;
hdr.set_metainfo_bytes(&metainfo); hdr.set_metainfo_bytes(&metainfo);
Ok(hdr) Ok(hdr)
} }
@ -163,6 +164,9 @@ impl UpdateBuilder {
let mut v = Vec::new(); let mut v = Vec::new();
writeln!(v, "image-type = \"{}\"", self.config.image_type())?; writeln!(v, "image-type = \"{}\"", self.config.image_type())?;
if let Some(kv) = self.config.kernel_version() {
writeln!(v, "kernel-version = \"{}\"", kv)?;
}
writeln!(v, "channel = \"{}\"", self.config.channel())?; writeln!(v, "channel = \"{}\"", self.config.channel())?;
writeln!(v, "version = {}", self.config.version())?; writeln!(v, "version = {}", self.config.version())?;
writeln!(v, "nblocks = {}", self.nblocks.unwrap())?; writeln!(v, "nblocks = {}", self.nblocks.unwrap())?;

View File

@ -86,6 +86,10 @@ impl BuildConfig {
&self.img_name &self.img_name
} }
pub fn kernel_version(&self) -> Option<&str> {
self.kernel_version.as_ref().map(|s| s.as_str())
}
pub fn version(&self) -> usize { pub fn version(&self) -> usize {
self.version self.version
} }

View File

@ -291,6 +291,8 @@ struct MetaInfoToml {
#[serde(rename = "image-type")] #[serde(rename = "image-type")]
image_type: String, image_type: String,
channel: String, channel: String,
#[serde(rename = "kernel-version")]
kernel_version: Option<String>,
version: u32, version: u32,
#[serde(rename = "base-version")] #[serde(rename = "base-version")]
base_version: Option<u32>, base_version: Option<u32>,
@ -351,6 +353,8 @@ impl MetaInfo {
self.toml().channel.as_str() self.toml().channel.as_str()
} }
pub fn kernel_version(&self) -> Option<&str> { self.toml().kernel_version.as_ref().map(|s| s.as_str()) }
pub fn version(&self) -> u32 { pub fn version(&self) -> u32 {
self.toml().version self.toml().version
} }