Commit graph

1381 commits

Author SHA1 Message Date
Tao Bao
1171d3a12b Add update_verifier for A/B OTA update.
update_verifier checks the integrity of the updated system and vendor
partitions on the first boot post an A/B OTA update. It marks the
current slot as having booted successfully if it passes the verification.

This CL doesn't perform any actual verification work which will be
addressed in follow-up CLs.

Bug: 26039641
Change-Id: Ia5504ed25b799b48b5886c2fc68073a360127f42
2015-12-07 10:25:02 -08:00
David Zeuthen
846c094fee Add slot_suffix field to struct bootloader_message.
This is needed by fs_mgr for certain A/B implementations.

Change-Id: I7bb404d61198eb7a962c2b693911f5156745daae
2015-11-16 14:28:40 -08:00
Tao Bao
8f90389966 recovery: Allow "Mount /system" for system_root_image.
When system images contain the root directory, there is no entry of
"/system" in the fstab. Change it to look for "/" instead if
ro.build.system_root_image is true. We actually mount the partition
to /system_root instead, and create a symlink to /system_root/system
for /system. This allows "adb shell" to work properly.

Bug: 22855115
Change-Id: I91864444950dc3229fda3cc133ddbadeb8817fb8
(cherry picked from commit abb8f7785e)
2015-11-16 14:28:40 -08:00
Tao Bao
32ac97675b applypatch: Fix the checking in WriteToPartition().
WriteToPartition() should consider a target name as valid if it contains
multiple colons. But only the first two fields will be used.

Bug: 22725128
Change-Id: I9d0236eaf97df9db9704acf53690d0ef85188e45
(cherry picked from commit 1ce7a2a63d)
2015-11-16 14:28:40 -08:00
Tao Bao
f47259b184 applypatch: Support flash mode.
We may carry a full copy of recovery image in the /system, and use
/system/bin/install-recovery.sh to install the recovery. This CL adds
support to flash the recovery partition with the given image.

Bug: 22641135
Change-Id: I345eaaee269f6443527f45a9be7e4ee47f6b2b39
(cherry picked from commit 68c5a67967)
2015-11-16 14:28:40 -08:00
Tao Bao
3b199267d6 updater: libapplypatch needs libbase now.
Change-Id: Ibe3173edd6274b61bd9ca5ec394d7f6b4a403639
(cherry picked from commit 1b1ea17d55)
2015-11-16 14:28:40 -08:00
Tao Bao
27604fcbee applypatch: Refactor strtok().
We have android::base::Split() for the work.

Change-Id: Ic529db42090f700e6455d465c8b84b7f52d34d63
(cherry picked from commit 0a47ce27de)
2015-11-16 14:28:40 -08:00
Tao Bao
818fa781d1 DO NOT MERGE recovery: Switch applypatch/ and updater/ to cpp.
Mostly trivial changes to make cpp compiler happy.

Change-Id: I69bd1d96fcccf506007f6144faf37e11cfba1270
(cherry picked from commit ba9a42aa7e)
2015-11-16 14:28:40 -08:00
Sami Tolvanen
806f72f9e6 Add error and range checks to parse_range
Only trusted input is passed to parse_range, but check for invalid
input to catch possible problems in transfer lists.

Bug: 21033983
Bug: 21034030
Bug: 21034172
Bug: 21034406
Change-Id: I1e266de3de15c99ee596ebdb034419fdfe7eba1f
(cherry picked from commit f2bac04e1b)
2015-11-16 14:28:40 -08:00
Dan Albert
56deefba73 Stop using libstdc++.
These are already getting libc++, so it isn't necessary. If any of the
other static libraries (such as adb) use new or delete from libc++,
there will be symbol collisions.

Change-Id: I55e43ec60006d3c2403122fa1174bde06f18e09f
(cherry picked from commit e49a9e527a)
2015-11-16 14:28:40 -08:00
Tao Bao
7101b2e285 recovery: Switch to clang
And a few trival fixes to suppress warnings.

Change-Id: Id28e3581aaca4bda59826afa80c0c1cdfb0442fc
(cherry picked from commit 80e46e08de)
2015-11-16 14:28:40 -08:00
Narayan Kamath
cde720797f am 838768ca: am 15da523e: am 3c7f655b: (-s ours) am 0e804d54: am d396b9db: am 710b6bb9: am ec4b58ad: (-s ours) am ec63d564: Track usage of Vector / SortedVector from libutils DO NOT MERGE
* commit '838768ca57d087025dbd31587ee895150bca9e10':
  Track usage of Vector / SortedVector from libutils DO NOT MERGE
