Commit graph

55 commits

Author SHA1 Message Date
Tianjie Xu
7b0ad9c638 Switch recovery to libbase logging
Clean up the recovery image and switch to libbase logging.

Bug: 28191554
Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35
Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
2016-09-01 18:33:25 +00:00
Tao Bao
eef053fda1 Merge "updater, minzip: Remove unnecessary O_SYNC flags." am: c7d7eb2225
am: d03ee52eb7

* commit 'd03ee52eb77d9339b6445d3b4ee5ab7678007c7c':
  updater, minzip: Remove unnecessary O_SYNC flags.

Change-Id: If20abd466bc7e6e918491e168bc00447d36f33da
2016-05-08 18:06:38 +00:00
Alistair Strachan
733285fea2 updater, minzip: Remove unnecessary O_SYNC flags.
Remove O_SYNC from mzExtractRecursive() and PackageExtractFileFn().
These functions deal with extracting whole files from the update
package onto a filesystem. If run on ext4 on a rotating disk, for
example, the O_SYNC flag will cause serious performance problems
and the extraction proecss can take over 30 minutes, with no
obvious benefits.

This API function already calls fsync(fd) after each file is
extracted to ensure data and metadata is written to the underlying
block device, so the O_SYNC calls should be superfluous and safely
removable.

This change does not affect the OTA patch paths or any modification
of the bootloader partition or writes to other 'emmc' partitions.

Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
Change-Id: I9cbb98a98e6278bf5c0d7efaae340773d1fbfcd2
2016-05-05 16:04:58 -07:00
Elliott Hughes
5c23b801e5 Merge "Move selinux dependencies out of header files." am: 8124750
am: dc91161

* commit 'dc91161a56c74bb6c73560d728d92b115f0f6e75':
  Move selinux dependencies out of header files.

Change-Id: I439d352c9366dbed201a5592059b886968324633
2016-04-02 16:06:57 +00:00
Elliott Hughes
4bbd5bf8a6 Move selinux dependencies out of header files.
Bug: http://b/27764900
Change-Id: Ib62a59edcb13054f40f514c404d32b87b14ed5f1
2016-04-01 18:24:39 -07:00
caozhiyuan
9570508c0b Merge "Fix: full ota package larger than 2GB fails to upgrade"
am: 867e60d

* commit '867e60db16d2ec687a12e525cf26f203da8396b2':
  Fix: full ota package larger than 2GB fails to upgrade
2016-03-21 19:15:49 +00:00
caozhiyuan
2584f9c24d Fix: full ota package larger than 2GB fails to upgrade
Change-Id: I45d9fab8739cc6fa8a0bacaca9238896118d9d7f
Signed-off-by: diruomeng <di.ruomeng@zte.com.cn>
Signed-off-by: caozhiyuan <cao.zhiyuan@zte.com.cn>
2016-03-21 10:21:03 -07:00
Tianjie Xu
cc5372006f Merge "Surpress warnings in minzip/Zip.c" am: 4b3cdce702
am: 0d63468171

* commit '0d63468171a80bd84a859fbd36b8d874f030c764':
  Surpress warnings in minzip/Zip.c
2016-02-23 19:30:13 +00:00
Tianjie Xu
6629655476 Surpress warnings in minzip/Zip.c
bootable/recovery/minzip/Zip.c:514:5: warning: Value stored to 'compRemaining' is never read
    compRemaining = pEntry->compLen;
        ^               ~~~~~~~~~~~~~~~
  bootable/recovery/minzip/Zip.c:778:9: warning: Null pointer argument in call to memory copy function
    memcpy(p, helper->targetDir, helper->targetDirLen);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Bug: 27229894
Change-Id: I0482bac3a4fcddc191783d1e5b5a83cf29fa4e85
2016-02-23 11:15:43 -08:00
Yabin Cui
80563ee93a resolve merge conflicts of e5d3d15cd2 to nyc-dev
am: 0d28ba452f

* commit '0d28ba452fb8884f3dfeb20fab193be5343ec29e':
  Fix integer overflows in recovery procedure.
