[PATCH 2/3] avb: Implement get_preloaded_partition callback
Mattijs Korpershoek
mkorpershoek at baylibre.com
Tue May 28 09:32:48 CEST 2024
Hi Roman,
Thank you for the patch.
On dim., mai 19, 2024 at 19:18, Roman Stratiienko <r.stratiienko at gmail.com> wrote:
> AVB can reuse already loaded images instead of loading them
> from the disk.
>
> The get_preloaded_partition now looks for the env. variables
> set by the 'abootimg load' to find the correct partition in RAM.
>
> Signed-off-by: Roman Stratiienko <r.stratiienko at gmail.com>
> ---
> common/avb_verify.c | 53 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 53 insertions(+)
>
> diff --git a/common/avb_verify.c b/common/avb_verify.c
> index cff9117d92..d2626e8844 100644
> --- a/common/avb_verify.c
> +++ b/common/avb_verify.c
> @@ -6,6 +6,7 @@
> #include <avb_verify.h>
> #include <blk.h>
> #include <cpu_func.h>
> +#include <env.h>
> #include <image.h>
> #include <malloc.h>
> #include <part.h>
> @@ -595,6 +596,55 @@ static AvbIOResult read_from_partition(AvbOps *ops,
> num_bytes, buffer, out_num_read, IO_READ);
> }
>
> +#ifdef CONFIG_ANDROID_BOOT_IMAGE
> +/**
> + * get_preloaded_partition() - Gets the starting pointer of a partition that
> + * is pre-loaded in memory, and save it to |out_pointer|.
> + *
> + * If the partition is not pre-loaded in memory, the out_pointer shall not be
> + * modified.
> + *
> + * @ops: contains AVB ops handlers
> + * @partition: partition name, NUL-terminated UTF-8 string
NUL -> NULL
> + * @num_bytes: amount of bytes to read
> + * @out_pointer: pointer to the starting address of the partition
> + * @out_num_bytes_preloaded: amount of bytes pre-loaded in memory
> + *
> + * @return:
> + * AVB_IO_RESULT_OK, if partition was found or was not found
Add:
AVB_IO_RESULT_ERROR_IO, if partition size is smaller than requested
With both small remarks addressed, please add:
Reviewed-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
> + *
> + */
> +static AvbIOResult get_preloaded_partition(AvbOps *ops, const char *partition, size_t num_bytes,
> + uint8_t **out_pointer, size_t *out_num_bytes_preloaded)
> +{
[...]
> --
> 2.40.1
More information about the U-Boot
mailing list