Commit Graph

8317 Commits

Author SHA1 Message Date
David Anderson 682d2a5db2 bootloader_message: Add a magic header to the Virtual A/B message block.
This adds a sanity check in addition to the version number in case misc
contains random bits.

Bug: 139156011
Test: manual test
Change-Id: Ie4f3731d2b1795340881c88e0c4eec9cd4432653
2019-11-20 16:23:52 -08:00
Tianjie Xu ca18e7fe5a Merge "Clear the warm_reset flag after boot is successful" 2019-11-18 23:15:43 +00:00
David Anderson 8444dec7ac Merge "Force merges to complete before wiping data or metadata." 2019-11-15 04:27:59 +00:00
Tianjie Xu 88bf6d20eb Clear the warm_reset flag after boot is successful
The property is set to inform kernel to do a warm_reset on the next
reboot. This is useful to persist the logs to debug device boot
failures. After the slot has been marked as boot successful, we can drop
the warm_reset flag to avoid the performance overhead on the next
reboot.

Bug: 143489994
Test: check the property is set to 0 by update_verifier
Change-Id: I722fb1906e6efa56dfc4ad7beccd5e2ba7e0ef7c
2019-11-14 17:43:56 -08:00
Tianjie Xu 423f0d109b Merge "Consolidate the vendor space misc usage for Pixels" 2019-11-13 22:24:19 +00:00
Tom Cherry 8834b4ea0a Merge "Fixed typo during stopping fastboot" 2019-11-13 20:18:22 +00:00
Tom Cherry 154f7e9b79 Merge "Move init and ueventd scripts from / to /system/etc" 2019-11-13 14:36:47 +00:00
Dmytro Prokopchuk df35405a4b Fixed typo during stopping fastboot
Change-Id: I0a589d068807e255654c7e62831423f944b5cdc3
Signed-off-by: Dmytro Prokopchuk <dmytro.prokopchuk@globallogic.com>
2019-11-13 13:30:17 +02:00
Tianjie Xu 3d57c84476 Consolidate the vendor space misc usage for Pixels
The layout of the vendor space /misc partition was pretty confusing and
lead to some usage conflicts. To formalize the layout, we create a pixel
specific library with the definition & offset of various flags. The new
library also handles the R/W. As a result, we will leave system domain
/misc definitions in the libbootloader_message.

We also switch the misc_writer binary to use more specific options
instead of writing an arbitrary hex string. So we can avoid redefining
the string & offset in both init script and recovery ui.

Bug: 131775112
Test: unit tests pass, run misc_writer and check contents of /misc
Change-Id: I00f8842a81d1929e31a1de4d5eb09575ffad47c0
2019-11-12 10:53:04 -08:00
David Anderson 89d2d050a0 Force merges to complete before wiping data or metadata.
After an OTA is applied, a wipe in recovery may overwrite components of
dynamic partitions living in userdata. If the OTA has not yet begun
merging, we mark the current slot unbootable. If the OTA has begun
merging, we wait for the merge to complete. This logic is encapsulated
in libsnapshot.

Bug: 139156011
Test: manual test
Change-Id: Id6544a1b8583afcbba11559d46214ec2e68ffa40
2019-11-11 01:02:12 +00:00
David Anderson 405f4d3552 Merge "bootloader_message: Add helpers for handling IBootControl MergeStatus." 2019-11-09 15:04:52 +00:00
David Anderson cf8427af89 bootloader_message: Add helpers for handling IBootControl MergeStatus.
Move merge_status from bootloader_control_ab, which is in vendor space,
to a new generic AOSP struct in system space. This will allow more
devices to share the same HAL implementation.

This patch also changes libboot_control to compensate for merge_status
moving out of vendor space. The reference HAL library now also provides
separate helper functions for managing the merge status, so devices
using a custom boot control HAL can still take advantage of the new misc
implementation.

Bug: 139156011
Test: manual test
Change-Id: I5cd824e25f9d07aad1476301def5cdc3f506b029
2019-11-08 15:22:21 -08:00
Tom Cherry bcd3f35462 Move init and ueventd scripts from / to /system/etc
There is no reason for these scripts to continue to exist in /, when
they are better suited for /system/etc.  There are problems keeping
them at / as well, particularly that they cannot be updated with
overlayfs.

Bug: 131087886
Bug: 140313207
Test: build/boot + boot to recovery
Merged-In: I1fb6690d4302a1884d8521c21a9754b2ca710d5a
Change-Id: I1fb6690d4302a1884d8521c21a9754b2ca710d5a
2019-11-07 11:29:06 -08:00
Tianjie Xu 6105aa1a4a Merge "Stop setting usb config from recovery init script" 2019-11-07 18:25:07 +00:00
Tom Cherry 0a19ef8cb6 Stop setting usb config from recovery init script
We used to set sys.usb.config to adb in the init script. And the purpose
is to start adbd. This is a duplicate of code because we always check and
reset the usb config in recovery_main.