2016-02-23 06:46:45 +00:00
Yabin Cui
0d28ba452f resolve merge conflicts of e5d3d15cd2 to nyc-dev
Change-Id: Ie8b30e6b114b648e8c03866456c64cf8b740d1e3
2016-02-22 22:16:44 -08:00
Yabin Cui
4f2df162c6 Fix integer overflows in recovery procedure.
Bug: 26960931
Change-Id: Ieae45caccfb4728fcf514f0d920976585d8e6caf
(cherry picked from commit a029c9a458)
2016-02-22 11:02:08 -08:00
Yabin Cui
4425c1d960 Fix some memory leaks.
Bug: 26906328
Change-Id: Iebaf03db0cb3054f91715f8c849be6087d01b27b
2016-02-10 15:32:19 -08:00
Tao Bao
dd4d9818a8 Clean up LOG functions.
For fatal errors, use LOGE to show messages.

Bug: 22236461
Change-Id: I2b7d761576894ac37fcbadcba690ae14affe8f07
(cherry picked from commit d7d0f75034)
2015-07-16 22:12:32 -07:00
Tao Bao
d7d0f75034 Clean up LOG functions.
For fatal errors, use LOGE to show messages.

Bug: 22236461
Change-Id: Ie2ce7ec769f4502d732fbb53fb7b303c0cf9ed68
2015-07-16 13:43:46 -07:00
Tao Bao
485b63702c recovery: Switch applypatch/ and updater/ to cpp.
Mostly trivial changes to make cpp compiler happy.

Change-Id: I1b0481465c67c3bbca35a839d0764190d84ff34e
(cherry picked from commit ba9a42aa7e)
2015-07-13 23:25:46 -07:00
Tao Bao
ba9a42aa7e recovery: Switch applypatch/ and updater/ to cpp.
Mostly trivial changes to make cpp compiler happy.

Change-Id: I69bd1d96fcccf506007f6144faf37e11cfba1270
2015-07-13 17:21:31 -07:00
Elliott Hughes
f267dee1ca Just use fstat in sysMapFile.
Also turn on -Werror and remove a dead function.

Change-Id: I436f0a91c40e36db985190b3b98b0a4527cf0eeb
2015-06-23 12:31:02 -07:00
Tao Bao
80e46e08de recovery: Switch to clang
And a few trival fixes to suppress warnings.

Change-Id: I38734b5f4434643e85feab25f4807b46a45d8d65
2015-06-03 11:30:03 -07:00
Elliott Hughes
2f5feedf1d Check all lseek calls succeed.
Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek.

Bug: http://b/20625546
Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b
(cherry picked from commit 7bad7c4646)
2015-04-29 21:14:56 -07:00
Elliott Hughes
7bad7c4646 Check all lseek calls succeed.
Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek.

Bug: http://b/20625546
Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b
2015-04-29 17:46:43 -07:00
Elliott Hughes
9ad9d66f81 Remove a couple of unused inlines from minzip/Zip.h.
Change-Id: I805883e3863673416898bdef39c5703ca33f18e0
2015-04-08 12:08:32 -07:00
Narayan Kamath
9c0f5d6b34 Remove more dead code from minzip.
I've added explanatory comments to mzExtractRecursive because
that function will live on as a utility even after we move the
zip format related logic to libziparchive.

bug: 19472796

(cherry-picked from commit c9ccdfd7a42de08c47ab771b94dc5b9d1f957b95)

Change-Id: I8b7fb6fa3eafb2e7ac080ef7a7eceb691b252d8a
2015-02-27 12:58:16 +00:00
Narayan Kamath
6f58e899be am 829d392a: Merge "Delete unused functions from minzip."
* commit '829d392a75f536861adfddefc21ec635f3460144':
  Delete unused functions from minzip.
2015-02-24 13:18:14 +00:00
Narayan Kamath
3e700cff53 Delete unused functions from minzip.
This is in preparation of replacing it with libziparchive and
providing shim wrappers.

bug: 19472796
Change-Id: I1f2fb59ee7a41434e794e4ed15b754aa2b74a11d
2015-02-23 13:29:16 +00:00
Nick Kralevich
ec5c1c1e29 am 99e084ca: Merge "Remove dead/unused code and realign some of the comments to make it more cleaner and easier to read"
* commit '99e084ca8012bc7af52ae2fb9e72ab7180177daf':
  Remove dead/unused code and realign some of the comments to make it more cleaner and easier to read
