History log of /build/tools/releasetools/sparse_img.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e709b094e4b049ddfd6e65fc5bec1deb87fa57b1 07-Feb-2018 Tao Bao <tbao@google.com> releasetools: Allow generating BBOTA for images with shared blocks.

When target defines 'BOARD_EXT4_SHARE_DUP_BLOCKS := true', the generated
system/vendor images may contain shared blocks (i.e. some blocks will
show up in multiple files' block list), which violates the current
assumptions in BBOTA script.

This CL allows generating BBOTAs by considering the first occurrence as
the "owner" of the shared blocks. All the later users of the shared
blocks will have an incomplete block list, whose RangeSet's will be
tagged with 'uses_shared_blocks'.

Files with 'uses_shared_blocks' tag will not be diff'd with imgdiff,
potentially with patch size penalty. Such files will be accounted for in
imgdiff stats report, where we can revisit for a better solution.

Bug: 64109868
Test: Generate BBOTA full and incremental package with targets defining
'BOARD_EXT4_SHARE_DUP_BLOCKS := true'.
Change-Id: I87fbc22eef7fafe2a470a03fdcfa1babf088ea8d
/build/make/tools/releasetools/sparse_img.py
df1166e92f320830722a62601e704407f1752701 28-Jan-2018 Tianjie Xu <xunchang@google.com> Protect SparseImage._GetRangeData() with lock

The generator function is not thread safe and is prone to race
conditions. This CL uses a lock to protect this generator and loose the
locks elsewhere, e.g. 'WriteRangeDataToFd()'.

Bug: 71908713
Test: Generate an incremental package several times for angler 4208095 to 4442250.
Change-Id: I9e6f0a182a1ba7904a597f403f2b12fe05016513
/build/make/tools/releasetools/sparse_img.py
183e56e83d82e3ff55b382ff1efee9a6495a7bf4 06-Mar-2017 Tao Bao <tbao@google.com> releasetools: Reduce memory footprint for BBOTA generation.

The major issue with the existing implementation is unnecessarily
holding too much data in memory, such as HashBlocks() which first reads
in *all* the data to a list before hashing. We can leverage generator
functions to stream such operations.

This CL makes the following changes to reduce the peak memory use.
- Adding RangeSha1() and WriteRangeDataToFd() to Image classes. These
functions perform the operations on-the-fly.
- Caching the computed SHA-1 values for a Transfer instance.

As a result, this CL reduces the peak memory use by ~80% (e.g. reducing
from 5.85GB to 1.16GB for the same incremental, as shown by "Maximum
resident set size" from `/usr/bin/time -v`). It also effectively
improves the (package generation) performance by ~30%.

Bug: 35768998
Bug: 32312123
Test: Generating the same incremental w/ and w/o the CL give identical
output packages.
Change-Id: Ia5c6314b41da73dd6fe1dbe2ca81bbd89b517cec
/build/make/tools/releasetools/sparse_img.py
405e71dcd3e96457766c3ac3f2aa3d4bd9f95e32 09-Feb-2016 Sami Tolvanen <samitolvanen@google.com> Fix metadata location when file system doesn't span the partition

Pad the sparse image with a zero fill chunk to correctly position
verity and FEC metadata at the end of the partition.

Bug: 27073791
Change-Id: I9f70d579a42e5007d50e9c02a98a608d2815f0ed
(cherry picked from commit 6a8781a25113b9b49dddc8c8e043c27d5a943e3a)
/build/make/tools/releasetools/sparse_img.py
7c4c6f589e846d838136de148ae7e7d680c74d91 20-Aug-2015 Tao Bao <tbao@google.com> sparse_img.py: Divide NONZERO blocks into groups.

For squashfs, we currently don't have a system.map. So the whole system
image will be treated as a single file. But for some unknown bug, the
updater will be killed due to OOM when writing back the patched image to
flash (observed on lenok-userdebug MEA49). Prior to getting a real fix,
we evenly divide the non-zero blocks into smaller groups (currently 1024
blocks or 4MB per group).

Bug: 23227672
Change-Id: Ifeddd8d802f01f8cd2a743a1d1217a284fb6e182
/build/make/tools/releasetools/sparse_img.py
2fd2c9bfd6c9beeaeccb4632b785227fe56c6006 10-Jul-2015 Tao Bao <tbao@google.com> Zero out blocks that may be touched by dm-verity.

dm-verity may touch some blocks that are not in the care_map due to
block device read-ahead. It will fail if such blocks contain
non-zeroes. As a workaround, we mark them as extended blocks and
zero out explicitly to avoid dm-verity failures.

Bug: 20881595
Change-Id: I54e24e70ad822c0d6d7af43301f74d24505f4461
/build/make/tools/releasetools/sparse_img.py
8bd720257eeaf9bf28b2dc8a36b856ccc30b1e8c 02-Jul-2015 Tao Bao <tbao@google.com> resolved conflicts for merge of 8787cd6d to mnc-dev

Change-Id: I19497d05a021c21c905b2bddd5b36d370dc2208f
8787cd6d4ec9e403557e17d6083bb180874fc08c 02-Jul-2015 Tao Bao <tbao@google.com> resolved conflicts for merge of 7f9470cd to lmp-mr1-ub-dev

Change-Id: Icfc94fcc4178f5fbfad62df9914c84d59d140bb7
7f9470cda390ee61c0fc71491d0c649fbf6e02dd 27-Jun-2015 Tao Bao <tbao@google.com> sparse_img.py: Don't write empty map groups.

In certain cases, we may have no mapping of ZERO or NONZERO blocks in
the image (such as squashfs at the moment). Don't write those groups if
they are empty.

Change-Id: I82aa05fbbd79130b08868585edd5298e531c4f5a
/build/make/tools/releasetools/sparse_img.py
2b4ff174ff09d3d4f69897c8f8004c57836975b4 24-Jun-2015 Tao Bao <tbao@google.com> Fix the error in sparse_img.py

Bug: 22046423
Change-Id: I9c257002c405277557974fadfe27942c38c3cd04
/build/make/tools/releasetools/sparse_img.py
5fcaaeffc3d132f1223adf7ee8230b6815477af5 01-Jun-2015 Tao Bao <tbao@google.com> Add post-install verification for BBOTAs

Similar to the assertations in file-based OTA, we perform verification
for block-based OTAs (BBOTAs) after updating a partition, for both of
the incremental and full OTAs. It increases the update time (~20s on
Nexus 6), but will capture unnoticed errors right away.

Bug: 21500869
Change-Id: I0f8b27734caaa0f41f9c1b904d55af2112784a68
(cherry picked from commit 68658c0f4fe5420226df5849b642f98fb7f5d984)
/build/make/tools/releasetools/sparse_img.py
5ece99d64efe82fc1ca97a96f079ce69ea588a24 12-May-2015 Tao Bao <tbao@google.com> Add support for clobbered blocks

In ext4 filesystems, some blocks might be changed even being mounted
R/O, such as the superblock (block 0). We need to exclude such blocks
from integrity verification. Plus such blocks should always be
written to the target by copying instead of patching.

Bug: http://b/20939131
Change-Id: I657025b7b1ad50d4365e7b18dc39308facfe864e
(cherry picked from commit ff7778166bd13a90c89fa333591ee2037f587a11)
/build/make/tools/releasetools/sparse_img.py
8b72aefb5a8ed4da28c6f83854e8babf53b9cb53 24-Mar-2015 Dan Albert <danalbert@google.com> Make releasetools pylint clean.

This caught a few bugs/syntax errors (a few character classes were not
escaped properly in regex patterns, some indentation was illegal,
etc).

Change-Id: I50637607524e68c4fb9cad7167f58a46b8d26b2c
/build/make/tools/releasetools/sparse_img.py
e18eb50850201e573084a0cd8e1199d877170b64 16-Oct-2014 Doug Zongker <dougz@google.com> add support for the 'fill' chunk type to sparse_img

Bug: 17987996
Change-Id: Ia661e87877e52274a991ceb77bbed93b7e6218f2
(cherry picked from commit 629c7cc84d4880611718ab1812b9b9d1bf7ee6a0)
/build/make/tools/releasetools/sparse_img.py
424296a4e811f57ada27be68d60aeb5fcb1bb45b 02-Sep-2014 Doug Zongker <dougz@google.com> add missing AOSP copyright notices

Change-Id: Idc812db30b259a55702f8728197f957f2d24d978
/build/make/tools/releasetools/sparse_img.py
fc44a515d46e6f4d5eaa0d32659b1cf3b9492305 26-Aug-2014 Doug Zongker <dougz@google.com> new block OTA system tools

Replace the xdelta/xz-based block OTA generation with a new system
based on the existing bsdiff/imgdiff tools.

Bug: 16984795
Change-Id: Ia9732516ffdfc12be86260b2cc4b1dd2d210e886
/build/make/tools/releasetools/sparse_img.py