avb: Make AVB independent of fastboot

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@arm.com>
Cc: Igor Opaniuk <igor.opaniuk@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Igor Opaniuk <igor.opaniuk@gmail.com>
[trini: Change defaults]
Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Usama Arif 2020-08-11 15:46:03 +01:00 committed by Tom Rini
parent 1aa3966173
commit e61b41517d
3 changed files with 21 additions and 4 deletions

View file

@ -1003,7 +1003,7 @@ config HASH
config AVB_VERIFY config AVB_VERIFY
bool "Build Android Verified Boot operations" bool "Build Android Verified Boot operations"
depends on LIBAVB && FASTBOOT depends on LIBAVB
depends on PARTITION_UUIDS depends on PARTITION_UUIDS
help help
This option enables compilation of bootloader-dependent operations, This option enables compilation of bootloader-dependent operations,
@ -1012,6 +1012,24 @@ config AVB_VERIFY
* Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c. * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c.
* Helpers to alloc/init/free avb ops. * Helpers to alloc/init/free avb ops.
if AVB_VERIFY
config AVB_BUF_ADDR
hex "Define AVB buffer address"
default FASTBOOT_BUF_ADDR
help
AVB requires a buffer for memory transactions. This variable defines the
buffer address.
config AVB_BUF_SIZE
hex "Define AVB buffer SIZE"
default FASTBOOT_BUF_SIZE
help
AVB requires a buffer for memory transactions. This variable defines the
buffer size.
endif # AVB_VERIFY
config SPL_HASH config SPL_HASH
bool # "Support hashing API (SHA1, SHA256, etc.)" bool # "Support hashing API (SHA1, SHA256, etc.)"
help help

View file

@ -7,7 +7,6 @@
#include <avb_verify.h> #include <avb_verify.h>
#include <blk.h> #include <blk.h>
#include <cpu_func.h> #include <cpu_func.h>
#include <fastboot.h>
#include <image.h> #include <image.h>
#include <malloc.h> #include <malloc.h>
#include <part.h> #include <part.h>

View file

@ -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) 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) 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) static inline bool is_buf_unaligned(void *buffer)