Skip to contentSkip to conversation

avb: Make AVB independent of fastboot

PATCH New Usama Arif 3 participants 7 messages Aug 11, 2020 – Aug 25, 2020 Arm (32-bit)

lore
Share & tools
lore

Usama Arif

author
#0 lore raw

PATCH 1/2 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.

---
 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(-)
common/Kconfig +17 -1
index 62d78c5bd7..bbacc33f80 100644
@@ -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
common/avb_verify.c +0 -1
index a2b739626b..db10d0f21f 100644
@@ -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>
configs/am57xx_evm_defconfig +2 -0
index 2e6787a906..41cd76d198 100644
@@ -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
configs/am57xx_hs_evm_defconfig +2 -0
index 808bd2881e..9505549439 100644
@@ -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
configs/am57xx_hs_evm_usb_defconfig +2 -0
index 8698b7c8b5..73df983e2d 100644
@@ -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
include/avb_verify.h +2 -2
index a8d7090f79..1e787ba666 100644
@@ -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)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/2 board: armltd: Add support for Total Compute platform

Total Compute is based on ARM architecture and has the following features enabled in u-boot:
- PL011 UART
- PL180 MMC
- NOR Flash
- FIT image with Signature
- AVB

---
 arch/arm/Kconfig                           | 11 +++
 arch/arm/dts/Makefile                      |  2 +
 arch/arm/dts/total_compute.dts             | 48 ++++++++++++
 arch/arm/include/asm/gpio.h                |  2 +-
 board/armltd/total_compute/Kconfig         | 12 +++
 board/armltd/total_compute/MAINTAINERS     |  6 ++
 board/armltd/total_compute/Makefile        |  6 ++
 board/armltd/total_compute/total_compute.c | 67 ++++++++++++++++
 configs/total_compute_defconfig            | 53 +++++++++++++
 include/configs/total_compute.h            | 91 ++++++++++++++++++++++
 10 files changed, 297 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/total_compute.dts
 create mode 100644 board/armltd/total_compute/Kconfig
 create mode 100644 board/armltd/total_compute/MAINTAINERS
 create mode 100644 board/armltd/total_compute/Makefile
 create mode 100644 board/armltd/total_compute/total_compute.c
 create mode 100644 configs/total_compute_defconfig
 create mode 100644 include/configs/total_compute.h
arch/arm/Kconfig +11 -0
index 6b8a32c38d..20ae4af9c2 100644
@@ -1195,6 +1195,15 @@ config TARGET_VEXPRESS64_JUNO
 	select USB
 	select DM_USB
 
+config TARGET_TOTAL_COMPUTE
+	bool "Support Total Compute Platform"
+	select ARM64
+	select PL01X_SERIAL
+	select DM
+	select DM_SERIAL
+	select DM_MMC
+	select DM_GPIO
+
 config TARGET_LS2080A_EMU
 	bool "Support ls2080a_emu"
 	select ARCH_LS2080A
@@ -1893,6 +1902,8 @@ source "arch/arm/mach-imx/Kconfig"
 
 source "arch/arm/mach-nexell/Kconfig"
 
+source "board/armltd/total_compute/Kconfig"
+
 source "board/bosch/shc/Kconfig"
 source "board/bosch/guardian/Kconfig"
 source "board/CarMediaLab/flea3/Kconfig"
arch/arm/dts/Makefile +2 -0
index 8ecf63e988..5fc0840c5a 100644
@@ -978,6 +978,8 @@ dtb-$(CONFIG_TARGET_VEXPRESS_CA5X2) += vexpress-v2p-ca5s.dtb
 dtb-$(CONFIG_TARGET_VEXPRESS_CA9X4) += vexpress-v2p-ca9.dtb
 dtb-$(CONFIG_TARGET_VEXPRESS_CA15_TC2) += vexpress-v2p-ca15_a7.dtb
 
+dtb-$(CONFIG_TARGET_TOTAL_COMPUTE) += total_compute.dtb
+
 dtb-$(CONFIG_TARGET_DURIAN) += phytium-durian.dtb
 
 dtb-$(CONFIG_TARGET_PRESIDIO_ASIC) += ca-presidio-engboard.dtb
arch/arm/dts/total_compute.dts new file +48 -0

48 lines not on this page · raw message

arch/arm/include/asm/gpio.h +1 -1
index 7dc87afb83..6ecb876eda 100644
@@ -3,7 +3,7 @@
 	!defined(CONFIG_ARCH_BCM6858) && !defined(CONFIG_ARCH_BCM63158) && \
 	!defined(CONFIG_ARCH_ROCKCHIP) && !defined(CONFIG_ARCH_ASPEED) && \
 	!defined(CONFIG_ARCH_U8500) && !defined(CONFIG_CORTINA_PLATFORM) && \
-	!defined(CONFIG_TARGET_BCMNS3)
+	!defined(CONFIG_TARGET_BCMNS3) && !defined(CONFIG_TARGET_TOTAL_COMPUTE)
 #include <asm/arch/gpio.h>
 #endif
 #include <asm-generic/gpio.h>
board/armltd/total_compute/Kconfig new file +12 -0
new file mode 100644
index 0000000000..62e6e6f4ac
@@ -0,0 +1,12 @@
+if TARGET_TOTAL_COMPUTE
+
+config SYS_BOARD
+	default "total_compute"
+
+config SYS_VENDOR
+	default "armltd"
+
+config SYS_CONFIG_NAME
+	default "total_compute"
+
+endif
board/armltd/total_compute/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..7c653d469a
@@ -0,0 +1,6 @@
+TOTAL_COMPUTE BOARD
+M:	Usama Arif <[email protected]>
+S:	Maintained
+F:	board/armltd/total_compute/
+F:	include/configs/total_compute.h
+F:	configs/total_compute_defconfig
board/armltd/total_compute/Makefile new file +6 -0
new file mode 100644
index 0000000000..8b10458431
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2020 Arm Limited
+# Usama Arif <[email protected]>
+
+obj-y	:= total_compute.o
board/armltd/total_compute/total_compute.c new file +67 -0

