Commit Graph

11 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
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
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
David Anderson
46f38e4610 Add IBootControl 1.1 support to libboot_control.
Bug: 138861550
Test: vts
Change-Id: Id4a2963d6ab657d8ab076b7013492a691462b287
2019-09-04 18:12:36 -07:00
David Anderson
b18f153b12 Improve error messaging when bootcontrol HAL fails to load.
Bug: N/A
Test: manual test
Change-Id: I6bf849dba4ae66353c44875ece30917283557327
2019-09-04 18:12:35 -07:00
David Anderson
643ddd99df boot_control: Don't allow current_slot_ to be -1.
If the HAL is run on a non-A/B device, it does not fail gracefully; it
will segfault because the current_slot is -1 and methods do not protect
against this. Instead, have Init() fail if we can't determine the
current slot.

Bug: 130078382
Test: vts tests
Change-Id: I2d3094518a842b1a764427d2da9d46781a9f26da
2019-09-04 18:12:23 -07:00
David Anderson
f771484f4e Make libboot_control vendor available.
Bug: 138861550
Test: builds
Change-Id: Ib745b59931c6258073e47b00def84c9157df90a7
2019-08-30 10:21:00 -07:00
David Anderson
8108e2513f Refactor boot_control into a separate library.
This extracts the implementation of boot_control into a new library,
libboot_control. The bootctrl.default module now wraps this library.
This refactoring will allow us to re-use the same implementation in
HIDL.

Bug: 138861550
Test: mm bootctrl.default
Change-Id: Ic0558da3c2d8e6f5ebec63a497825c24b51623b7
2019-08-30 10:20:59 -07:00
Hridya Valsaraju
c53dad20d0 Build boot control HAL with Android.bp
Bug: 78793464
Test: make
Change-Id: Id5efceda0f5e93bbaf33c2dc3e203fd39ef44e28
2018-08-09 22:15:01 -07:00
Tao Bao
99f0d9e52b Drop -Wno-unused-parameter.
The only one left is libedify. Will handle that in a separate CL.

Test: mmma bootable/recovery
Change-Id: I732a5f85229da90fd767bee2e46c5c95f529c396
2017-10-11 16:56:12 -07:00
Alex Deymo
fb00d82f32 Boot control HAL based on the A/B headers.
The added bootctrl.bcb module implement the legacy interface for the
bootctrl HAL based on the Boot Control Block (BCB) and the headers
already specified in the booloader_message library.

This serves as a reference implementation of the boot_control HAL.

Bug: 32707546
Test: Tested internally that a device can use this HAL to flip slots and
recovery from a /misc wipe.

Change-Id: Ic02e5aaf4de7d0a1780eac4e8705dae20d0b3e10
2017-04-03 11:25:33 -07:00