mirror of
https://github.com/chenxiaolong/avbroot.git
synced 2026-07-03 14:05:11 +02:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a5c628b66f | |||
| 156c96d3d4 | |||
| 2460d1807d | |||
| 728d333951 | |||
| 39661a994d | |||
| d6b19b69f7 | |||
| 96806cba36 | |||
| 5c474a1e98 | |||
| 4cf546e5ca |
@@ -43,7 +43,7 @@ jobs:
|
||||
android_api: '31'
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
# For git describe
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Run cargo-deny
|
||||
uses: EmbarkStudios/cargo-deny-action@30f817c6f72275c6d54dc744fbca09ebc958599f # v2.0.12
|
||||
uses: EmbarkStudios/cargo-deny-action@f2ba7abc2abebaf185c833c3961145a3c275caad # v2.0.13
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
echo "version=${version}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
to update the actual links at the bottom of the file.
|
||||
-->
|
||||
|
||||
### Version 3.22.0
|
||||
|
||||
* Fix CoW size estimates not being set when running `avbroot payload pack` ([PR #509])
|
||||
* Add support for only unpacking metadata in `avbroot {avb,boot,cpio,lp,payload} unpack` ([PR #510])
|
||||
* Specify minimum supported compiler version for building from source ([PR #511])
|
||||
* Update dependencies ([PR #512])
|
||||
|
||||
### Version 3.21.0
|
||||
|
||||
* Switch to using rawzip for zip parsing and writing ([PR #489])
|
||||
@@ -602,3 +609,7 @@ Behind-the-scenes changes:
|
||||
[PR #503]: https://github.com/chenxiaolong/avbroot/pull/503
|
||||
[PR #504]: https://github.com/chenxiaolong/avbroot/pull/504
|
||||
[PR #505]: https://github.com/chenxiaolong/avbroot/pull/505
|
||||
[PR #509]: https://github.com/chenxiaolong/avbroot/pull/509
|
||||
[PR #510]: https://github.com/chenxiaolong/avbroot/pull/510
|
||||
[PR #511]: https://github.com/chenxiaolong/avbroot/pull/511
|
||||
[PR #512]: https://github.com/chenxiaolong/avbroot/pull/512
|
||||
|
||||
Generated
+26
-26
@@ -104,7 +104,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||
|
||||
[[package]]
|
||||
name = "avbroot"
|
||||
version = "3.21.0"
|
||||
version = "3.22.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"assert_matches",
|
||||
@@ -316,9 +316,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.45"
|
||||
version = "4.5.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318"
|
||||
checksum = "2c5e4fcf9c21d2e544ca1ee9d8552de13019a42aa7dbf32747fa7aaf1df76e57"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@@ -326,9 +326,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.44"
|
||||
version = "4.5.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8"
|
||||
checksum = "fecb53a0e6fcfb055f686001bc2e2592fa527efaf38dbe81a6a9563562e57d41"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@@ -550,7 +550,7 @@ checksum = "ecb08c4819242b1ec89b3d0c6affa229005bef46ae4f7eed8b80768187c10087"
|
||||
|
||||
[[package]]
|
||||
name = "e2e"
|
||||
version = "3.21.0"
|
||||
version = "3.22.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"avbroot",
|
||||
@@ -634,7 +634,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "fuzz"
|
||||
version = "3.21.0"
|
||||
version = "3.22.0"
|
||||
dependencies = [
|
||||
"avbroot",
|
||||
"honggfuzz",
|
||||
@@ -898,9 +898,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lzma-rust2"
|
||||
version = "0.10.0"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb31493965215fc8d0956b8dd58f2609e17ea89487a5cb2619e1d60b8b71328f"
|
||||
checksum = "6d43aa8ef7ba6927e84cfb39120bbc06c29474346b956f7b88cc4899b1f2e86e"
|
||||
dependencies = [
|
||||
"crc",
|
||||
"sha2",
|
||||
@@ -1102,9 +1102,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.12.1"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7"
|
||||
checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"
|
||||
dependencies = [
|
||||
"phf_macros",
|
||||
"phf_shared",
|
||||
@@ -1113,9 +1113,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "phf_generator"
|
||||
version = "0.12.1"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cbb1126afed61dd6368748dae63b1ee7dc480191c6262a3b4ff1e29d86a6c5b"
|
||||
checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"phf_shared",
|
||||
@@ -1123,9 +1123,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "phf_macros"
|
||||
version = "0.12.1"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d713258393a82f091ead52047ca779d37e5766226d009de21696c4e667044368"
|
||||
checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef"
|
||||
dependencies = [
|
||||
"phf_generator",
|
||||
"phf_shared",
|
||||
@@ -1136,9 +1136,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.12.1"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981"
|
||||
checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"
|
||||
dependencies = [
|
||||
"siphasher",
|
||||
]
|
||||
@@ -1353,9 +1353,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rawzip"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "439c3cea2f04ab9cf078fab95c153af562df27cca8fbf88c0a7499c3f389ce23"
|
||||
checksum = "70171b805bd97a69690df1b634104649ad193430aa60d8305dfb9b470fe690a8"
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
@@ -1379,9 +1379,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.1"
|
||||
version = "1.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||
checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -1391,9 +1391,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.9"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
||||
checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -1402,9 +1402,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||
checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
@@ -2106,7 +2106,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "xtask"
|
||||
version = "3.21.0"
|
||||
version = "3.22.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
|
||||
+3
-1
@@ -4,10 +4,12 @@ members = ["avbroot", "e2e", "fuzz", "xtask"]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
version = "3.21.0"
|
||||
version = "3.22.0"
|
||||
license = "GPL-3.0-only"
|
||||
edition = "2024"
|
||||
repository = "https://github.com/chenxiaolong/avbroot"
|
||||
publish = false
|
||||
rust-version = "1.88.0"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
cast_lossless = "deny"
|
||||
|
||||
+4
-3
@@ -4,7 +4,8 @@ version.workspace = true
|
||||
license.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
publish = false
|
||||
publish.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@@ -27,12 +28,12 @@ flate2 = { version = "1.0.29", features = ["zlib-rs"] }
|
||||
gf256 = { version = "0.3.0", features = ["rs"] }
|
||||
hex = { version = "0.4.3", features = ["serde"] }
|
||||
lz4_flex = "0.11.1"
|
||||
lzma-rust2 = "0.10.0"
|
||||
lzma-rust2 = "0.11.0"
|
||||
memchr = "2.6.0"
|
||||
num-bigint-dig = "0.8.4"
|
||||
num-traits = "0.2.16"
|
||||
passterm = "2.0.3"
|
||||
phf = { version = "0.12.1", features = ["macros"] }
|
||||
phf = { version = "0.13.1", features = ["macros"] }
|
||||
pkcs8 = { version = "0.10.2", features = ["encryption", "pem"] }
|
||||
prost = "0.14.1"
|
||||
# We can't upgrade to 0.9.0 until rsa updates its rand_core dependency.
|
||||
|
||||
@@ -735,7 +735,7 @@ fn unpack_subcommand(cli: &UnpackCli, cancel_signal: &AtomicBool) -> Result<()>
|
||||
|
||||
write_info(&cli.output_info, &info)?;
|
||||
|
||||
if info.footer.is_some() {
|
||||
if info.footer.is_some() && !cli.no_output_raw {
|
||||
write_raw_and_verify(
|
||||
&cli.output_raw,
|
||||
&mut reader,
|
||||
@@ -1025,6 +1025,10 @@ struct UnpackCli {
|
||||
#[arg(long, value_name = "FILE", value_parser, default_value = "raw.img")]
|
||||
output_raw: PathBuf,
|
||||
|
||||
/// Do not output raw image.
|
||||
#[arg(long, conflicts_with = "output_raw")]
|
||||
no_output_raw: bool,
|
||||
|
||||
/// Ignore invalid digests or FEC data.
|
||||
#[arg(long)]
|
||||
ignore_invalid: bool,
|
||||
|
||||
+53
-11
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2023 Andrew Gunnerson
|
||||
// SPDX-FileCopyrightText: 2023-2025 Andrew Gunnerson
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use std::{
|
||||
@@ -164,30 +164,44 @@ fn unpack_subcommand(boot_cli: &BootCli, cli: &UnpackCli) -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(data) = kernel {
|
||||
if let Some(data) = kernel
|
||||
&& !cli.no_output_kernel
|
||||
{
|
||||
write_data_if_not_empty(&cli.output_kernel, data)?;
|
||||
}
|
||||
if let Some(data) = second {
|
||||
if let Some(data) = second
|
||||
&& !cli.no_output_second
|
||||
{
|
||||
write_data_if_not_empty(&cli.output_second, data)?;
|
||||
}
|
||||
if let Some(data) = recovery_dtbo {
|
||||
if let Some(data) = recovery_dtbo
|
||||
&& !cli.no_output_recovery_dtbo
|
||||
{
|
||||
write_data_if_not_empty(&cli.output_recovery_dtbo, data)?;
|
||||
}
|
||||
if let Some(data) = dtb {
|
||||
if let Some(data) = dtb
|
||||
&& !cli.no_output_dtb
|
||||
{
|
||||
write_data_if_not_empty(&cli.output_dtb, data)?;
|
||||
}
|
||||
if let Some(header) = vts_signature {
|
||||
if let Some(header) = vts_signature
|
||||
&& !cli.no_output_vts_signature
|
||||
{
|
||||
write_avb_header(&cli.output_vts_signature, header)?;
|
||||
}
|
||||
if let Some(text) = bootconfig {
|
||||
if let Some(text) = bootconfig
|
||||
&& !cli.no_output_bootconfig
|
||||
{
|
||||
write_text_if_not_empty(&cli.output_bootconfig, text)?;
|
||||
}
|
||||
|
||||
for (i, data) in ramdisks.iter().enumerate() {
|
||||
let mut path = cli.output_ramdisk_prefix.as_os_str().to_owned();
|
||||
path.push(i.to_string());
|
||||
if !cli.no_output_ramdisk {
|
||||
for (i, data) in ramdisks.iter().enumerate() {
|
||||
let mut path = cli.output_ramdisk_prefix.as_os_str().to_owned();
|
||||
path.push(i.to_string());
|
||||
|
||||
write_data_if_not_empty(Path::new(&path), data)?;
|
||||
write_data_if_not_empty(Path::new(&path), data)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -339,6 +353,10 @@ struct UnpackCli {
|
||||
#[arg(long, value_name = "FILE", value_parser, default_value = "kernel.img")]
|
||||
output_kernel: PathBuf,
|
||||
|
||||
/// Do not output kernel image.
|
||||
#[arg(long, conflicts_with = "output_kernel")]
|
||||
no_output_kernel: bool,
|
||||
|
||||
/// Path prefix for output ramdisk images.
|
||||
#[arg(
|
||||
long,
|
||||
@@ -348,10 +366,18 @@ struct UnpackCli {
|
||||
)]
|
||||
output_ramdisk_prefix: PathBuf,
|
||||
|
||||
/// Do not output ramdisk images.
|
||||
#[arg(long, conflicts_with = "output_ramdisk_prefix")]
|
||||
no_output_ramdisk: bool,
|
||||
|
||||
/// Path to output second stage bootloader image.
|
||||
#[arg(long, value_name = "FILE", value_parser, default_value = "second.img")]
|
||||
output_second: PathBuf,
|
||||
|
||||
/// Do not output second stage bootloader image.
|
||||
#[arg(long, conflicts_with = "output_second")]
|
||||
no_output_second: bool,
|
||||
|
||||
/// Path to output recovery dtbo/acpio image.
|
||||
#[arg(
|
||||
long,
|
||||
@@ -361,10 +387,18 @@ struct UnpackCli {
|
||||
)]
|
||||
output_recovery_dtbo: PathBuf,
|
||||
|
||||
/// Do not output recovery dtbo/acpio image.
|
||||
#[arg(long, conflicts_with = "output_recovery_dtbo")]
|
||||
no_output_recovery_dtbo: bool,
|
||||
|
||||
/// Path to output device tree blob image.
|
||||
#[arg(long, value_name = "FILE", value_parser, default_value = "dtb.img")]
|
||||
output_dtb: PathBuf,
|
||||
|
||||
/// Do not output device tree blob image.
|
||||
#[arg(long, conflicts_with = "output_dtb")]
|
||||
no_output_dtb: bool,
|
||||
|
||||
/// Path to output VTS signature.
|
||||
#[arg(
|
||||
long,
|
||||
@@ -374,6 +408,10 @@ struct UnpackCli {
|
||||
)]
|
||||
output_vts_signature: PathBuf,
|
||||
|
||||
/// Do not output VTS signature.
|
||||
#[arg(long, conflicts_with = "output_vts_signature")]
|
||||
no_output_vts_signature: bool,
|
||||
|
||||
/// Path to output bootconfig text.
|
||||
#[arg(
|
||||
long,
|
||||
@@ -382,6 +420,10 @@ struct UnpackCli {
|
||||
default_value = "bootconfig.txt"
|
||||
)]
|
||||
output_bootconfig: PathBuf,
|
||||
|
||||
/// Do not output bootconfig text.
|
||||
#[arg(long, conflicts_with = "output_bootconfig")]
|
||||
no_output_bootconfig: bool,
|
||||
}
|
||||
|
||||
/// Pack a boot image.
|
||||
|
||||
+17
-11
@@ -170,22 +170,24 @@ fn unpack_subcommand(
|
||||
|
||||
display_format(cpio_cli, format);
|
||||
|
||||
fs::create_dir_all(&cli.output_tree)
|
||||
.with_context(|| format!("Failed to create directory: {:?}", cli.output_tree))?;
|
||||
if !cli.no_output_tree {
|
||||
fs::create_dir_all(&cli.output_tree)
|
||||
.with_context(|| format!("Failed to create directory: {:?}", cli.output_tree))?;
|
||||
|
||||
while let Some(entry) = reader.next_entry().context("Failed to read cpio entry")? {
|
||||
display_entry(cpio_cli, &entry);
|
||||
while let Some(entry) = reader.next_entry().context("Failed to read cpio entry")? {
|
||||
display_entry(cpio_cli, &entry);
|
||||
|
||||
if let Some(mut writer) = create_tree_file(&cli.output_tree, &entry)? {
|
||||
let file_size = entry.data.size()?;
|
||||
if let Some(mut writer) = create_tree_file(&cli.output_tree, &entry)? {
|
||||
let file_size = entry.data.size()?;
|
||||
|
||||
stream::copy_n(&mut reader, &mut writer, file_size.into(), cancel_signal)
|
||||
.context("Failed to copy data")?;
|
||||
stream::copy_n(&mut reader, &mut writer, file_size.into(), cancel_signal)
|
||||
.context("Failed to copy data")?;
|
||||
|
||||
writer.into_inner().context("Failed to flush data")?;
|
||||
writer.into_inner().context("Failed to flush data")?;
|
||||
}
|
||||
|
||||
info.entries.push(entry);
|
||||
}
|
||||
|
||||
info.entries.push(entry);
|
||||
}
|
||||
|
||||
write_info(&cli.output_info, &info)?;
|
||||
@@ -300,6 +302,10 @@ struct UnpackCli {
|
||||
/// Path to output files directory.
|
||||
#[arg(long, value_name = "DIR", value_parser, default_value = "cpio_tree")]
|
||||
output_tree: PathBuf,
|
||||
|
||||
/// Do not output files.
|
||||
#[arg(long, conflicts_with = "output_tree")]
|
||||
no_output_tree: bool,
|
||||
}
|
||||
|
||||
/// Pack a cpio archive.
|
||||
|
||||
@@ -179,7 +179,7 @@ fn unpack_subcommand(lp_cli: &LpCli, cli: &UnpackCli, cancel_signal: &AtomicBool
|
||||
write_info(&cli.output_info, &metadata)?;
|
||||
|
||||
// For empty images, there's no data to unpack.
|
||||
if metadata.image_type == ImageType::Empty {
|
||||
if metadata.image_type == ImageType::Empty || cli.no_output_images {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -535,6 +535,10 @@ struct UnpackCli {
|
||||
#[arg(long, value_name = "DIR", value_parser, default_value = "lp_images")]
|
||||
output_images: PathBuf,
|
||||
|
||||
/// Do not output images.
|
||||
#[arg(long, conflicts_with = "output_images")]
|
||||
no_output_images: bool,
|
||||
|
||||
/// The LP metadata slot to use.
|
||||
///
|
||||
/// This slot is the only slot where data extents are copied from. Any data
|
||||
|
||||
@@ -830,7 +830,7 @@ pub fn compress_image(
|
||||
|
||||
/// Recompute the CoW estimate for an image and update the OTA manifest
|
||||
/// partition entry appropriately. The input file is not modified.
|
||||
fn recow_image(
|
||||
pub fn recow_image(
|
||||
name: &str,
|
||||
file: &File,
|
||||
header: &mut PayloadHeader,
|
||||
|
||||
+43
-17
@@ -113,24 +113,26 @@ fn unpack_subcommand(
|
||||
|
||||
write_info(&cli.output_info, &header)?;
|
||||
|
||||
fs::create_dir_all(&cli.output_images)
|
||||
.with_context(|| format!("Failed to create directory: {:?}", cli.output_images))?;
|
||||
if !cli.no_output_images {
|
||||
fs::create_dir_all(&cli.output_images)
|
||||
.with_context(|| format!("Failed to create directory: {:?}", cli.output_images))?;
|
||||
|
||||
ota::extract_payload(
|
||||
&reader.into_inner(),
|
||||
&cli.output_images,
|
||||
0,
|
||||
payload_size,
|
||||
&header,
|
||||
&header
|
||||
.manifest
|
||||
.partitions
|
||||
.iter()
|
||||
.map(|p| &p.partition_name)
|
||||
.cloned()
|
||||
.collect(),
|
||||
cancel_signal,
|
||||
)?;
|
||||
ota::extract_payload(
|
||||
&reader.into_inner(),
|
||||
&cli.output_images,
|
||||
0,
|
||||
payload_size,
|
||||
&header,
|
||||
&header
|
||||
.manifest
|
||||
.partitions
|
||||
.iter()
|
||||
.map(|p| &p.partition_name)
|
||||
.cloned()
|
||||
.collect(),
|
||||
cancel_signal,
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -160,6 +162,26 @@ fn pack_subcommand(
|
||||
})
|
||||
.collect::<Result<HashMap<_, _>>>()?;
|
||||
|
||||
for (name, input_file) in &input_files {
|
||||
let Some(dpm) = &header.manifest.dynamic_partition_metadata else {
|
||||
continue;
|
||||
};
|
||||
|
||||
if !dpm.groups.iter().any(|g| g.partition_names.contains(name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
header
|
||||
.manifest
|
||||
.partitions
|
||||
.iter_mut()
|
||||
.find(|p| p.partition_name == *name)
|
||||
.unwrap()
|
||||
.estimate_cow_size = Some(0);
|
||||
|
||||
ota::recow_image(name, input_file, &mut header, cancel_signal)?;
|
||||
}
|
||||
|
||||
// Compress the images and compute the list of install operations for
|
||||
// insertion into the payload header. The compressed data is stored in new
|
||||
// temp files and the original input files are dropped.
|
||||
@@ -366,6 +388,10 @@ struct UnpackCli {
|
||||
default_value = "payload_images"
|
||||
)]
|
||||
output_images: PathBuf,
|
||||
|
||||
/// Do not output images.
|
||||
#[arg(long, conflicts_with = "output_images")]
|
||||
no_output_images: bool,
|
||||
}
|
||||
|
||||
/// Pack a payload binary.
|
||||
|
||||
@@ -34,7 +34,7 @@ allow = [
|
||||
"Apache-2.0 WITH LLVM-exception",
|
||||
"BSD-3-Clause",
|
||||
"bzip2-1.0.6",
|
||||
"GPL-3.0",
|
||||
"GPL-3.0-only",
|
||||
"ISC",
|
||||
"MIT",
|
||||
"Unicode-3.0",
|
||||
|
||||
+2
-1
@@ -4,7 +4,8 @@ version.workspace = true
|
||||
license.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
publish = false
|
||||
publish.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
||||
+2
-1
@@ -4,7 +4,8 @@ version.workspace = true
|
||||
license.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
publish = false
|
||||
publish.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
||||
+2
-1
@@ -4,7 +4,8 @@ version.workspace = true
|
||||
license.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
publish = false
|
||||
publish.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
||||
Reference in New Issue
Block a user