2015-09-16 23:12:11 +00:00
Narayan Kamath
838768ca57 am 15da523e: am 3c7f655b: (-s ours) am 0e804d54: am d396b9db: am 710b6bb9: am ec4b58ad: (-s ours) am ec63d564: Track usage of Vector / SortedVector from libutils DO NOT MERGE
* commit '15da523e5fe7dbdc3a8d49c809042bc760081920':
  Track usage of Vector / SortedVector from libutils DO NOT MERGE
2015-09-16 23:06:09 +00:00
Narayan Kamath
15da523e5f am 3c7f655b: (-s ours) am 0e804d54: am d396b9db: am 710b6bb9: am ec4b58ad: (-s ours) am ec63d564: Track usage of Vector / SortedVector from libutils DO NOT MERGE
* commit '3c7f655bf0382776617d3c98293e28d9967c9a96':
  Track usage of Vector / SortedVector from libutils DO NOT MERGE
2015-09-16 22:57:58 +00:00
Narayan Kamath
3c7f655bf0 am 0e804d54: am d396b9db: am 710b6bb9: am ec4b58ad: (-s ours) am ec63d564: Track usage of Vector / SortedVector from libutils DO NOT MERGE
* commit '0e804d542a2c151d254cad0d8581d9709a394a9a':
  Track usage of Vector / SortedVector from libutils DO NOT MERGE
2015-09-16 22:48:24 +00:00
Narayan Kamath
0e804d542a am d396b9db: am 710b6bb9: am ec4b58ad: (-s ours) am ec63d564: Track usage of Vector / SortedVector from libutils DO NOT MERGE
* commit 'd396b9dbd99924f7c8687227b22220a87c85d9c7':
  Track usage of Vector / SortedVector from libutils DO NOT MERGE
2015-09-16 22:33:14 +00:00
Narayan Kamath
d396b9dbd9 am 710b6bb9: am ec4b58ad: (-s ours) am ec63d564: Track usage of Vector / SortedVector from libutils DO NOT MERGE
* commit '710b6bb9d7d36ce16453850efc3112016a77e9ff':
  Track usage of Vector / SortedVector from libutils DO NOT MERGE
2015-09-12 06:30:01 +00:00
Narayan Kamath
710b6bb9d7 am ec4b58ad: (-s ours) am ec63d564: Track usage of Vector / SortedVector from libutils DO NOT MERGE
* commit 'ec4b58ad8a21b511bf6b136792bb924eb6e9e299':
  Track usage of Vector / SortedVector from libutils DO NOT MERGE
2015-09-10 20:55:33 +00:00
Narayan Kamath
ec4b58ad8a am ec63d564: Track usage of Vector / SortedVector from libutils DO NOT MERGE
* commit 'ec63d564a86ad5b30f75aa307b4bd271f6a96a56':
  Track usage of Vector / SortedVector from libutils DO NOT MERGE
