summaryrefslogtreecommitdiff
path: root/payload_generator/deflate_utils.cc
AgeCommit message (Collapse)Author
2021-09-14Consider .capex files as zip archivesKelvin Zhang
This reduces size of SP2A.210827.001-to-SP2A.210903.001.zip OTA package from 83MB to 66MB. Which is ~21% improvement. Tests: th Bug: 199920825 (cherry picked from commit dc1f258e94b2c2dac1d3468301ebcdc0a2fe147c) Change-Id: I10fa03401e5920c633c3ce5d6cf737489fecb6de Merged-In: I10fa03401e5920c633c3ce5d6cf737489fecb6de
2020-07-06Merge remote-tracking branch 'aosp/upstream-master' into mergeTianjie
It's a merge from chrome OS with some reverts. 1. the fd watcher change, because the libbrillo version isn't compatible in aosp. commit 6955bcc4ffe4cc9d62a88186b9a7e75d095a7897 commit 493fecb3f48c8478fd3ef244d631d857730dd14d 2. two libcurl unittest. Because the RunOnce() of the fake message loop seems to have different behavior in aosp. commit d3d84218cafbc1a95e7d6bbb775b495d1bebf4d2 Put preprocessor guards to use the old code in aosp. And we can switch to the new code in the other path after adopting the new libbrillo & libchrome. Test: unit tests pass, apply an OTA Change-Id: Id613599834b0f44f92841dbeae6303601db5490d
2020-03-28update_engine: Fix issues reported by clang-tidyAndrew
Fix uninitialized variables and some other minor issues reported by clang-tidy. BUG=chromium:982837 TEST=cros_workon_make update_engine --test Change-Id: I305dedb058c9b0787ba2f68feff42afe6810a276 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2122683 Reviewed-by: Amin Hassani <ahassani@chromium.org> Tested-by: Andrew Lassalle <andrewlassalle@chromium.org> Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
2020-02-28update_engine: Don't search for deflates again in SquashFS compressed filesAmin Hassani
When we initialize a SquashFS file system, at the same time we find the location of all deflate buffers. But for some files that have specific postfix like gz or zip, we try to find the deflates there again. But, we should only do this when the SquashFS did not actually compress that file. Otherwise we're just gonna fail. BUG=chromium:1050869 TEST=cros_generate_update_payload --image gs://chromeos-releases/dev-channel/eve-kvm/12871.1.0/dlc/pita/package/dlc.img --src_image gs://chromeos-releases/dev-channel/eve-kvm/12861.0.0/dlc/pita/package/dlc.img --output delta.bin --debug --work_dir workdir TEST=sudo FEATURES=test emerge update_engine Change-Id: I8b01fb182b88d7ec75dcbfa4c1271caf3bf074fe Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2076162 Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2019-07-16Only scan for deflates in regular filesHÃ¥kan Kvist
It only makes sense to scan for deflates in regular files. Scanning a symlink to a zip/gzip file would crash the generator. Test: Run ota package generation script with image including a symlink Bug: 137128486 Change-Id: I16f9040f2e483dcbb6a77d6dc56d38d32529521c
2019-02-22update_engine: Add delta payload support for squashfsAmin Hassani
This patch adds support for generating delta payloads for squashfs images. This is needed to get delta payloads for DLC images. In order to get the supported major and minor versions of the update_engine that matches the squashfs image (either squashfs image contains the entire rootfs, including the update_engine, or the image is a DLC), we need to read /etc/update_engine inside the image. We do this by calling unsquashfs and only unsquashing the target file and later reading its content into a key-value store to be used for delta payload generation. BUG=chromium:926986 TEST=unittest TEST=delta_generator --out_file=output --partition_names=dlc --new_partitions=dlc.img --old_partitions=dlc.img Change-Id: Ib5599032c873223a5caca82918e138d8b4fcec43 Reviewed-on: https://chromium-review.googlesource.com/1446278 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
2019-01-16update_engine: Run clang-format on payload_generator/Amin Hassani
BUG=none TEST=unittest Change-Id: I00cafb1fc709d8f02119cb0058cfcb0b573ef25d Reviewed-on: https://chromium-review.googlesource.com/1409927 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
2018-11-29Fix partition spelling.Sen Jiang
Parition -> Partition Test: mma Change-Id: Ibf4898c443fadd70e45789a55566f25dc4af8b68
2018-11-21Add apex file to the list of zip extensions.Sen Jiang
This is an Android specific package format. Test: None Change-Id: I28bb14d4b5cc5c5623851138028636c7c6f5f403
2018-11-13Parse deflates in gzip files.Sen Jiang
The diff for NOTICE.xml.gz is reduced from 200+K to 17K. Also we are now honoring puffin::LocateDeflatesInGzip() failures, since if won't complain about padding data anymore, and puffin::LocateDeflateSubBlocksInZipArchive() is updated to puffin::LocateDeflatesInZipArchive(). Test: generate a delta payload extracting deflates in gzip Change-Id: I44b816cff8ac99ce78f758eef5875fa99e36e369
2018-04-02update_engine: puffdiff .zvoice filesAmin Hassani
.zvoice files in speech_synthesis are large zip files. Start using puffin on them to reduce the payload size whenever they change. BUG=none TEST=unittests TEST=brillo_update_payload Change-Id: Ib8ec31af831e44aa6bec3c024235728bd2d6aec5 Reviewed-on: https://chromium-review.googlesource.com/986736 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
2018-02-06Only find deflates for zip files if puffdiff is enabledTianjie Xu
Because the deflates are useless if we don't do puffdiff. Bug: 72815313 Test: generate an incremental OTA for walleye 4504078-4585723 Change-Id: I3fdb4cee93f0b046b4dace4e25693d1eda70310d
2018-01-30Enable puffin in update_engineTianjie Xu
Call the approximate functions to set up the deflates of a zip archive file. This effectively enables puffdiff when generating an a/b update package. Test: Unittests pass. Generate and verify a package on sailfish Change-Id: Id025c42529b8b9547d4c7d7ac57898450bc6a1c1
2017-12-12update_engine: Remove the duplicate BlocksInExtentsAmin Hassani
This patch removes the duplicate BlocksInExtents from extent_utils.h and fixes the remainder of the code to reflect this change. BUG=none TEST=unittests pass; Change-Id: I76f5106f75072b20cd8f41f081b2f2b07aeac9a8 Reviewed-on: https://chromium-review.googlesource.com/812009 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Alex Deymo <deymo@google.com> Reviewed-by: Sen Jiang <senj@chromium.org>
2017-11-06update_engine: Generate PUFFDIFF operationAmin Hassani
This patch adds functionality for generating PUFFDIFF operation, but since the minor verion has not been increase, it actually does not generate the operation itself. PUFFDIFF is used for patching deflate based files. BUG=chromium:767120 TEST=unittest passes; brillo_update_payload {generate|verify} passes; CQ-DEPEND=CL:726945 Change-Id: I4ffdac8dce3740ef9fc2156cb0dad83a8364c8b5 Reviewed-on: https://chromium-review.googlesource.com/658298 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
2017-10-16update_engine: Add Squashfs (phase 2)Amin Hassani
This patch replaces the Android container related Squashfs images with their files in the update engine. The location of each new file is defined as: 'Squashfs image file path' + / + 'the file path inside the Squashfs' This works even if the files inside the Squashfs are not 4k aligned. But we need 4k alignment before we add Puffin support. In some experiments this could even reduce the delta payload size by like 1MB. BUG=chromium:767120 TEST=cros_workon_make --board=amd64-generic --test update_engine; brillo_update_payload generate --payload=payload.delta --source_image=veyron_minnie-R61-9765.13.0.bin --target_image=veyron-minnie-R62-9804.0.0.bin Change-Id: I3fbcc5cd0d724435955ed1bd1204dee0e41944be Reviewed-on: https://chromium-review.googlesource.com/636106 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>