Test: check adbd starts
Change-Id: I6e2842ff8aebf6ccf3bd3f2ae85323899a2b9de4
2019-11-06 23:04:36 -08:00
David Anderson 8243388d57 Merge "bootloader_message: Carve out space reserved for system." 2019-11-05 22:16:16 +00:00
Tianjie Xu b65dd9cb0c Merge "Start adbd in user mode if bootloader is unlocked" 2019-11-05 21:37:07 +00:00
David Anderson 4ff4cbdd6c bootloader_message: Carve out space reserved for system.
This reduces the wipe space from 32K to 16K. The wipe space is now
at the 16K-32K region. The 32K-64K region is now "system space", to
complement the vendor space, for generic AOSP usage.

Bug: 139156011
Test: manual test
Change-Id: I1474bfa65a5f21049ab64ec0aee2f4585b55f60f
2019-11-04 15:57:04 -08:00
Tianjie Xu 7d5c341962 Start adbd in user mode if bootloader is unlocked
During automatic tests, we sometimes want to reboot the device out of
the rescue party remotely. And per http://go/recovery-adb-access, one
option is to start adbd in user build if the device has an unlocked
bootloader. This should not add more surface of attack. Because verified
boot is off with the unlocked bootloader, and the user can always flash
a custom recovery image that always starts adbd.

Bug: 141247819
Test: check adbd doesn't start in user build, unlock bootloader, and
check adbd starts.

Change-Id: I851746245f862cb4dfb01e6c3ad035f2c9f9ccec
2019-10-30 10:26:56 -07:00
Xin Li c73a97c6ee Merge Coral/Flame into AOSP master
Bug: 141248619
Change-Id: If019c780684a841a87d49dcf55a6f2cfd638f69b
Merged-In: Ifc73de385b7d857e8d0ceb20ff7275ba27bb200c
2019-10-25 10:27:44 -07:00
Josh Gao cf6b4dce12 Merge "Use adbd_system_binaries to track adbd's dependencies."
am: e52af1a4cc

Change-Id: Ifc73de385b7d857e8d0ceb20ff7275ba27bb200c
2019-10-24 14:31:07 -07:00
Josh Gao e52af1a4cc Merge "Use adbd_system_binaries to track adbd's dependencies." 2019-10-24 20:29:25 +00:00
George Burgess IV 37395747a8 Merge "bootable: leak less memory"
am: 19073f2067

Change-Id: I55463429524f54941b47fce9f0c318ae47993414
2019-10-23 17:22:00 -07:00
Treehugger Robot 19073f2067 Merge "bootable: leak less memory" 2019-10-24 00:03:38 +00:00
Josh Gao a91e456fd4 Use adbd_system_binaries to track adbd's dependencies.
required doesn't propagate from apexes, so we need a separate phony
target to track adbd's dependenecies.

Test: m
Change-Id: I13977d1376de63839bf182d2cfa56b5c6c63aba9
2019-10-23 14:33:51 -07:00
George Burgess IV 1b03fc5493 bootable: leak less memory
`misc_device_` is a std::string, so it allocates and manages its own
memory. Hence, the strdup here is immediately leaked.

Caught by the static analyzer

Bug: None
Test: TreeHugger
Change-Id: Iffb1ff60f6087e470a0979d202150567272e8b1c
2019-10-23 12:09:07 -07:00
Xin Li a5d835720a Skip QD1A.190821.011 in stage-aosp-master
Bug: 141248619
Change-Id: I3404ae5bfb5c54df05495a62cba58cd4e818b2ff
2019-10-16 15:19:11 -07:00
Nick Desaulniers 843c0bbb01 Merge "[bootable][recovery] fix -Wreorder-init-list"
am: 0d76cad830

Change-Id: Ifd6c41936ad73a55b70c037fbc21bc12f6277a58
2019-10-11 09:22:05 -07:00
Nick Desaulniers 0d76cad830 Merge "[bootable][recovery] fix -Wreorder-init-list" 2019-10-11 15:50:07 +00:00
Nick Desaulniers 1cb510d96f [bootable][recovery] fix -Wreorder-init-list
C++20 will require members in a designated initializer to be in order
unlike C99.

Bug: 139945549
Test: mm
Change-Id: I6f8d658448f7e5dd980bf95b890b15cb0aab7407
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-10-10 16:33:58 -07:00
David Anderson 1cde53c252 Merge "Add IBootControl 1.1 support to libboot_control."
am: 47bb0c8b59

Change-Id: I64763d0d67ad37686bc95c0c6e0f986b9a707267
2019-10-10 12:31:35 -07:00
David Anderson 47bb0c8b59 Merge "Add IBootControl 1.1 support to libboot_control." 2019-10-10 19:19:49 +00:00
Tao Bao 03a5bd4d0d Merge "Update OWNERS."
am: 938e736f91