67 lines not on this page · raw message

configs/total_compute_defconfig new file +53 -0

53 lines not on this page · raw message

include/configs/total_compute.h new file +91 -0

91 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 board: armltd: Add support for Total Compute platform

Quoted 9 lines · Usama Arif

Total Compute is based on ARM architecture and has the following features enabled in u-boot:
- PL011 UART
- PL180 MMC
- NOR Flash
- FIT image with Signature
- AVB

[snip]

board/armltd/total_compute/MAINTAINERS line 6

Quoted 12 lines
board/armltd/total_compute/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..7c653d469a
@@ -0,0 +1,6 @@
+TOTAL_COMPUTE BOARD
+M:	Usama Arif <[email protected]>
+S:	Maintained
+F:	board/armltd/total_compute/
+F:	include/configs/total_compute.h
+F:	configs/total_compute_defconfig

Please list the dtb files as well here.

board/armltd/total_compute/MAINTAINERS

Quoted 8 lines
board/armltd/total_compute/MAINTAINERS new file +8 -0
+#define CONFIG_EXTRA_ENV_SETTINGS	\
+				"load_addr=0xa0000000\0"	\
+				"kernel_addr_r=0x80080000\0"	\
+				"initrd_addr_r=0x88000000\0"	\
+				"fdt_addr_r=0x83000000\0"	\
+				"fdt_high=0xffffffffffffffff\0"	\
+				"initrd_high=0xffffffffffffffff\0"
+

Disabling fdt/initrd relocation is wrong. Please set bootm_size as needed if fdt/initrd need to be relocated to within a window of memory rather than all available. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200812/17d72fb9/attachment.sig>
author
#3 lore raw

PATCH 2/2 board: armltd: Add support for Total Compute platform

Quoted 27 lines · Tom Rini
Quoted 9 lines · Usama Arif

Total Compute is based on ARM architecture and has the following features enabled in u-boot:
- PL011 UART
- PL180 MMC
- NOR Flash
- FIT image with Signature
- AVB

[snip]

board/armltd/total_compute/MAINTAINERS line 6

Quoted 12 lines
board/armltd/total_compute/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..7c653d469a
@@ -0,0 +1,6 @@
+TOTAL_COMPUTE BOARD
+M:	Usama Arif <[email protected]>
+S:	Maintained
+F:	board/armltd/total_compute/
+F:	include/configs/total_compute.h
+F:	configs/total_compute_defconfig

Please list the dtb files as well here.

Quoted 13 lines

board/armltd/total_compute/MAINTAINERS

Quoted 8 lines
board/armltd/total_compute/MAINTAINERS new file +8 -0
+#define CONFIG_EXTRA_ENV_SETTINGS	\
+				"load_addr=0xa0000000\0"	\
+				"kernel_addr_r=0x80080000\0"	\
+				"initrd_addr_r=0x88000000\0"	\
+				"fdt_addr_r=0x83000000\0"	\
+				"fdt_high=0xffffffffffffffff\0"	\
+				"initrd_high=0xffffffffffffffff\0"
+

Disabling fdt/initrd relocation is wrong. Please set bootm_size as needed if fdt/initrd need to be relocated to within a window of memory rather than all available. Thanks!

Hi,

Thanks for the review.

I have submitted a v2 version of the patch with arch/arm/dts/total_compute.dts addded to board/armltd/total_compute/MAINTAINERS and a bootm_size of 512 MB.

Thanks,
Usama

#4 lore raw

PATCH 1/2 avb: Make AVB independent of fastboot

In reply to Usama Arif
Quoted 8 lines · Usama Arif

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200812/c70becbb/attachment.sig>
#5 lore raw

PATCH 1/2 avb: Make AVB independent of fastboot

In reply to Usama Arif

Hi Usama,

Quoted 129 lines · On Tue, Aug 11, 2020, 17:46 Usama Arif <[email protected]> wrote:

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.

---
 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(-)
common/Kconfig +1 -1
index 62d78c5bd7..bbacc33f80 100644
@@ -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,

common/Kconfig +6 -0
@@ -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

common/Kconfig +6 -0
+         buffer address.
+
+config AVB_BUF_SIZE
+       hex "Define AVB buffer SIZE"
+       help
+         AVB requires a buffer for memory transactions. This variable

defines the

common/Kconfig +4 -0
+         buffer size.
+
+endif # AVB_VERIFY
+
 config SPL_HASH
        bool # "Support hashing API (SHA1, SHA256, etc.)"
        help
common/avb_verify.c +0 -1
index a2b739626b..db10d0f21f 100644
@@ -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>
configs/am57xx_evm_defconfig +2 -0
index 2e6787a906..41cd76d198 100644
@@ -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
configs/am57xx_hs_evm_defconfig +2 -0
index 808bd2881e..9505549439 100644
@@ -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
configs/am57xx_hs_evm_usb_defconfig +2 -0
index 8698b7c8b5..73df983e2d 100644
@@ -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
include/avb_verify.h +2 -2
index a8d7090f79..1e787ba666 100644
@@ -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);
 }
Quoted 3 lines

static inline bool is_buf_unaligned(void *buffer)
--
2.17.1A

#6 lore raw

PATCH 1/2 avb: Make AVB independent of fastboot

In reply to Usama Arif
Quoted 10 lines · Usama Arif

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200825/ebc6d276/attachment.sig>