summaryrefslogtreecommitdiffstats
path: root/bootloader_message/bootloader_message.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-12-09[MTE] Add interface to communicate MTE status to bootloader.Florian Mayer1-0/+10
We can use this interface to instruct the bootloader to either permanently or only for the next reboot enable MTE for userspace or kernel. Bug: 206895651 Change-Id: I7330e43b7c4f94fc5913a7bc0f667b6eab06e111
2019-11-12Consolidate the vendor space misc usage for PixelsTianjie Xu1-34/+3
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-09bootloader_message: Add helpers for handling IBootControl MergeStatus.David Anderson1-0/+43
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-05bootloader_message: Carve out space reserved for system.David Anderson1-0/+7
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-08-07bootloader_message: Remove global std::stringVic Yang1-3/+4
A global std::string, even if not used, pollutes the bss section unnecessarily. Since this object is only there for testing, make it std::optional<std::string>, which is constexpr constructible. Bug: 138856262 Test: Along with a fix in fs_mgr, see that the bss section for libbootloader_message.so is now clean on cuttlefish for several processes. Change-Id: I6df837dded88d979ffe14d5b2770b120bcf87341
2019-05-21Add misc_writer.Tao Bao1-0/+42
bootloader_message.h currently divides /misc into four segments. The space between 2K and 16K is reserved for vendor use (e.g. bootloader persists flags). This CL adds a vendor tool "misc_writer", to allow writing data to the vendor space in /misc, before getting a dedicated HAL for accessing /misc partition (b/131775112). Targets need to explicitly include the module, then invoke the executable to write data. For example, the following command will write 3-byte data ("0xABCDEF") to offset 4 in vendor space (i.e. 2048 + 4 in /misc). $ /vendor/bin/misc_writer --vendor-space-offset 4 --hex-string 0xABCDEF Bug: 132906936 Test: Run recovery_unit_test on crosshatch. Test: Call the command via init.hardware.rc on crosshatch. Check that the call finishes successfully. Then check the contents written to /misc (`dd bs=1 skip=2048 if=/dev/block/sda2 count=32 | xxd`). Change-Id: I79548fc63fc79b705a0320868690569c3106949f Merged-In: I79548fc63fc79b705a0320868690569c3106949f (cherry picked from commit 7ae01698424cc3adf635c324961b1405594f5156)
2019-05-21Add misc_writer.Tao Bao1-0/+42
bootloader_message.h currently divides /misc into four segments. The space between 2K and 16K is reserved for vendor use (e.g. bootloader persists flags). This CL adds a vendor tool "misc_writer", to allow writing data to the vendor space in /misc, before getting a dedicated HAL for accessing /misc partition (b/131775112). Targets need to explicitly include the module, then invoke the executable to write data. For example, the following command will write 3-byte data ("0xABCDEF") to offset 4 in vendor space (i.e. 2048 + 4 in /misc). $ /vendor/bin/misc_writer --vendor-space-offset 4 --hex-string 0xABCDEF Bug: 132906936 Test: Run recovery_unit_test on crosshatch. Test: Call the command via init.hardware.rc on crosshatch. Check that the call finishes successfully. Then check the contents written to /misc (`dd bs=1 skip=2048 if=/dev/block/sda2 count=32 | xxd`). Change-Id: I79548fc63fc79b705a0320868690569c3106949f
2019-05-03libbootloader_message: host_supported.Yifan Hong1-3/+9
Also, strlcat is not available on host, so use std::string::operator+= instead. Test: cuttlefish Bug: 79094284 Change-Id: I1e69daeb522ca73f43e0c4855cf099a021ed4d47
2019-05-03libbootloader_message: write recovery to any deviceYifan Hong1-0/+8
Test: cuttlefish Bug: 79094284 Change-Id: If1a6460a8cbed2e2d22fa9e16e6d7ca84f4592d0
2019-01-31Add android::fs_mgr namespace for new Fstab codeTom Cherry1-0/+3
Also add libfstab dependencies where needed. Previously the `typedef struct FstabEntry Volume;` line served to both define a `struct FstabEntry` as well as alias Volume to it. With the new namespace for android::fs_mgr::FstabEntry, `struct FstabEntry` isn't compatible anymore, so we need to alias Volume to the real android::fs_mgr::FstabEntry. In doing so, we need to include <fstab/fstab.h> and this requires libfstab as a library, which a few modules did not have before. Test: treehugger Change-Id: I655209a0efb304b3e0568db0748bd5cf7cecbdb7
2018-12-04Move some small users of fstab to new C++ FstabTom Cherry1-9/+10
Bug: 62292478 Test: tree-hugger Change-Id: Ie2cc10e5168ef3b9dcc42f88e67a1ccd1175fcc5
2017-11-03Switch to bionic gtest in bootable/recoveryTianjie Xu1-16/+17
We encountered segfaults in Imgdiff host tests due to the failure to reset states of getopt. The problem can be solved by switching to use bionic's gtest where a new process is forked for each test. Also modify the recovery_component_test to make sure it runs in parallel. Changes include: 1. Merge the writes to misc partition into one single test. 2. Change the hard coded location "/cache/saved.file" into a configurable variable. Bug: 67849209 Test: recovery tests pass Change-Id: I165d313f32b83393fb7922c5078636ac40b50bc2
2017-04-03Boot control HAL based on the A/B headers.Alex Deymo1-0/+7
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-03-27Revert "libbootloader_message: use different fstab paths for normal/recovery boot"Bowgo Tsai1-8/+2
This reverts commit 37bd44174bf2511320961f3f8cd1f698a1c72b66. The logic here is better to be moved into fs_mgr, not fs_mgr clients. Bug: 35811655 Bug: 36502022 Change-Id: Iae79bd8f7131516ad223f3323f1bc1d805206d51 Test: normal boot sailfish, go to Settings > System & tap on "Factory Data reset" Test: recovery boot sailfish
2017-03-25libbootloader_message: use different fstab paths for normal/recovery bootBowgo Tsai1-2/+8
libbootloader_message is used by both normal boot and recovery boot. It needs to use different fstab paths, respectively. Otherwise, factory reset will fail when we move /fstab.{ro.hardware} to /vendor/etc/. Recovery boot: fs_mgr_read_fstab_with_dt("/etc/recovery.fstab") Normal boot: fs_mgr_read_fstab_default() Bug: 35811655 Bug: 36502022 Test: normal boot sailfish, go to Settings > System & tap on "Factory Data reset" Test: recovery boot sailfish Change-Id: I253f5bdfb9be8a01f80856eb1194f85cdf992bbd
2017-03-10recovery: replacing fs_mgr_read_fstab() with new fs_mgr APIsBowgo Tsai1-18/+5
The fstab settings of early-mounted partitions (e.g., /vendor) will be in kernel device tree. Switch to the new API to get the whole settings with those in device tree: fs_mgr_read_fstab_with_dt("/etc/recovery.fstab") The original default /fstab.{ro.hardware} might be moved to /vendor/etc/. or /odm/etc/. Use another new API to get the default fstab instead of using the hard-coded /fstab.{ro.hardware}. This API also includes the settings from device tree: fs_mgr_read_fstab_default() Bug: 35811655 Test: boot sailfish recovery Change-Id: Iaa56ac7f7b4c4dfc7180c65f03e9a37b94f1de09
2016-12-15Add update_bootloader_message() to fix two-step OTAs.Tao Bao1-0/+21
This is a retry of commit 7e31f421a514da09b90e46dbd642a5e9b16e0003. Commit bd56f1590c967205dc45eb2ec298aa8d2aacb740 switches to calling write_bootloader_message(<options>) in get_args(), which unintentionally resets the stage field thus breaks two-step OTAs. This CL adds update_bootloader_message(<options>), which only sets the command field (to "boot-recovery") and the recovery field (with the specified options). Bug: 33534933 Test: Apply a two-step package. Test: recovery_component_test passes. Change-Id: Ie0b1ed4053d2d3c97d9cb84310d616b28fcfc72e
2016-12-13Revert "write_bootloader_message(<options>) should not reset stage field."Tao Bao1-7/+1
This reverts commit 7e31f421a514da09b90e46dbd642a5e9b16e0003. Bug: 33534933 Change-Id: Ib173f6b1e36a79deafc3592785195693a6779471
2016-12-06write_bootloader_message(<options>) should not reset stage field.Tao Bao1-1/+7
Commit bd56f1590c967205dc45eb2ec298aa8d2aacb740 switches to calling write_bootloader_message(<options>) in get_args(), which unintentionally resets the stage field thus breaks two-step OTAs. This CL changes write_bootloader_message(<options>) to only set the command field (to "boot-recovery") and the recovery field (with the specified options). Test: Apply a two-step package. Change-Id: I6905918812c7d3402cc1524688079066a4d22d29
2016-11-19bootloader_message: Remove the no-op blank line.Tao Bao1-1/+0
This single blank line was introduced by some cherry-pick, which is causing merge conflicts. Test: N/A Change-Id: Ida527b76fca7cc916499c5f888476c8e51ba3eaa
2016-11-18updater: Refactor set_stage() and get_stage() functions.Tao Bao1-23/+45
Add read_bootloader_message_from() and write_bootloader_message_to() to allow specifying the BCB device (/misc). Also add testcases for set_stage() and get_stage(). Test: recovery_component_test passes. Test: Build a recovery image and apply a two-step OTA package. Change-Id: If5ab06a1aaaea168d2a9e5dd63c07c0a3190e4ae
2016-11-10Add 'reboot bootloader' to bootloader_message.Vineela Tummalapalli1-0/+18
Add 'reboot bootloader' capability to the bootloader_message. BUG: https://issuetracker.google.com/issues/32474515 Change-Id: I01e8b2fad978bf7c8fc96ff6b08ad3e52533f504 Author: Vineela Tummalapalli <vineela.tummalapalli@intel.com> Signed-off-by: Vineela Tummalapalli <vineela.tummalapalli@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com> Reviewed-on: https://android.intel.com/548519
2016-10-19Fix bootloader_message.Yabin Cui1-1/+1
Bug: 29945717 Change-Id: I934fd6c52b0111937fa75455de2fa4157fb30f6f (cherry picked from commit 9da04d595fe01e4c0ac1baf39186ac090bf234b3)
2016-10-18Create bootloader_message static library.Yabin Cui1-4/+77
bootloader_messages merges bootloader_message_writer and bootloader.cpp, so we can use the same library to manage bootloader_message in normal boot and recovery mode. Bug: 29582118 Change-Id: I9efdf776ef8f02b53911ff43a518e035e0c29618 (cherry picked from commit 2f272c0551f984e83bc5abaf240e0dddb38a3326)
2016-09-26Switch to <android-base/properties.h>.Elliott Hughes1-6/+5
Bug: http://b/23102347 Test: boot into recovery. Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e Merged-In: Ib2ca560f1312961c21fbaa294bb068de19cb883e
2016-06-30Create bootloader_message static library.Yabin Cui1-123/+0
bootloader_messages merges bootloader_message_writer and bootloader.cpp, so we can use the same library to manage bootloader_message in normal boot and recovery mode. Bug: 29582118 Change-Id: I9efdf776ef8f02b53911ff43a518e035e0c29618
2016-06-21Verify wipe package when wiping A/B device in recovery.Yabin Cui1-2/+18
To increase the security of wiping A/B devices, let uncrypt write wipe package in misc partition. Then recovery verifies the wipe package before wiping the device. Bug: 29159185 Change-Id: I186691bab1928d3dc036bc5542abd64a81bc2168
2016-04-08uncrypt: split libbootloader_message_writer for reuse.Yabin Cui1-0/+107
init and vold also need to write bootloader message, so split this function from uncrypt into a separate library. Bug: 27176738 Change-Id: If9b0887b4f6ffab6162d9cb47a6ceb7eedd60b4d