[PATCH 1/2] avb: Make AVB independent of fastboot

Usama Arif usama.arif at arm.com
Tue Aug 11 16:46:03 CEST 2020


AVB only uses CONFIG_FASTBOOT_BUF_ADDR from fastboot for memory.
This memory is used for assigning temporary buffers.
This can be assigned a new variable and used as CONFIG_AVB_BUF_ADDR.
This is to support future boards that support AVB but dont support
USB and therefore dont support FASTBOOT.

Signed-off-by: Usama Arif <usama.arif at arm.com>
Cc: Igor Opaniuk <igor.opaniuk at gmail.com>
---
 common/Kconfig                      | 18 +++++++++++++++++-
 common/avb_verify.c                 |  1 -
 configs/am57xx_evm_defconfig        |  2 ++
 configs/am57xx_hs_evm_defconfig     |  2 ++
 configs/am57xx_hs_evm_usb_defconfig |  2 ++
 include/avb_verify.h                |  4 ++--
 6 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index 62d78c5bd7..bbacc33f80 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -986,7 +986,7 @@ config HASH
 
 config AVB_VERIFY
 	bool "Build Android Verified Boot operations"
-	depends on LIBAVB && FASTBOOT
+	depends on LIBAVB
 	depends on PARTITION_UUIDS
 	help
 	  This option enables compilation of bootloader-dependent operations,
@@ -995,6 +995,22 @@ config AVB_VERIFY
 	    * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c.
 	    * Helpers to alloc/init/free avb ops.
 
+if AVB_VERIFY
+
+config AVB_BUF_ADDR
+	hex "Define AVB buffer address"
+	help
+	  AVB requires a buffer for memory transactions. This variable defines the
+	  buffer address.
+
+config AVB_BUF_SIZE
+	hex "Define AVB buffer SIZE"
+	help
+	  AVB requires a buffer for memory transactions. This variable defines the
+	  buffer size.
+
+endif # AVB_VERIFY
+
 config SPL_HASH
 	bool # "Support hashing API (SHA1, SHA256, etc.)"
 	help
diff --git a/common/avb_verify.c b/common/avb_verify.c
index a2b739626b..db10d0f21f 100644
--- a/common/avb_verify.c
+++ b/common/avb_verify.c
@@ -7,7 +7,6 @@
 #include <avb_verify.h>
 #include <blk.h>
 #include <cpu_func.h>
-#include <fastboot.h>
 #include <image.h>
 #include <malloc.h>
 #include <part.h>
diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig
index 2e6787a906..41cd76d198 100644
--- a/configs/am57xx_evm_defconfig
+++ b/configs/am57xx_evm_defconfig
@@ -28,6 +28,8 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_AVB_VERIFY=y
+CONFIG_AVB_BUF_ADDR=0x82000000
+CONFIG_AVB_BUF_SIZE=0x2F000000
 CONFIG_ANDROID_AB=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig
index 808bd2881e..9505549439 100644
--- a/configs/am57xx_hs_evm_defconfig
+++ b/configs/am57xx_hs_evm_defconfig
@@ -33,6 +33,8 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_AVB_VERIFY=y
+CONFIG_AVB_BUF_ADDR=0x82000000
+CONFIG_AVB_BUF_SIZE=0x2F000000
 CONFIG_ANDROID_AB=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
diff --git a/configs/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig
index 8698b7c8b5..73df983e2d 100644
--- a/configs/am57xx_hs_evm_usb_defconfig
+++ b/configs/am57xx_hs_evm_usb_defconfig
@@ -35,6 +35,8 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_AVB_VERIFY=y
+CONFIG_AVB_BUF_ADDR=0x82000000
+CONFIG_AVB_BUF_SIZE=0x2F000000
 CONFIG_ANDROID_AB=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
diff --git a/include/avb_verify.h b/include/avb_verify.h
index a8d7090f79..1e787ba666 100644
--- a/include/avb_verify.h
+++ b/include/avb_verify.h
@@ -72,12 +72,12 @@ static inline uint64_t calc_offset(struct mmc_part *part, int64_t offset)
 
 static inline size_t get_sector_buf_size(void)
 {
-	return (size_t)CONFIG_FASTBOOT_BUF_SIZE;
+	return (size_t)CONFIG_AVB_BUF_SIZE;
 }
 
 static inline void *get_sector_buf(void)
 {
-	return map_sysmem(CONFIG_FASTBOOT_BUF_ADDR, CONFIG_FASTBOOT_BUF_SIZE);
+	return map_sysmem(CONFIG_AVB_BUF_ADDR, CONFIG_AVB_BUF_SIZE);
 }
 
 static inline bool is_buf_unaligned(void *buffer)
-- 
2.17.1



More information about the U-Boot mailing list