summaryrefslogtreecommitdiff
path: root/include/fsl_avb.h
diff options
context:
space:
mode:
authorJi Luo <ji.luo@nxp.com>2020-06-09 14:59:45 +0800
committerJi Luo <ji.luo@nxp.com>2022-04-18 16:40:09 +0800
commit94a816ba1793cafe431e77e5bdd72f44ad4f8856 (patch)
tree122fe2ad38ab89339935bbc97fda3f79fe857605 /include/fsl_avb.h
parent260a680af5174d48d76931cf8fe86e7353636378 (diff)
MA-17338-1 Enable boot control v1.1
The old boot control logic and misc data struct is based on the 'external/avb/libavb_ab' library which is already marked as deprecated and won't be maintained by google anymore: commit 37f5946d0e1159273eff61dd8041377fedbf55a9 Author: David Zeuthen <zeuthen@google.com> Date: Wed Sep 20 15:02:32 2017 -0400 Deprecate libavb_ab and bootctrl.avb code. This code was already marked as experimental in anticipation of being removed in the future. Officially deprecate it and set Jun 1 2018 as the date it will be removed. This should give users of the code ample time to fork/migrate. To keep using the code AVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED must be defined. The reason for deprecating this code is twofold: - Its policy was optimized for devices without a display with e.g. automatic fallback to the other slot if a slot fails to boot. Since most A/B stacks in Android devices don't work this way this code is confusing. - There are no known active users, no good test coverage for the bootctrl.avb code, and no plans to use it. When the code is removed we'll provide an easy transition path by keeping (but renaming) the |ab_ops| member in AvbOps. Change-Id: Id5e090a2048076d36ccca2e1c4cb55e226b8b43d Google has provided a new boot control v1.1 implementation under 'hardware/interfaces/boot/1.1/default' which uses a new misc data struct defined in the 'include/android_bootloader_message.h'. This commit adds a new boot control implementation in bootloader, which combines the new misc data struct and inherit some flow in 'libavb_ab', the old 'libavb_ab' library will be removed. Test: boot/slot switch/retry count test on single&dual bootloader. Signed-off-by: Ji Luo <ji.luo@nxp.com> Change-Id: I0fa1ee8562c83afec549c8f6aad7a26a2214f626 (cherry picked from commit 29aafaf065d1688201d014213052863ec9d18e9c) (cherry picked from commit f5cda163c1559480a43e75869747a50787fd0ee1) (cherry picked from commit a45dca90ff92f548f157f8739a76f249ca8241cb)
Diffstat (limited to 'include/fsl_avb.h')
-rw-r--r--include/fsl_avb.h79
1 files changed, 1 insertions, 78 deletions
diff --git a/include/fsl_avb.h b/include/fsl_avb.h
index 89396708c9..0eaa842cf1 100644
--- a/include/fsl_avb.h
+++ b/include/fsl_avb.h
@@ -7,8 +7,8 @@
#ifndef __FSL_AVB_H__
#define __FSL_AVB_H__
-#include "../lib/avb/libavb_ab/libavb_ab.h"
#include "../lib/avb/libavb_atx/libavb_atx.h"
+#include "../lib/avb/fsl/fsl_bootctrl.h"
/* Reads |num_bytes| from offset |offset| from partition with name
* |partition| (NUL-terminated UTF-8 string). If |offset| is
* negative, its absolute value should be interpreted as the number
@@ -56,28 +56,6 @@ AvbIOResult fsl_write_to_partition(AvbOps* ops, const char* partition,
int64_t offset, size_t num_bytes,
const void* buffer);
-/* Reads A/B metadata from persistent storage. Returned data is
- * properly byteswapped. Returns AVB_IO_RESULT_OK on success, error
- * code otherwise.
- *
- * If the data read is invalid (e.g. wrong magic or CRC checksum
- * failure), the metadata shoule be reset using avb_ab_data_init()
- * and then written to persistent storage.
- *
- * Implementations will typically want to use avb_ab_data_read()
- * here to use the 'misc' partition for persistent storage.
- */
-AvbIOResult fsl_read_ab_metadata(AvbABOps* ab_ops, struct AvbABData* data);
-
-/* Writes A/B metadata to persistent storage. This will byteswap and
- * update the CRC as needed. Returns AVB_IO_RESULT_OK on success,
- * error code otherwise.
- *
- * Implementations will typically want to use avb_ab_data_write()
- * here to use the 'misc' partition for persistent storage.
- */
-AvbIOResult fsl_write_ab_metadata(AvbABOps* ab_ops, const struct AvbABData* data);
-
/* Checks if the given public key used to sign the 'vbmeta'
* partition is trusted. Boot loaders typically compare this with
* embedded key material generated with 'avbtool
@@ -147,31 +125,6 @@ AvbIOResult fsl_get_unique_guid_for_partition(AvbOps* ops,
AvbIOResult fsl_get_size_of_partition(AvbOps* ops,
const char* partition,
uint64_t* out_size_num_bytes);
-/* check if the fastboot getvar cmd is for query [avb] bootctl's slot var
- * cmd is the fastboot getvar's cmd in
- * return true if it is a bootctl related cmd, false if it's not.
- * */
-bool is_slotvar_avb(char *cmd);
-
-/* Get current bootable slot with higher priority.
- * return 0 for the first slot
- * return 1 for the second slot
- * return -1 for not supported slot
- * */
-int get_curr_slot(AvbABData *ab_data);
-
-/* return 0 for the first slot
- * return 1 for the second slot
- * return -1 for not supported slot
- * */
-int slotidx_from_suffix(char *suffix);
-
-/* return fastboot's getvar cmd response
- * cmd is the fastboot getvar's cmd in
- * if return 0, buffer is bootctl's slot var out
- * if return -1, buffer is error string
- * */
-int get_slotvar_avb(AvbABOps *ab_ops, char *cmd, char *buffer, size_t size);
/* reset rollback_index part in avbkey partition
* used in the switch from LOCK to UNLOCK
@@ -185,10 +138,6 @@ int rbkidx_erase(void);
* */
int avbkey_init(uint8_t *plainkey, uint32_t keylen);
-/* read a/b metadata to get curr slot
- * return slot suffix '_a'/'_b' or NULL */
-char *select_slot(AvbABOps *ab_ops);
-
/* Reads permanent |attributes| data. There are no restrictions on where this
* data is stored. On success, returns AVB_IO_RESULT_OK and populates
* |attributes|.
@@ -210,32 +159,6 @@ void fsl_set_key_version(AvbAtxOps* atx_ops,
size_t rollback_index_location,
uint64_t key_version);
-/* This is the fast version of avb_ab_flow(), this function will
- * not check another slot if one slot can pass the verify (or verify
- * fail is acceptable).
- */
-AvbABFlowResult avb_ab_flow_fast(AvbABOps* ab_ops,
- const char* const* requested_partitions,
- AvbSlotVerifyFlags flags,
- AvbHashtreeErrorMode hashtree_error_mode,
- AvbSlotVerifyData** out_data);
-
-/* This is for legacy i.mx6/7 which don't enable A/B but want to
- * verify boot/recovery with AVB */
-AvbABFlowResult avb_single_flow(AvbABOps* ab_ops,
- const char* const* requested_partitions,
- AvbSlotVerifyFlags flags,
- AvbHashtreeErrorMode hashtree_error_mode,
- AvbSlotVerifyData** out_data);
-
-/* Avb verify flow for dual bootloader, only the slot chosen by SPL will
- * be verified.
- */
-AvbABFlowResult avb_flow_dual_uboot(AvbABOps* ab_ops,
- const char* const* requested_partitions,
- AvbSlotVerifyFlags flags,
- AvbHashtreeErrorMode hashtree_error_mode,
- AvbSlotVerifyData** out_data);
/* Generates |num_bytes| random bytes and stores them in |output|,
* which must point to a buffer large enough to store the bytes.
*