History log of /build/tools/releasetools/img_from_target_files.py
Revision Date Author Comments
f21cb5a2198b843fe1c8e9577cc2ad61e0f5cfb4 12-Aug-2014 Doug Zongker <dougz@google.com> save file block allocations in target_files

make_ext4fs can now output a file listing the blocks used for each
file in the image. Request this file and save it in the target_files;
it will be used for future improvements to block OTAs.

Bug: 16984795
Change-Id: Id1e60465e3b5a9d126a7934b4d089cf34d8fec44
3c84f569487c4e59baa332be33b5430fdefb76b3 31-Jul-2014 Doug Zongker <dougz@google.com> store images in target-files

Store sparse images in the target-files, and use those (when they're
available) for building block OTAs.

- New script add_img_to_target_files is added to make the images and
add them to the IMAGES/ subdir in the target-files. It gets run
from the Makefile when building a target-files.

- img_from_target_files becomes mostly vestigial: it creates the
img.zip by just copying the images out of the target-files. (It
still knows how to build images for use on older target-files.)

- ota_from_target_files uses images from the target-files in
preference to rebuilding images from the source files.

- sign_apk_target_files builds images and includes them in its output
target files (even if the input target-files didn't have them).

Bug: 16488065
Change-Id: I444e0d722d636978209467ffc01750a585c6db75
4d09dcb2c6d5e2fe8e8ed0780ee2da6ac8bda3c4 27-Jun-2014 JP Abgrall <jpa@google.com> releasetools: only allow yaffs to have no userdata image size (fix build)

In the past, there was an exception for ext-base fs types to
deal with the lack of image size.
Back then it was only yaffs and ext*.
So now we explicitely only allow yaffs to have no userdata image size.

Change-Id: Ie354ee6222a58228dbcce2c6934971a0737422af
Signed-off-by: JP Abgrall <jpa@google.com>
c8b4e849f10f3a382694b00453b3f49608c83b48 17-Jun-2014 Doug Zongker <dougz@google.com> full support for OTA of vendor partitions

Make vendor partition a first-class member of the OTA system (for
target_files that contain a VENDOR/ subdirectory).

Build vendor images in a way that is compatible with block-based OTA.
Support updating the vendor partition in both full and incremental,
block and file OTAs. In most cases this is handled by refactoring the
existing code to handle the system partition to handle either, and
then calling it twice.

Currently we don't support incremental OTAs from a target-files
without a VENDOR subdirectory to one with one, or vice versa. To add
or remove a vendor partition a full OTA will need to be done.

Bug: 15544685
Change-Id: I9cb9a1267060bd9683a9bea19b43a26b5a43800d
8282282122a22f87c94862e97674bf48fd921d48 16-Jun-2014 Doug Zongker <dougz@google.com> use fs_config and file_contexts from target_files

When building images, we want to use the file_contexts and fs_config
data contained in the target_files zip, rather than whatever happens
to be in the current client.

Change-Id: I13df2405898039f5a9b4bb4837147e76b31b068a
2a386e0cfbdfa009038acede85876a7643f297f5 03-Jun-2014 Ying Wang <wangying@google.com> Allow to build the update.zip for emulator build.

img_from_target_files.py just skips the boot.img and recovery.img since
there is no kernel or recovery.fstab for emulator.

Bug: 15383279
Change-Id: I4035193e6ab933194ff1417dfae4eab963fe5301
f8824aff68f63cf5484063bda4d5342034eb82c0 03-Jun-2014 Ying Wang <wangying@google.com> Allow to build the update.zip for emulator build.

img_from_target_files.py just skipps the boot.img and recovery.img since
there is no kernel or recovery.fstab for emulator.

Bug: 15383279
Change-Id: I4035193e6ab933194ff1417dfae4eab963fe5301
15d5348e6cc7a6fdae792ab308c23cb564e10f0b 14-May-2014 Geremy Condra <gcondra@google.com> Reopen temporary system image to avoid stale data.

NamedTemporaryFile's aggressive caching behavior can cause an issue
where changes made by another process aren't visible even after the
fseek() below or a flush(). To avoid this, simply open the file
again and read from the fresh version.

This fixes an issue where verity metadata written by append2simg
doesn't become visible to img_from_target_files.

Change-Id: I291fb3a95d5b532218ac6205ecc9e9b4f3a36bd4
5fad2039bbd4e55d671106c8b39a6e451b85ac23 24-Feb-2014 Doug Zongker <dougz@android.com> handle don't care regions in the system image

The system partitions has regions that we shouldn't write and can't
depend on the contents of. Adds a new script to generate a map of
these regions (using the sparse image as input), and include the map
in the package zip so it can be used when writing or patching the
system partition.

Also fixes a bug where the wrong SELinux file contexts are used when
generating incrementals.

Change-Id: Iaca5b967a3b7d1df843c7c21becc19b3f1633dad
36bd365625e6beba77698a93795a603180a5b476 07-Feb-2014 Geremy Condra <gcondra@google.com> Add support for block incremental OTAs

Change-Id: Ie72015e34ed8d7595a5c74c8df41cba73275afab
cf6d5a90740e50e03d9f16c6fd449d90d396f924 18-Feb-2014 Doug Zongker <dougz@android.com> bump releasetools python requirement to 2.7

These scripts already use some post-2.4 features, so let's make it
official: Python 2.7 is needed to run them.

Change-Id: I256e9ed99b0b62abe4e22a7b1f811acb7419e88e
01ce19c95f358ac8ef9bb939d2637ac976320401 04-Feb-2014 Doug Zongker <dougz@android.com> make full OTAs block based

Instead of writing individual files and fixing up their metadata, make
full OTAs contain a system image and simply write it to the block
device.

This is only done for target-files that already contain the recovery
flashing information, older target-files still get a file-based full
OTA.

Bug: 12893978
Change-Id: If7586083c8f275e24fec49d260af5b5aff4a0a88
e2e9f613b5259313c5216d4dad719998a2fbf014 29-May-2013 Kenny Root <kroot@google.com> Fix signing process for SELinux file_contexts

When not building locally and just using a target-files.zip from some
other build, it still tries to access the file_contexts from the out/
directory. This change instead looks at the unzipped target-files.zip
hierarchy to grab that information.

Bug: 9191141
Change-Id: I6ea12e82d6c6376fcada412314c5eefc97ff4853
a0febe5e6de24ffee5cd32944d5a1814cf312efb 20-Mar-2013 Ying Wang <wangying@google.com> Support to build vendor.img

Bug: 8341435
Change-Id: I2db7970936984d38aed35054e3f695d298f4e512
d7321d31accd344f4f2ad0a8e0b4f47be4d5128e 15-Mar-2013 Ying Wang <wangying@google.com> Skip userdata.img only if partition size is not give for extfs.

We still build yaffs2 images which don't need partition size.

Change-Id: I9c7f45069f25868666a257cee044faecf1a8781a
a7c8f72b4061091cb1eaddfb33408258017ee5d5 27-Nov-2012 Ying Wang <wangying@google.com> Use the correct size key

At this point, userdata_size has been converted to partition_size in
build_image.ImagePropFromGlobalDict().

Change-Id: Ida6be1905ca3109c2660274a16359a9f3fbcd94d
4e3f44f3564ff609a3075a863a132a84c22d308e 19-Nov-2012 Ying Wang <wangying@google.com> Skip userdata.img if no size is provided when building images from target files

Change-Id: Iab5c510fcc7608c4b109781e6595ab8964f4c543
56882bf9b41dc7f8b98f1dea82633144546450b2 09-Feb-2012 Stephen Smalley <sds@tycho.nsa.gov> Support the setting of file security contexts in OTA and update packages.

Pass the file_contexts configuration to the releasetools scripts
so that the security contexts of files can be properly set for OTA
and update packages.

Requires Ica5fb73d6f2ffb981b74d1896538988dbc4d9b24

Change-Id: I5a63fd61a7e74d386d0803946d06bcf2fa8a857e
9f8e8db188371cb3787a91a03d193f87ad244ea3 04-Nov-2011 Ying Wang <wangying@google.com> Build cache.img on demand

Bug: 5153694
To build cache.img, set BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE (required,
ext4 only for now), BOARD_CACHEIMAGE_PARTITION_SIZE (optional) in
BoardConfig.mk.

Change-Id: I1d8b91646aa1dba88285e008ad3335768bcbddd2
c0debb9b5e2f2f5deb00fb7db5b5c03177b06460 02-Nov-2011 Ying Wang <wangying@google.com> Revert "Build cache.img."

This reverts commit 531bdb546af5127ed9c1012871d780930eb990f5.
531bdb546af5127ed9c1012871d780930eb990f5 01-Nov-2011 Ying Wang <wangying@google.com> Build cache.img.

Change-Id: I3dbe7afa4934fa718ba20605eebd2e3ce2ae82ab
bd93d425aedef907d8fef643b748897e9c7dceeb 29-Oct-2011 Ying Wang <wangying@google.com> Unify the user image building code

Bug: 5398808

Before this change we have duplicate code in the Makefile and the
python-based releasetool. That's a real headache to maintain.

Change-Id: I8ddf04a79c6886540e89d990f723d8f77c9dd883
7e6d4e45d92fd51f42812ae63ac6e532887bfe0a 14-Dec-2010 Ying Wang <wangying@google.com> Close inherited PIPE before doing work

Gmake in Darwin has file descriptor leak.
In a full build, ota_from_target_files will inherits
more than 2000 open PIPEs from gmake and fails in a call to select.select().
This change fixes the build by closing the PIPEs before doing real work.

Change-Id: Ie7035d7add0b1da3afb6bf9c2009d40f8c7d29b3
55d932840f1a5b412f2961f79368ecec2d28f647 26-Jan-2011 Doug Zongker <dougz@android.com> support use of prebuilt bootable images

img_from_target_files now, with the -z flag, will produce an output
zip with only the bootable partitions (boot and recovery).

img_ and ota_from_target_files can take, instead of a simple
"target_files.zip", a name of the form
"target_files.zip+bootable_images.zip", where the second zip contains
bootable images that should be used instead of building them from the
target_files.zip. (This should be the zip produced by the above -z
flag, perhaps with the images messed with in some way, such as by an
unnamed OEM's extra signature wrapper for their "secure boot"
process.)

Bug: 3391371
Change-Id: Iaf96dfc8f30e806ae342dcf3241566e76ae372d4
085a14698b5d99b0b93ac70ea428c3c9e2277be2 18-Nov-2010 Ying Wang <wangying@google.com> Product-configurable sparse ext images.

Also pass extfs sparse image flag to the release tool.

Change-Id: I79a6a71873634a231aa8990cee22374259601505
f9bbfb577233bce7bb9a0ab7ec842074ce59e6e7 14-Dec-2010 Ying Wang <wangying@google.com> Close inherited PIPE before doing work

Gmake in Darwin has file descriptor leak.
In a full build, ota_from_target_files will inherits
more than 2000 open PIPEs from gmake and fails in a call to select.select().
This change fixes the build by closing the PIPEs before doing real work.

Change-Id: Ife021382198642a97bbbf0b623e4f24f3d86b2b2
c5a07ce038d7aeb62a5c02886cd2ecbf56687e9d 18-Nov-2010 Ying Wang <wangying@google.com> Pass extfs sparse image flag to the release tool.

Change-Id: Icb2a1c4fddb2b6153298ba1b849016aa3d792773
026f1451ce0c92c4630ca2d2d95f2fb9d68e9568 28-Sep-2010 Ying Wang <wangying@google.com> Fix userdata partition's ext4 mount point to data.

Bug: 3041475
Change-Id: I07306cd9c90072626dfc132d6655618ae70e64be
ad806982c12b64d8dff040f5c9a444d810d7694c 22-Sep-2010 Doug Zongker <dougz@android.com> arg: system_size, not system_img

Change-Id: Iba5d10204c93159a4f12ea8e8d8687db5b9dd5ca
33a4b08b151d2dedd67f41a4b25b297163795628 22-Sep-2010 Doug Zongker <dougz@android.com> fall back to MTD if no recovery.fstab is present

Needed for non-device builds (like for the emulator) to work.

Change-Id: I5fdbfb3af34821811744e8ce5bf1eff8df344c73
9ce0fb6e59415669074896cfa01e1f0cf97979b7 21-Sep-2010 Doug Zongker <dougz@android.com> support for per-partition fs_type

Include the recovery.fstab file in the recovery image. Remove the
global fs_type and partition_type values from the target-files
key/value dict, and parse the recovery.fstab file instead to find
types for each partition.

(Cherrypicked from gingerbread w/some edits to resolve conflicts.)

Change-Id: Ic3ed85ac5672d8fe20280dacf43d5b82053311bb
258bf46ea6bb4f25d01fab1b783238589e5bbec4 21-Sep-2010 Doug Zongker <dougz@android.com> support for per-partition fs_type (do not merge)

Include the recovery.fstab file in the recovery image. Remove the
global fs_type and partition_type values from the target-files
key/value dict, and parse the recovery.fstab file instead to find
types for each partition.

Change-Id: I35ee2dd0989441dc2a704b63c1b32e598049acb5
1684d9c0cf9f31a360e0e73dd6ed1e335d97f405 17-Sep-2010 Doug Zongker <dougz@android.com> remove remaining refs to max_image_sizes

Change-Id: I7e4686bc06f9c3eab2df34d092021c549738b217
37974731fcb4e32b1de5f213d34bd832ca889869 17-Sep-2010 Doug Zongker <dougz@android.com> consolidate target_files metadata into one key-value file

Instead of separate files for recovery api version, tool extensions,
and mkyaffs2 options, put those all in the generic key-value file.

Change-Id: Ib642311632844d52e4895fd4747093fc7e86232d
c77a9ad444d49e2ad777678cf5671f0a94f44ffb 16-Sep-2010 Doug Zongker <dougz@android.com> store user-visible image sizes in target-files

Do the yaffs-specific adjustments to image sizes in common.CheckSize,
instead of baking it into the image size stored in the target-files
package. Remove the special fs_type flag and fold it into the
"info_dict" we have for saving key-value pairs from the build system.

Change-Id: I6e63f3330f6277d9a946b22e66cadeb51203ba14
c19a8d5590a4ffd42b37ceaca2d779b48e481f99 02-Jul-2010 Doug Zongker <dougz@android.com> support for ext4/EMMC in target_files and OTA generation

Move the image sizes into a more generic key-value file. Make them
optional. Add additional key/value pairs describing what kind of
filesystem the device uses. Pass new fs-type-related arguments in
edify scripts when mounting and reformatting partitions.

Don't include all the init.*.rc files from the regular system in
recovery -- they aren't needed, and break recovery on some devices.

Change-Id: Ic1c651f754ed00ba1cffe8cf56c43f7f3b0ebfd7
39a984550f1d478ff49f7a189ec776761c7f2ce5 03-Sep-2010 Doug Zongker <dougz@android.com> return to using subprocess for running commands

Reverts Ic4f1c747 and fixes the problem by splitting the extra_flags
argument (it wasn't working before because it was getting one argument
"-c 4096 -s 128" instead of four arguments "-c", "4096", "-s", "128"
and mkyaffs2image apparently just ignores that bogus argument?)

Change-Id: Ib1e08d634aa68bfab0f7e09680d407f2cee0797d
c2d64c89481b3ff0a8f26d7675f282e0c08976c1 28-Aug-2010 Ying Wang <wangying@google.com> Fix bug.

Change-Id: I8bee35b7bb3fa0926f768d44a91cb45f76f224f9
Bug: 2957295
ae5531434877478985186dd0fb7ffefa12a74e52 27-Aug-2010 Ying Wang <wangying@google.com> Refactor a bit.

Change-Id: I4573e7a5239536f49571d9222865e2526da573c8
aa6dbe2144196bb6f9c1b6b539126250f9ef8af6 26-Aug-2010 Ying Wang <wangying@google.com> Try to fix system.img in update zip file.

Change-Id: Ic4f1c7478a22b1f8134ac768904e437fcfea700a
d421f57d22009e4d9ce71298c2f93636ff9e7d9d 26-Aug-2010 Ying Wang <wangying@google.com> Fix mkyaffs2image extra flags in the release tools.

Change-Id: I806e3e85ef89941edf04352331e25730c491c470
ee4bad51bc7ff49c37c9a105ad68dddf0a3b0d51 24-Aug-2010 Ying Wang <wangying@google.com> Disable CheckSize on ext partitions to fix build [DO NOT MERGE]

Original CL: 59920

Change-Id: I81437996670a61e10284293d25a08da8907ad296
065521be4fd6965058fbd599bb43fe13101fee7c 23-Aug-2010 Ying Wang <wangying@google.com> Backport ext4 support from master [DO NOT MERGE]

ext4 support is needed by crespo.

Change-Id: I604cb9ada526ce8ba6b3648171ac1d614a5519a9
48642604fd6fda55439178df11eba43ff646b357 04-Aug-2010 Colin Cross <ccross@android.com> Disable CheckSize on ext partitions to fix build

Change-Id: I66c67f8bbd84eb9da988b4079ad4c36089c1c930
ee81cd931c533b9a4231b4d4adc4cf41b8ac0df4 04-Aug-2010 Ying Wang <wangying@google.com> Pass partition size to mkuserimg.sh

Change-Id: Id6a53d8d552e8ce1bdf83fbb756724454e05e5c8
b4c7d32cbac0ef36062c4e2f348b47e027610eef 02-Jul-2010 Doug Zongker <dougz@android.com> support for ext4/EMMC in target_files and OTA generation

Move the image sizes into a more generic key-value file. Make them
optional. Add additional key/value pairs describing what kind of
filesystem the device uses. Pass new fs-type-related arguments in
edify scripts when mounting and reformatting partitions.

Don't include all the init.*.rc files from the regular system in
recovery -- they aren't needed, and break recovery on some devices.

Change-Id: I40e49e65f0d76f735259e4b4fef882322cd739da
933abf15bcd66138ba4e5fba7071e239a8662c6b 16-Jun-2010 Ying Wang <wangying@google.com> extfs support for img_from_target_files

Change-Id: Ie3df70426066bff467792b8528bc4528eb6afe15
e6b4e5b20ac8a3b01f1a99dd877a98c92036ce5e 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
239e9f2671eb641304716342e7188fb2a48fd462 30-Sep-2009 Mike Ritter <mritter@google.com> Bug in Mac build where it gets confused over case, fix no longer needed.
(cherry picked from commit e44fadeb49aac9d762f089ee2f23e4a4907a822f)
e44fadeb49aac9d762f089ee2f23e4a4907a822f 15-Sep-2009 Mike Ritter <mritter@google.com> Bug in Mac build where it gets confused over case, fix no longer needed.
fdd8e69c42e66fb70384bcaca1747f504f2c021c 04-Aug-2009 Doug Zongker <dougz@android.com> use the max image sizes from the target files zip

For some time now the build system has included all the max image
sizes in a file in the META directory. Use these instead of needing
to parse the BoardConfig.mk file for the device at the time of
building an image or OTA package.
048e7ca15f6391681490ce564bc71194adf146aa 15-Jun-2009 Doug Zongker <dougz@android.com> fix archive files being created with perms 000

In python 2.5 and earlier, ZipFile.writestr(filename, data) results in
the file being added to the archive with permissions 000. (See
http://svn.python.org/view?view=rev&revision=65235.) Work around this
by creating a ZipInfo object and setting the permissions explicitly.
dbfb20ccd895d6ed84b95670fe2b9a0a34b17b7c 03-Apr-2009 Doug Zongker <> AI 144399: am: CL 144270 am: CL 144269 Relocate the new (google-indepedent) tools for signing and
building images & OTA packages out of vendor/google.
No device code is touched by this change.
Original author: dougz
Merged from: //branches/cupcake/...
Original author: android-build

Automated import of CL 144399
eef3944eb3673329b5e89cf188ac592805a0b08d 02-Apr-2009 Doug Zongker <> AI 144270: am: CL 144269 Relocate the new (google-indepedent) tools for signing and
building images & OTA packages out of vendor/google.
No device code is touched by this change.
Original author: dougz
Merged from: //branches/cupcake/...

Automated import of CL 144270
ad44c07ac7c505a7b6b5ef14c7234c58e3b919d0 02-Apr-2009 Doug Zongker <> AI 144269: Relocate the new (google-indepedent) tools for signing and
building images & OTA packages out of vendor/google.
No device code is touched by this change.
BUG=1753409

Automated import of CL 144269