2015-02-08 15:20:50 +00:00
Nanik Tolaram
4e8e93b666 Remove dead/unused code and realign some of the comments
to make it more cleaner and easier to read

Change-Id: If536d482c0ed645368084e76d8ec060f05d89137
Signed-off-by: Nanik Tolaram <nanikjava@gmail.com>
2015-02-08 22:31:14 +11:00
Michael Runge
042c3cd04e Force sync files written by minzip.
Some files appear to be missing their sync to disk.

Bug: 18145574
Change-Id: Ic858624a4dd65bbfc54d30f3a13c607078270345
2014-10-28 19:49:57 -07:00
Michael Runge
f5d9f89152 Allow 0-byte files in full OTAs.
Currently, the writeProcessFunction fails when
there are zero bytes to write, potentially returning
errno from a previous operation, or hanging
indefinitely while it waits for a >0 result on a
write of size 0.  This happens when the output
file is intended to be zero bytes in size.

Change-Id: Ib3cfcaf66d82942bc89e5f5c64697862403b38da
2014-05-09 18:09:28 +00:00
Mark Salyzyn
76b245c24c minzip: 64 bit build issue
Regression - verification and extraction on memory, not files

Bug: 12188746
Change-Id: Ib6facc4aff6be3a31a7d184ef1c493fdd4012c21
2014-03-17 16:05:12 -07:00
Doug Zongker
a9300301ce add mzGetStoredEntry function
mzGetStoredEntry gives you a pointer and address to the data of a zip
entry, assuming that entry is stored rather than deflated.

Change-Id: Ifb39777c98d1d50475ef7de419cf28935f5f9965
2014-02-13 08:30:41 -08:00
Colin Cross
707d321a87 am 2739ed96: am a5d105e2: Merge "recovery: fix building with pointer-to-int errors turned on"
* commit '2739ed9628f72813d213b7a429c4c1b8dcebe5fc':
  recovery: fix building with pointer-to-int errors turned on
2014-02-06 03:07:48 +00:00
Colin Cross
92cdf9c372 recovery: fix building with pointer-to-int errors turned on
Use intptr_t/uintptr_t to cast between pointer and int to allow
building with -Werror=pointer-to-int-cast and
Werror=int-to-pointer-cast turned on.

Cast to char* instead of unsigned int for pointer arithmetic.

Change-Id: Ia862306fdcca53866b330e8cf726f3d62f2248a0
2014-02-05 17:34:45 -08:00
Doug Zongker
19a8e2463c log extra info for debugging
Make recovery log its PID, and when we use a block map file, log how
many ranges it contains.

Change-Id: I1b4299f8163af68a770b48c029ae25e6cb45d26b
2014-01-21 09:25:41 -08:00
Doug Zongker
99916f0496 do verification and extraction on memory, not files
Changes minzip and recovery's file signature verification to work on
memory regions, rather than files.

For packages which are regular files, install.cpp now mmap()s them
into memory and then passes the mapped memory to the verifier and to
the minzip library.

Support for files which are raw block maps (which will be used when we
have packages written to encrypted data partitions) is present but
largely untested so far.

Bug: 12188746
Change-Id: I12cc3e809834745a489dd9d4ceb558cbccdc3f71
2014-01-16 13:29:28 -08:00
Doug Zongker
2768efdf9f remove dead code from minzip
minzip had some features that were used when reading APKs, but APK
handling now uses libziparchive instead of minzip.  Remove these
unused functions.

Change-Id: Iead89209a716bfe9e3d339bf85b3e97e33a41f35
2014-01-13 10:51:13 -08:00
Nick Kralevich
46ab1b6138 updater: Delete dead code
set_perm and set_perm_recursive are no longer used. Delete.

(cherry picked from commit 08ef9a9570)

Change-Id: I1bcc90ae19af9df4f0705496c5876987159f75ac
2013-09-17 10:20:45 -07:00
Nick Kralevich
08ef9a9570 updater: Delete dead code
set_perm and set_perm_recursive are no longer used. Delete.

