bootstd: android: don't read whole partition sizes
authorJulien Masson <jmasson@baylibre.com>
Thu, 21 Nov 2024 10:59:55 +0000 (11:59 +0100)
committerMattijs Korpershoek <mkorpershoek@baylibre.com>
Tue, 26 Nov 2024 09:04:40 +0000 (10:04 +0100)
commitabadcda24b100b8eb0f138085cca6595518cec85
tree5222694a184a6da712456401fba1c3913f18ae4e
parent126254ab97691a93902d8fe02fdff0a783921c39
bootstd: android: don't read whole partition sizes

The current implementation is reading the whole partition for boot and
vendor_boot image which can be long following the size of the
partition or the time to read blocks (driver/SoC specific).

For example with mediatek mt8365 EVK board, we have a 64MiB boot
partition and the boot image flashed in this partition is only 42MiB.
It takes ~8-9 secs to read the boot partition.

Instead we can retrieved the boot image and vendor boot image size
with these new functions:
- android_image_get_bootimg_size
- android_image_get_vendor_bootimg_size
Use these information and read only the necessary.

By doing this with mt8365 EVK board, we read boot image in ~5 secs.

Signed-off-by: Julien Masson <jmasson@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20241121-bootmeth-android-part-sizes-v1-1-25760bbd0f08@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
boot/bootmeth_android.c
boot/image-android.c
include/image.h