avb2.0: fix multiple compilation issues in sandbox
v2 cover avb2.0: fix multiple compilation issues in sandbox
This series of two patches fixes compilation issues when AVB 2.0 is enabled for the 'sandbox' architecture:
1. Since libavb library alone is highly portable, it introduce dedicated Kconfig symbol for AVB compiler-dependent operations, so it's possible to build libavb separately.
2. Add CONFIG_FASTBOOT dependency, as fastboot buffer is re-used in partition verification operations.
3. Use blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation implementations. This fixes compilation issues when CONFIG_BLK is enabled.
Changes for v2:
- Updated eb81cae89f ("avb2.0: add proper dependencies") commit message (added more details).
- Extended description of AVB_VERIFY Kconfig symbol.
- Replaced CONFIG_LIBAVB to CONFIG_AVB_VERIFY in common/Makefile.
Igor Opaniuk (2):
avb2.0: add proper dependencies
avb2.0: use block API in AVB ops
cmd/Kconfig | 2 +- common/Kconfig | 10 ++++++++++ common/Makefile | 2 +- common/avb_verify.c | 9 +++++---- doc/README.avb2 | 1 + 5 files changed, 18 insertions(+), 6 deletions(-)
--
2.7.4
PATCH v2 1/2 avb2.0: add proper dependencies
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.
--- cmd/Kconfig | 2 +- common/Kconfig | 10 ++++++++++ common/Makefile | 2 +- doc/README.avb2 | 1 + 4 files changed, 13 insertions(+), 2 deletions(-)
cmd/Kconfig +1 -1
@@ -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
common/Kconfig +10 -0
@@ -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"
common/Makefile +1 -1
@@ -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
doc/README.avb2 +1 -0
@@ -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
Signature · 1 line
2.7.4
PATCH v2 1/2 avb2.0: add proper dependencies
Hi Igor,
Quoted 9 lines · Igor Opaniuk
1. Since libavb library alone is highly portable, introduce dedicated
Kconfigsymbol 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 todrivers/fastboot/fb_mmc.c.
* Helpers to alloc/init/free avb ops.
2. AddCONFIG_FASTBOOTdependency, as fastboot buffer is re-used in partition verification operations.
Quoted 8 lines
Reported-by Eugeniu Rosca <[email protected]>Signed-off-by Igor Opaniuk <[email protected]>--- 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.
PATCH v2 1/2 avb2.0: add proper dependencies
In reply to Igor OpaniukQuoted 9 lines · Igor Opaniuk
1. Since libavb library alone is highly portable, introduce dedicated
Kconfigsymbol 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 todrivers/fastboot/fb_mmc.c.
* Helpers to alloc/init/free avb ops.
2. AddCONFIG_FASTBOOTdependency, as fastboot buffer is re-used in partition verification operations.
Quoted 4 lines
Reported-by Eugeniu Rosca <[email protected]>Signed-off-by Igor Opaniuk <[email protected]>Reviewed-by Eugeniu Rosca <[email protected]>Tested-by Eugeniu Rosca <[email protected]>
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: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180726/18e32950/attachment.sig>
PATCH v2 2/2 avb2.0: use block API in AVB ops
In reply to Igor OpaniukUse blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation implementations. This fixes compilation issues when CONFIG_BLK is enabled.
--- common/avb_verify.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
common/avb_verify.c +5 -4
@@ -5,6 +5,7 @@*/ #include <avb_verify.h> +#include <blk.h> #include <fastboot.h> #include <image.h> #include <malloc.h>
@@ -288,8 +289,8 @@ static unsigned long mmc_read_and_flush(struct mmc_part *part, tmp_buf = buffer; } - blks = part->mmc->block_dev.block_read (part->mmc_blk, - start, sectors, tmp_buf); + blks =blk_dread (part->mmc_blk, + start, sectors, tmp_buf);/* flush cache after read */ flush_cache ((ulong )tmp_buf, sectors * part->info.blksz);
@@ -327,8 +328,8 @@ static unsigned long mmc_write(struct mmc_part *part, lbaint_t start, tmp_buf = buffer; } -return part->mmc->block_dev.block_write (part->mmc_blk, - start, sectors, tmp_buf); +return blk_dwrite (part->mmc_blk, + start, sectors, tmp_buf); }static struct mmc_part *get_partition (AvbOps *ops,const char *partition)
Signature · 1 line
2.7.4
PATCH v2 2/2 avb2.0: use block API in AVB ops
Quoted 46 lines · Igor Opaniuk
Use blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation implementations. This fixes compilation issues when
CONFIG_BLKis enabled.Signed-off-by Igor Opaniuk <[email protected]>--- common/avb_verify.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)common/avb_verify.c +5
-4@@ -5,6 +5,7 @@*/ #include <avb_verify.h> +#include <blk.h> #include <fastboot.h> #include <image.h> #include <malloc.h> @@ -288,8 +289,8 @@ static unsigned long mmc_read_and_flush(struct mmc_part *part, tmp_buf = buffer; } - blks = part->mmc->block_dev.block_read (part->mmc_blk, - start, sectors, tmp_buf); + blks =blk_dread (part->mmc_blk, + start, sectors, tmp_buf);/* flush cache after read */ flush_cache ((ulong )tmp_buf, sectors * part->info.blksz);@@ -327,8 +328,8 @@ static unsigned long mmc_write(struct mmc_part *part, lbaint_t start, tmp_buf = buffer; } -return part->mmc->block_dev.block_write (part->mmc_blk, - start, sectors, tmp_buf); +return blk_dwrite (part->mmc_blk, + start, sectors, tmp_buf); }static struct mmc_part *get_partition (AvbOps *ops,const char *partition)Signature · 1 line
2.7.4
I confirm this patch fixes below compilation failure on sandbox (LIBAVB=y, AVB_VERIFY=y, FASTBOOT=y, BLK=y):
common/avb_verify.c: In function ‘mmc_read_and_flush’:common/avb_verify.c:291:18: error: ‘struct mmc’ has no member named ‘block_dev’
blks = part->mmc->block_dev.block_read(part->mmc_blk,
^~
common/avb_verify.c: In function ‘mmc_write’:common/avb_verify.c:330:18: error: ‘struct mmc’ has no member named ‘block_dev’
return part->mmc->block_dev.block_write(part->mmc_blk,
With this patch, avb_verify compiles equally well with BLK=y and BLK=n.
Thanks,
Eugeniu.
PATCH v2 2/2 avb2.0: use block API in AVB ops
In reply to Igor OpaniukQuoted 6 lines · Igor Opaniuk
Use blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation implementations. This fixes compilation issues when
CONFIG_BLKis enabled.Signed-off-by Igor Opaniuk <[email protected]>Tested-by Eugeniu Rosca <[email protected]>
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: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180726/029e4f7b/attachment.sig>