* [U-Boot] [PATCH v2 0/2] avb2.0: fix multiple compilation issues in sandbox
@ 2018-07-17 11:33 Igor Opaniuk
2018-07-17 11:33 ` [U-Boot] [PATCH v2 1/2] avb2.0: add proper dependencies Igor Opaniuk
2018-07-17 11:33 ` [U-Boot] [PATCH v2 2/2] avb2.0: use block API in AVB ops Igor Opaniuk
0 siblings, 2 replies; 7+ messages in thread
From: Igor Opaniuk @ 2018-07-17 11:33 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 1/2] avb2.0: add proper dependencies
2018-07-17 11:33 [U-Boot] [PATCH v2 0/2] avb2.0: fix multiple compilation issues in sandbox Igor Opaniuk
@ 2018-07-17 11:33 ` Igor Opaniuk
2018-07-17 22:08 ` Eugeniu Rosca
2018-07-26 19:54 ` [U-Boot] [U-Boot,v2,1/2] " Tom Rini
2018-07-17 11:33 ` [U-Boot] [PATCH v2 2/2] avb2.0: use block API in AVB ops Igor Opaniuk
1 sibling, 2 replies; 7+ messages in thread
From: Igor Opaniuk @ 2018-07-17 11:33 UTC (permalink / raw)
To: u-boot
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(-)
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
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 2/2] avb2.0: use block API in AVB ops
2018-07-17 11:33 [U-Boot] [PATCH v2 0/2] avb2.0: fix multiple compilation issues in sandbox Igor Opaniuk
2018-07-17 11:33 ` [U-Boot] [PATCH v2 1/2] avb2.0: add proper dependencies Igor Opaniuk
@ 2018-07-17 11:33 ` Igor Opaniuk
2018-07-17 22:26 ` Eugeniu Rosca
2018-07-26 19:54 ` [U-Boot] [U-Boot,v2,2/2] " Tom Rini
1 sibling, 2 replies; 7+ messages in thread
From: Igor Opaniuk @ 2018-07-17 11:33 UTC (permalink / raw)
To: u-boot
Use blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation
implementations. This fixes compilation issues when CONFIG_BLK is
enabled.
Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
---
common/avb_verify.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/common/avb_verify.c b/common/avb_verify.c
index f9a00f8..20e35ad 100644
--- a/common/avb_verify.c
+++ b/common/avb_verify.c
@@ -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)
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 1/2] avb2.0: add proper dependencies
2018-07-17 11:33 ` [U-Boot] [PATCH v2 1/2] avb2.0: add proper dependencies Igor Opaniuk
@ 2018-07-17 22:08 ` Eugeniu Rosca
2018-07-26 19:54 ` [U-Boot] [U-Boot,v2,1/2] " Tom Rini
1 sibling, 0 replies; 7+ messages in thread
From: Eugeniu Rosca @ 2018-07-17 22:08 UTC (permalink / raw)
To: u-boot
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 2/2] avb2.0: use block API in AVB ops
2018-07-17 11:33 ` [U-Boot] [PATCH v2 2/2] avb2.0: use block API in AVB ops Igor Opaniuk
@ 2018-07-17 22:26 ` Eugeniu Rosca
2018-07-26 19:54 ` [U-Boot] [U-Boot,v2,2/2] " Tom Rini
1 sibling, 0 replies; 7+ messages in thread
From: Eugeniu Rosca @ 2018-07-17 22:26 UTC (permalink / raw)
To: u-boot
On Tue, Jul 17, 2018 at 02:33:26PM +0300, Igor Opaniuk wrote:
> Use blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation
> implementations. This fixes compilation issues when CONFIG_BLK is
> enabled.
>
> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
> ---
> common/avb_verify.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/common/avb_verify.c b/common/avb_verify.c
> index f9a00f8..20e35ad 100644
> --- a/common/avb_verify.c
> +++ b/common/avb_verify.c
> @@ -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)
> --
> 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.
Tested-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
Thanks,
Eugeniu.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [U-Boot,v2,1/2] avb2.0: add proper dependencies
2018-07-17 11:33 ` [U-Boot] [PATCH v2 1/2] avb2.0: add proper dependencies Igor Opaniuk
2018-07-17 22:08 ` Eugeniu Rosca
@ 2018-07-26 19:54 ` Tom Rini
1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2018-07-26 19:54 UTC (permalink / raw)
To: u-boot
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
-------------- 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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [U-Boot,v2,2/2] avb2.0: use block API in AVB ops
2018-07-17 11:33 ` [U-Boot] [PATCH v2 2/2] avb2.0: use block API in AVB ops Igor Opaniuk
2018-07-17 22:26 ` Eugeniu Rosca
@ 2018-07-26 19:54 ` Tom Rini
1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2018-07-26 19:54 UTC (permalink / raw)
To: u-boot
On Tue, Jul 17, 2018 at 02:33:26PM +0300, Igor Opaniuk wrote:
> Use blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation
> implementations. This fixes compilation issues when CONFIG_BLK is
> enabled.
>
> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
> Tested-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
Applied to u-boot/master, thanks!
--
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-26 19:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 11:33 [U-Boot] [PATCH v2 0/2] avb2.0: fix multiple compilation issues in sandbox Igor Opaniuk
2018-07-17 11:33 ` [U-Boot] [PATCH v2 1/2] avb2.0: add proper dependencies Igor Opaniuk
2018-07-17 22:08 ` Eugeniu Rosca
2018-07-26 19:54 ` [U-Boot] [U-Boot,v2,1/2] " Tom Rini
2018-07-17 11:33 ` [U-Boot] [PATCH v2 2/2] avb2.0: use block API in AVB ops Igor Opaniuk
2018-07-17 22:26 ` Eugeniu Rosca
2018-07-26 19:54 ` [U-Boot] [U-Boot,v2,2/2] " Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.