2015-09-10 18:26:12 +00:00
Narayan Kamath
ec63d564a8 Track usage of Vector / SortedVector from libutils DO NOT MERGE
bug: 22953624
Change-Id: Ifcc17e39433ac91ca41da5d336fb3006dfbb65a8
2015-09-09 10:42:10 +00:00
Tao Bao
8e9c68019f recovery: Fix the bug that truncates menu entries.
When there are 20 entries (like 10 last_log* and 10 last_kmg* in "view
recovery logs"), there's no "Back" entry. Because the number of entries
(21) exceeds text_rows (20) in WearRecoveryUI::StartMenu(). Since we
have scrollable menu, having more entries than text_rows won't be an
issue.

Bug: 23752519
Change-Id: I12573d7a34852a1a3d130c9e88522cee737eb08f
2015-09-02 14:38:23 -07:00
Tao Bao
337db14f27 recovery: Factor out wear_ui.{cpp,h} into bootable/recovery.
Every watch has a (mostly identical) copy of the wear_ui. Factor them
out into a single copy for easier maintenance. Device-specific settings
should be defined in recovery_ui.cpp that inherits WearRecoveryUI class.

Bug: 22451422
Change-Id: Id07efca37d1b1d330e6327506c7b73ccf6ae9241
2015-08-24 17:31:47 -07:00
Tao Bao
5aa3ce3aaa am be19dce8: udpater: Call fsync() after rename().
* commit 'be19dce86ce7d4a83f1cfcd11db393f8be8f4397':
  udpater: Call fsync() after rename().
2015-08-04 21:01:11 +00:00
Tao Bao
be19dce86c udpater: Call fsync() after rename().
We need to ensure the renamed filename reaches the underlying storage.

Bug: 22840552
Change-Id: I824b6e9d8a9c5966035be7b42a73678d07376342
(cherry picked from commit dc3922622a)
2015-08-04 11:28:12 -07:00
Tao Bao
6e9dda70cb uncrypt: Support file level encryption.
Bug: 22534003
Change-Id: Iaf42a6e5b40cfef904de66e212ae8b77b2953ef7
2015-07-16 20:04:39 -07:00
Paul Lawrence
90c75b0beb Change init sequence to support file level encryption
File level encryption must get the key between mounting userdata and
calling post_fs_data when the directories are created. This requires
access to keymaster, which in turn is found from a system property.

Split property loaded into system and data, and load in right order.

Bug: 22233063
Change-Id: I409c12e3f4a8cef474eb48818e96760fe292cc49
2015-07-07 13:26:17 -07:00
Paul Lawrence
10cf0942a7 Merge "Revert "Change init sequence to support file level encryption"" into mnc-dev 2015-07-07 17:29:02 +00:00
Paul Lawrence
392879eec0 Revert "Change init sequence to support file level encryption"
This reverts commit 98c1a3de23.

Change-Id: I524060418de18f97c3865ebc4435f501015e92ee
2015-07-07 17:05:39 +00:00
Paul Lawrence
d6b2b65dc4 Merge "Change init sequence to support file level encryption" into mnc-dev 2015-07-06 19:33:28 +00:00
Paul Lawrence
98c1a3de23 Change init sequence to support file level encryption
File level encryption must get the key between mounting userdata and
calling post_fs_data when the directories are created. This requires
access to keymaster, which in turn is found from a system property.

Split property loaded into system and data, and load in right order.

Bug: 22233063
Change-Id: I409c12e3f4a8cef474eb48818e96760fe292cc49
2015-07-06 10:44:33 -07:00
Mohamad Ayyash
501282a42d am b4b41daa: am 0ddfa329: Allow mounting squashfs partitions
* commit 'b4b41daa2ddbe8849dacdeeafd240e2a265cb594':
  Allow mounting squashfs partitions
2015-07-02 00:47:06 +00:00
Mohamad Ayyash
b4b41daa2d am 0ddfa329: Allow mounting squashfs partitions
* commit '0ddfa329acb1e6464fe5d66b58257013abf21116':
  Allow mounting squashfs partitions
2015-07-02 00:30:57 +00:00
Vincent Palatin
8409b08888 Merge "Add drm support to minui" into mnc-dev 2015-07-01 23:24:55 +00:00
Stéphane Marchesin
1a92c4458d Add drm support to minui
Bug: 22231636

Change-Id: I103c8e906b7dd9862b7bb89d8642268e9a3006b4
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
2015-07-01 15:27:48 -07:00
Mohamad Ayyash
0ddfa329ac Allow mounting squashfs partitions
Change-Id: Ic023eb7d8a11e2a65172a23ff39fa902ef566183
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
2015-07-01 10:13:16 -07:00
Tao Bao
7125f9594d Revert "Zero blocks before BLKDISCARD"
This reverts commit b65f0272c8.

It slows down the update too much on some devices (e.g. increased
from 8 mins to 40 mins to take a full OTA update).

Bug: 22129621
Change-Id: I4e8d4f6734967caf4f0d19c734027f7b6c107370
2015-06-30 23:10:44 -07:00
Tao Bao
c3dddce205 More accurate checking for overlapped ranges.
A RangeSet has half-closed half-open bounds. For example, "3,5" contains
blocks 3 and 4. So "3,5" and "5,7" are actually not overlapped.

Bug: 22098085
Change-Id: I362d259f8b5d62478858ad0422b635bc5068698d
(cherry picked from commit c0f56ad766)
2015-06-26 13:48:46 -07:00
caozhiyuan
cb9450e113 Use f_bavail to calculate free space
Failures are seen on devices with
Linux 3.10. And they are mainly due to this change:
https://lwn.net/Articles/546473/
The blocks reserved in this change is not the same thing as what we
think are reserved for common usage of root user. And this part is
included in free blocks but not in available blocks.

Bug: 22118089
Change-Id: I81c9531703298019a4fc11839f28d2cc8b9df34e
(cherry picked from commit 3b4977638f)
2015-06-26 11:17:02 -07:00
Elliott Hughes
c35f3ce30e Allow sideloading without authentication.
Bug: http://b/22025550
Change-Id: I20f09ae442536f924f19ede0abf6a2bcc0a5cedf
(cherry picked from commit 9813f5ba57)
2015-06-23 11:34:07 -07:00
Sami Tolvanen
d7c9bf41da Merge "Zero blocks before BLKDISCARD" into mnc-dev 2015-06-10 21:50:03 +00:00
Elliott Hughes
0005f89c31 Split WipeData into PreWipeData and PostWipeData.
Bug: http://b/21760064
Change-Id: Idde268fe4d7e27586ca4469de16783f1ffdc5069
(cherry picked from commit 945548ef7b)
2015-06-10 14:11:08 -07:00
Sami Tolvanen
b65f0272c8 Zero blocks before BLKDISCARD
Due to observed BLKDISCARD flakiness, overwrite blocks that we want
to discard with zeros first to avoid later issues with dm-verity if
BLKDISCARD is not successful.

Bug: 20614277
Bug: 20881595
Change-Id: I4f6f2db39db990879ff10468c9db41606497bd6f
(cherry picked from commit a3c75e3ea6)
2015-06-10 20:36:02 +01:00
Sami Tolvanen
6abd52f62b Revert "Zero blocks before BLKDISCARD"
This reverts commit 604c583c9d.

Change-Id: I2b0b283dc3f44bae55c5e9f7231d7c712630c2b5
2015-06-10 15:52:04 +00:00
Sami Tolvanen
604c583c9d Zero blocks before BLKDISCARD
Due to observed BLKDISCARD flakiness, overwrite blocks that we want
to discard with zeros first to avoid later issues with dm-verity if
BLKDISCARD is not successful.

Bug: 20614277
Bug: 20881595
Change-Id: I0280fe115b020dcab35f49041fb55b7f8e793da3
(cherry picked from commit 96392b97f6)
2015-06-09 22:21:44 +01:00
Tao Bao
02b6472546 Merge "uncrypt: Write status when it reboots to factory reset" into mnc-dev 2015-05-29 22:02:27 +00:00
Tao Bao
2c2cae8a4a uncrypt: Write status when it reboots to factory reset
When it reboots into recovery for a factory reset, it still needs to
write the uncrypt status (-1) to the pipe.

Bug: 21511893
Change-Id: I1a725820f1e1875146e49b5a6f28af2fbf284fc7
2015-05-29 14:24:02 -07:00
Elliott Hughes
b5dabd25e1 Really don't use TEMP_FAILURE_RETRY with close in recovery.
I missed one last time.

Bug: http://b/20501816
Change-Id: I9896ee2704237d61ee169f898680761e946e0a56
(cherry picked from commit b3ac676192)
2015-05-29 11:03:44 -07:00
Sami Tolvanen
92eea1bc41 Handle BLKDISCARD failures
In the block updater, if BLKDISCARD fails, the error is silently
ignored and some of the blocks may not be erased. This means the
target partition will have inconsistent contents.

If the ioctl fails, return an error and abort the update.

Bug: 20614277
Change-Id: I33867ba9337c514de8ffae59f28584b285324067
(cherry picked from commit cc2428c818)
2015-05-29 09:02:14 +01:00
Tao Bao
158e11d673 Separate uncrypt into two modes
uncrypt needs to be triggered to prepare the OTA package before
rebooting into the recovery. Separate uncrypt into two modes. In
mode 1, it uncrypts the OTA package, but will not reboot the
device. In mode 2, it wipes the /misc partition and reboots.

Needs matching changes in frameworks/base, system/core and
external/sepolicy to work properly.

Bug: 20012567
Bug: 20949086
Change-Id: I14d25cb62770dd405cb56824d05d649c3a94f315
2015-05-28 14:44:52 -07:00
Elliott Hughes
1857a7f579 Don't use TEMP_FAILURE_RETRY on close in recovery.
Bug: http://b/20501816
Change-Id: I35efcd8dcec7a6492ba70602d380d9980cdda31f
(cherry picked from commit b47afedb42)
2015-05-15 18:09:33 -07:00