Change-Id: I905db1a8c1a46b8ca00a3aef10fdae4487562d6b
2019-10-09 08:52:01 -07:00
Tao Bao 938e736f91 Merge "Update OWNERS." 2019-10-09 15:33:13 +00:00
Tao Bao 7d47aebd79 Update OWNERS.
Test: N/A
Change-Id: I290fe43ee14fa3751f9ddb2c009bff235d8e1cff
2019-10-08 20:32:42 -07:00
Tianjie Xu 0b89939ddf Merge "Run BORINGSSL_self_test() in updater_main"
am: 8316f2f09a

Change-Id: I7ba12a5cfde83239310ab76f6f7fef722b20366a
2019-10-07 16:08:48 -07:00
Tianjie Xu 8316f2f09a Merge "Run BORINGSSL_self_test() in updater_main" 2019-10-07 22:51:44 +00:00
Tao Bao 58b5a5a550 Merge "minadbd: Return battery level via getprop."
am: e0e34a7f5c

Change-Id: Ib714d7add905ac1b2084f4144a2017a01a21fd2f
2019-10-07 08:37:00 -07:00
Tao Bao e0e34a7f5c Merge "minadbd: Return battery level via getprop." 2019-10-07 15:17:40 +00:00
Tianjie Xu 97692467a1 Run BORINGSSL_self_test() in updater_main
We need to run the these tests when starting updater to verify the
statically linked libcrypto. The test function is based on the known
answer tests, and it doesn't compute the hash of the libcrypto library.

Bug: 141003171
Test: unit tests pass, run a updater on cuttlefish
Change-Id: I897918a54bca76ea0c928102e7287df27505e1cc
2019-10-05 17:06:48 -07:00
Bill Peckham 1bf401d03f Merge "Moving recovery resources from /system to /vendor"
am: 3903b26368

Change-Id: I477c2cbe802fff389a8e333ea693859d9a21a63e
2019-10-04 20:24:15 -07:00
Bill Peckham 3903b26368 Merge "Moving recovery resources from /system to /vendor" 2019-10-05 03:14:12 +00:00
Tao Bao b548bea778 minadbd: Return battery level via getprop.
`adb rescue getprop rescue.battery_level` returns the current battery
level.

Bug: 134560109
Test: Build and boot into rescue mode.
Test: `adb rescue getprop ro.build.fingerprint`
Test: `adb rescue getprop rescue.battery_level`
Test: `adb rescue getprop` to dump all the properties.
Test: Run recovery_unit_test.
Change-Id: I78a9e8ab9783ffc8532cb93e6a64fb2157c19bd5
2019-10-04 15:33:27 -07:00
Tao Bao 7018c5b2d8 Merge "recovery_utils: Use libvoid_headers."
am: 4782e79324

Change-Id: I4b1527c70eeaaea0cbf10702272b5cf8f5284714
2019-10-03 17:16:36 -07:00
Bill Peckham 341644d657 Moving recovery resources from /system to /vendor
This change is part of a topic that moves the recovery resources from the
system partition to the vendor partition, if it exists, or the vendor directory
on the system partition otherwise. The recovery resources are moving from the
system image to the vendor partition so that a single system image may be used
with either an A/B or a non-A/B vendor image. The topic removes a delta in the
system image that prevented such reuse in the past.

The recovery resources that are moving are involved with updating the recovery
partition after an update. In a non-A/B configuration, the system boots from
the recovery partition, updates the other partitions (system, vendor, etc.)
Then, the next time the system boots normally, a script updates the recovery
partition (if necessary). This script, the executables it invokes, and the data
files that it uses were previously on the system partition. The resources that
are moving include the following.

* install-recovery.sh
* applypatch
* recovery-resource.dat (if present)
* recovery-from-boot.p (if present)

This makes the applypatch executable a vendor module.

This change supports making dependencies of the applypatch executable available
to applypatch, which is now on vendor.

Since install-recovery.sh is now a vendor service, we add the
applypatch/vendor_flash_recovery.rc file to /vendor/etc/init to start the
service.

Bug: 68319577
Test: Ensure that recovery partition is updated correctly.
Change-Id: I01c0800ee6078aa6c9d716d5f154ad2d63c7af84
2019-10-04 00:04:56 +00:00
Treehugger Robot 4782e79324 Merge "recovery_utils: Use libvoid_headers." 2019-10-04 00:01:53 +00:00
Tao Bao 80b6831ddb Merge "Refactor battery info querying functions into librecovery_utils."
am: 678d6395b3

Change-Id: I566ad1bb6dd940e6fcd224c8d6cbed234d1ca3bc
2019-10-03 09:07:38 -07:00
Tao Bao 640175e9d1 recovery_utils: Use libvoid_headers.
Test: mmm bootable/recovery
Change-Id: I2ad7620d0f967cb018a415358379c34804e232c5
2019-10-03 08:48:49 -07:00
Tao Bao 678d6395b3 Merge "Refactor battery info querying functions into librecovery_utils." 2019-10-03 15:40:23 +00:00
Tao Bao 832c9cd24f Refactor battery info querying functions into librecovery_utils.
Bug: 134560109
Test: Run recovery_unit_test.
Change-Id: Ibbcdcfd507fa23657ee7ff677208b0003ec382ba
2019-10-02 22:04:25 -07:00