1 zipalign -- zip archive alignment tool 2 3 usage: zipalign [-f] [-v] <align> infile.zip outfile.zip 4 zipalign -c [-v] <align> infile.zip 5 6 -c : check alignment only (does not modify file) 7 -f : overwrite existing outfile.zip 8 -p : page align stored shared object files 9 -v : verbose output 10 <align> is in bytes, e.g. "4" provides 32-bit alignment 11 infile.zip is an existing Zip archive 12 outfile.zip will be created 13 14 15 The purpose of zipalign is to ensure that all uncompressed data starts 16 with a particular alignment relative to the start of the file. This 17 allows those portions to be accessed directly with mmap() even if they 18 contain binary data with alignment restrictions. 19 20 Some data needs to be word-aligned for easy access, others might benefit 21 from being page-aligned. The adjustment is made by altering the size of 22 the "extra" field in the zip Local File Header sections. Existing data 23 in the "extra" fields may be altered by this process. 24 25 Compressed data isn't very useful until it's uncompressed, so there's no 26 need to adjust its alignment. 27 28 Alterations to the archive, such as renaming or deleting entries, will 29 potentially disrupt the alignment of the modified entry and all later 30 entries. Files added to an "aligned" archive will not be aligned. 31 32 By default, zipalign will not overwrite an existing output file. With the 33 "-f" flag, an existing file will be overwritten. 34 35 You can use the "-c" flag to test whether a zip archive is properly aligned. 36 37 The "-p" flag aligns any file with a ".so" extension, and which is stored 38 uncompressed in the zip archive, to a 4096-byte page boundary. This 39 facilitates directly loading shared libraries from inside a zip archive. 40 41