Change-Id: I3bb40b934b6c093b24b88aa4ed6f3c7de2bb52f0
2013-09-11 11:37:10 -07:00
Nick Kralevich
3328e3bc81 Revert "Update OTA installer to understand SELinux filesystem labels"
This reverts commit 627eb30f73.

Bug: 10183961
Bug: 10186213
2013-09-09 10:47:14 -07:00
Nick Kralevich
627eb30f73 Update OTA installer to understand SELinux filesystem labels
Modify the OTA installer to understand SELinux filesystem labels.

We do this by introducing new set_perm2 / set_perm2_recursive
calls, which understand SELinux filesystem labels. These filesystem
labels are applied at the same time that we apply the
UID / GID / permission changes.

For compatibility, we preserve the behavior of the existing
set_perm / set_perm_recursive calls.

If the destination kernel doesn't support security labels, don't
fail. SELinux isn't enabled on all kernels.

Bug: 8985290
Change-Id: I99800499f01784199e4918a82e3e2db1089cf25b
2013-07-18 15:21:12 -07:00
Elliott Hughes
9da1880118 am 9028fb4d: Merge "Pass the correct pointer to munmap on failure."
* commit '9028fb4d4ceed040c7d3ae9b1ceaa5a7472856ba':
  Pass the correct pointer to munmap on failure.
2012-12-17 12:11:47 -08:00
Elliott Hughes
c86f22c131 Pass the correct pointer to munmap on failure.
This won't ever happen, and you're probably screwed anyway if it
does, but that's no excuse...

Change-Id: I2c56f607e351e84308a72b41b834d13aaa98fc62
2012-12-17 09:26:50 -08:00
Doug Zongker
bf80f49edc reduce some recovery logging
Make minzip log only a count of files when extracting, not individual
filenames.  Make patching only chatter about free space if there's not
enough and compact the other messages.

Only the last 8k of the recovery log gets uploaded; this makes it more
likely that we will get all of it.

Change-Id: I529cb4947fe2185df82b9da5fae450a7480dcecd
2012-10-19 12:24:26 -07:00
Kenny Root
7eb7567aa3 Remove HAVE_SELINUX guards
Change-Id: Ia96201f20f7838d7d9e8926208977d3f8318ced4
2012-10-16 12:57:26 -07:00
Edwin Vane
0298ec21d2 Fix multiple defined symbol errors
Use of __inline__ by projects in bootable/* was causing problems with
clang. Following the BKM and replaced use of __inline__ with
__attribute((__gnu_inline)).

Change-Id: If4ccfded685bb2c9d9c23c9b92ee052208399ef0
Author: Edwin Vane <edwin.vane@intel.com>
Reviewed-by: Kevin P Schoedel <kevin.p.schoedel@intel.com>
2012-08-21 16:04:21 -04:00
Kenny Root
41dda82d84 resolved conflicts for merge of 0b1fee1b to master
Change-Id: I2e8298ff5988a96754f56f80a5186c9605ad9928
2012-03-30 21:26:01 -07:00
Stephen Smalley
779701db51 Extend recovery and updater to support setting file security contexts.
Extend minzip, recovery, and updater to set the security context on
files based on the file_contexts configuration included in the package.

Change-Id: Ied379f266a16c64f2b4dca15dc39b98fcce16f29
2012-03-30 09:32:46 -04:00
Doug Zongker
28ce47cfa6 turn recovery into a C++ binary
Change-Id: I423a23581048d451d53eef46e5f5eac485b77555
2011-10-31 10:24:09 -07:00
Doug Zongker
6aece33b3f add a one-argument version of package_extract_file
Add a version of package_extract_file that returns the file data as
its return value (to be consumed by some other edify function that
expects to receive a bunch of binary data as an argument).  Lets us
avoid having two copies of a big file in memory (extracting it into
/tmp, which is a ramdisk, and then having something load it into
memory) when doing things like radio updates.

Change-Id: Ie26ece5fbae457eb0ddcd8a13d74d78a769fbc70
2010-02-01 14:40:12 -08:00
Doug Zongker
1c4ceae38f undo temporary alignment hack
Remove the memory alignment that mysteriously made OTA installs work,
in anticipation of a kernel that fixes the actual problem.  Handle
EINTR properly.
2009-05-08 09:43:28 -07:00