Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a876951f authored by Newton Lam's avatar Newton Lam Committed by Gerrit Code Review
Browse files

Merge "Add create_snapshot flag to specific output file path." into main

parents 1a857b32 9af27a47
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@

DEFINE_string(source, "", "Source partition image");
DEFINE_string(target, "", "Target partition image");
DEFINE_string(
        output_dir, "",
        "Output directory to write the patch file to. Defaults to current working directory if "
        "not set.");
DEFINE_string(compression, "lz4",
              "Compression algorithm. Default is set to lz4. Available options: lz4, zstd, gz");
DEFINE_bool(merkel_tree, false, "If true, source image hash is obtained from verity merkel tree");
@@ -569,12 +573,15 @@ SYNOPSIS

    source.img -> Source partition image
    target.img -> Target partition image
    compressoin -> compression algorithm. Default set to lz4. Supported types are gz, lz4, zstd.
    compression -> compression algorithm. Default set to lz4. Supported types are gz, lz4, zstd.
    merkel_tree -> If true, source image hash is obtained from verity merkel tree.
    output_dir -> Output directory to write the patch file to. Defaults to current working directory if not set.

EXAMPLES

   $ create_snapshot $SOURCE_BUILD/system.img $TARGET_BUILD/system.img
   $ create_snapshot $SOURCE_BUILD/product.img $TARGET_BUILD/product.img --compression="zstd"
   $ create_snapshot $SOURCE_BUILD/product.img $TARGET_BUILD/product.img --merkel_tree --output_dir=/tmp/create_snapshot_output

)";

@@ -591,6 +598,9 @@ int main(int argc, char* argv[]) {
    std::string fname = android::base::Basename(FLAGS_target.c_str());
    auto parts = android::base::Split(fname, ".");
    std::string snapshotfile = parts[0] + ".patch";
    if (!FLAGS_output_dir.empty()) {
        snapshotfile = FLAGS_output_dir + "/" + snapshotfile;
    }
    android::snapshot::CreateSnapshot snapshot(FLAGS_source, FLAGS_target, snapshotfile,
                                               FLAGS_compression, FLAGS_merkel_tree);