[v2,1/2] avb2.0: add proper dependencies

Message ID 1531827206-16158-2-git-send-email-igor.opaniuk@linaro.org
State Accepted
Commit b0aa74a2640cd1be1d9bdfd8024ed3faa119e447
Headers show
Series
  • avb2.0: fix multiple compilation issues in sandbox
Related show

Commit Message

Igor Opaniuk July 17, 2018, 11:33 a.m.
1. Since libavb library alone is highly portable, introduce dedicated
Kconfig symbol for AVB bootloader-dependent operations, so it's possible
to build libavb separately. AVB bootloader-dependent operations include:
  * Helpers to process strings in order to build OS bootargs.
  * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c.
  * Helpers to alloc/init/free avb ops.
2. Add CONFIG_FASTBOOT dependency, as fastboot buffer is
re-used in partition verification operations.

Reported-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
---
 cmd/Kconfig     |  2 +-
 common/Kconfig  | 10 ++++++++++
 common/Makefile |  2 +-
 doc/README.avb2 |  1 +
 4 files changed, 13 insertions(+), 2 deletions(-)

Comments

Eugeniu Rosca July 17, 2018, 10:08 p.m. | #1
Hi Igor,

On Tue, Jul 17, 2018 at 02:33:25PM +0300, Igor Opaniuk wrote:
> 1. Since libavb library alone is highly portable, introduce dedicated
> Kconfig symbol for AVB bootloader-dependent operations, so it's possible
> to build libavb separately. AVB bootloader-dependent operations include:
>   * Helpers to process strings in order to build OS bootargs.
>   * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c.
>   * Helpers to alloc/init/free avb ops.
> 2. Add CONFIG_FASTBOOT dependency, as fastboot buffer is
> re-used in partition verification operations.
> 
> Reported-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
> ---
>  cmd/Kconfig     |  2 +-
>  common/Kconfig  | 10 ++++++++++
>  common/Makefile |  2 +-
>  doc/README.avb2 |  1 +
>  4 files changed, 13 insertions(+), 2 deletions(-)

With this patch I am now able to compile libavb natively for x86_64,
as well as cross-compile it for arm and aarch64, w/o the avb_verify
wrapper. Thanks for the improvements in the patch/Kconfig description.

Reviewed-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
Tested-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
Tom Rini July 26, 2018, 7:54 p.m. | #2
On Tue, Jul 17, 2018 at 02:33:25PM +0300, Igor Opaniuk wrote:

> 1. Since libavb library alone is highly portable, introduce dedicated

> Kconfig symbol for AVB bootloader-dependent operations, so it's possible

> to build libavb separately. AVB bootloader-dependent operations include:

>   * Helpers to process strings in order to build OS bootargs.

>   * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c.

>   * Helpers to alloc/init/free avb ops.

> 2. Add CONFIG_FASTBOOT dependency, as fastboot buffer is

> re-used in partition verification operations.

> 

> Reported-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>

> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

> Reviewed-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>

> Tested-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>


Applied to u-boot/master, thanks!

-- 
Tom

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index aec2090..b3e030c 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1771,7 +1771,7 @@  config CMD_TRACE
 
 config CMD_AVB
 	bool "avb - Android Verified Boot 2.0 operations"
-	depends on LIBAVB
+	depends on AVB_VERIFY
 	default n
 	help
 	  Enables a "avb" command to perform verification of partitions using
diff --git a/common/Kconfig b/common/Kconfig
index 4c7a1a9..04fcb91 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -631,6 +631,16 @@  config HASH
 	  and the algorithms it supports are defined in common/hash.c. See
 	  also CMD_HASH for command-line access.
 
+config AVB_VERIFY
+	bool "Build Android Verified Boot operations"
+	depends on LIBAVB && FASTBOOT
+	help
+	  This option enables compilation of bootloader-dependent operations,
+	  used by Android Verified Boot 2.0 library (libavb). Includes:
+	    * Helpers to process strings in order to build OS bootargs.
+	    * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c.
+	    * Helpers to alloc/init/free avb ops.
+
 endmenu
 
 menu "Update support"
diff --git a/common/Makefile b/common/Makefile
index 66584f8..7100541 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -121,4 +121,4 @@  obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o
 obj-y += s_record.o
 obj-y += xyzModem.o
 
-obj-$(CONFIG_LIBAVB) += avb_verify.o
+obj-$(CONFIG_AVB_VERIFY) += avb_verify.o
diff --git a/doc/README.avb2 b/doc/README.avb2
index 67784b5..120279f 100644
--- a/doc/README.avb2
+++ b/doc/README.avb2
@@ -58,6 +58,7 @@  Slot verification result: ERROR_IO
 -----------------------------------
 The following options must be enabled:
 CONFIG_LIBAVB=y
+CONFIG_AVB_VERIFY=y
 CONFIG_CMD_AVB=y