* [PATCH] android: Fix ramdisk loading for bootimage v3+
@ 2024-05-19 13:09 Roman Stratiienko
2024-05-22 13:30 ` Mattijs Korpershoek
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Roman Stratiienko @ 2024-05-19 13:09 UTC (permalink / raw)
To: r.stratiienko, u-boot
Cc: sjg, igor.opaniuk, mkorpershoek, semen.protsenko, souajih
The boot_ramdisk and vendor_ramdisk must be both concatenated together.
Without this change, Android root is missing some of the necessary tools
to complete virtual AB OTA.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
---
boot/image-android.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/boot/image-android.c b/boot/image-android.c
index 04f2a8015e..499eae9bcd 100644
--- a/boot/image-android.c
+++ b/boot/image-android.c
@@ -64,7 +64,6 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3
data->kcmdline = hdr->cmdline;
data->header_version = hdr->header_version;
- data->ramdisk_ptr = env_get_ulong("ramdisk_addr_r", 16, 0);
/*
* The header takes a full page, the remaining components are aligned
@@ -75,6 +74,7 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3
data->kernel_ptr = end;
data->kernel_size = hdr->kernel_size;
end += ALIGN(hdr->kernel_size, ANDR_GKI_PAGE_SIZE);
+ data->ramdisk_ptr = end;
data->ramdisk_size = hdr->ramdisk_size;
data->boot_ramdisk_size = hdr->ramdisk_size;
end += ALIGN(hdr->ramdisk_size, ANDR_GKI_PAGE_SIZE);
@@ -462,25 +462,24 @@ int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img,
return -1;
}
if (img_data.header_version > 2) {
- ramdisk_ptr = img_data.ramdisk_ptr;
+ ramdisk_ptr = img_data.ramdisk_addr;
memcpy((void *)(ramdisk_ptr), (void *)img_data.vendor_ramdisk_ptr,
img_data.vendor_ramdisk_size);
- memcpy((void *)(ramdisk_ptr + img_data.vendor_ramdisk_size),
- (void *)img_data.ramdisk_ptr,
+ ramdisk_ptr += img_data.vendor_ramdisk_size;
+ memcpy((void *)(ramdisk_ptr), (void *)img_data.ramdisk_ptr,
img_data.boot_ramdisk_size);
+ ramdisk_ptr += img_data.boot_ramdisk_size;
if (img_data.bootconfig_size) {
memcpy((void *)
- (ramdisk_ptr + img_data.vendor_ramdisk_size +
- img_data.boot_ramdisk_size),
- (void *)img_data.bootconfig_addr,
+ (ramdisk_ptr), (void *)img_data.bootconfig_addr,
img_data.bootconfig_size);
}
}
printf("RAM disk load addr 0x%08lx size %u KiB\n",
- img_data.ramdisk_ptr, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
+ img_data.ramdisk_addr, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
- *rd_data = img_data.ramdisk_ptr;
+ *rd_data = img_data.ramdisk_addr;
*rd_len = img_data.ramdisk_size;
return 0;
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] android: Fix ramdisk loading for bootimage v3+
2024-05-19 13:09 [PATCH] android: Fix ramdisk loading for bootimage v3+ Roman Stratiienko
@ 2024-05-22 13:30 ` Mattijs Korpershoek
2024-06-10 16:03 ` Igor Opaniuk
2024-06-10 16:51 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2024-05-22 13:30 UTC (permalink / raw)
To: Roman Stratiienko, r.stratiienko, u-boot
Cc: sjg, igor.opaniuk, semen.protsenko, souajih
Hi Roman,
Thank you for the patch.
I know you reported this problem quite a while ago [1].
Sorry I did not follow up.
On dim., mai 19, 2024 at 13:09, Roman Stratiienko <r.stratiienko@gmail.com> wrote:
> The boot_ramdisk and vendor_ramdisk must be both concatenated together.
> Without this change, Android root is missing some of the necessary tools
> to complete virtual AB OTA.
>
> Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
[1] https://lore.kernel.org/r/CAGphcdnC124V_D6x06P6apnE+L+PVJSp+88h0FFY449CBgY=Pw@mail.gmail.com
> ---
> boot/image-android.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/boot/image-android.c b/boot/image-android.c
> index 04f2a8015e..499eae9bcd 100644
> --- a/boot/image-android.c
> +++ b/boot/image-android.c
> @@ -64,7 +64,6 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3
>
> data->kcmdline = hdr->cmdline;
> data->header_version = hdr->header_version;
> - data->ramdisk_ptr = env_get_ulong("ramdisk_addr_r", 16, 0);
>
> /*
> * The header takes a full page, the remaining components are aligned
> @@ -75,6 +74,7 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3
> data->kernel_ptr = end;
> data->kernel_size = hdr->kernel_size;
> end += ALIGN(hdr->kernel_size, ANDR_GKI_PAGE_SIZE);
> + data->ramdisk_ptr = end;
> data->ramdisk_size = hdr->ramdisk_size;
> data->boot_ramdisk_size = hdr->ramdisk_size;
> end += ALIGN(hdr->ramdisk_size, ANDR_GKI_PAGE_SIZE);
> @@ -462,25 +462,24 @@ int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img,
> return -1;
> }
> if (img_data.header_version > 2) {
> - ramdisk_ptr = img_data.ramdisk_ptr;
> + ramdisk_ptr = img_data.ramdisk_addr;
> memcpy((void *)(ramdisk_ptr), (void *)img_data.vendor_ramdisk_ptr,
> img_data.vendor_ramdisk_size);
> - memcpy((void *)(ramdisk_ptr + img_data.vendor_ramdisk_size),
> - (void *)img_data.ramdisk_ptr,
> + ramdisk_ptr += img_data.vendor_ramdisk_size;
> + memcpy((void *)(ramdisk_ptr), (void *)img_data.ramdisk_ptr,
> img_data.boot_ramdisk_size);
> + ramdisk_ptr += img_data.boot_ramdisk_size;
> if (img_data.bootconfig_size) {
> memcpy((void *)
> - (ramdisk_ptr + img_data.vendor_ramdisk_size +
> - img_data.boot_ramdisk_size),
> - (void *)img_data.bootconfig_addr,
> + (ramdisk_ptr), (void *)img_data.bootconfig_addr,
> img_data.bootconfig_size);
> }
> }
>
> printf("RAM disk load addr 0x%08lx size %u KiB\n",
> - img_data.ramdisk_ptr, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
> + img_data.ramdisk_addr, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
>
> - *rd_data = img_data.ramdisk_ptr;
> + *rd_data = img_data.ramdisk_addr;
>
> *rd_len = img_data.ramdisk_size;
> return 0;
> --
> 2.40.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] android: Fix ramdisk loading for bootimage v3+
2024-05-19 13:09 [PATCH] android: Fix ramdisk loading for bootimage v3+ Roman Stratiienko
2024-05-22 13:30 ` Mattijs Korpershoek
@ 2024-06-10 16:03 ` Igor Opaniuk
2024-06-10 16:51 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Igor Opaniuk @ 2024-06-10 16:03 UTC (permalink / raw)
To: Roman Stratiienko; +Cc: u-boot, sjg, mkorpershoek, semen.protsenko, souajih
Hi Roman,
On Sun, May 19, 2024 at 3:09 PM Roman Stratiienko
<r.stratiienko@gmail.com> wrote:
>
> The boot_ramdisk and vendor_ramdisk must be both concatenated together.
> Without this change, Android root is missing some of the necessary tools
> to complete virtual AB OTA.
>
> Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
> ---
> boot/image-android.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/boot/image-android.c b/boot/image-android.c
> index 04f2a8015e..499eae9bcd 100644
> --- a/boot/image-android.c
> +++ b/boot/image-android.c
> @@ -64,7 +64,6 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3
>
> data->kcmdline = hdr->cmdline;
> data->header_version = hdr->header_version;
> - data->ramdisk_ptr = env_get_ulong("ramdisk_addr_r", 16, 0);
>
> /*
> * The header takes a full page, the remaining components are aligned
> @@ -75,6 +74,7 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3
> data->kernel_ptr = end;
> data->kernel_size = hdr->kernel_size;
> end += ALIGN(hdr->kernel_size, ANDR_GKI_PAGE_SIZE);
> + data->ramdisk_ptr = end;
> data->ramdisk_size = hdr->ramdisk_size;
> data->boot_ramdisk_size = hdr->ramdisk_size;
> end += ALIGN(hdr->ramdisk_size, ANDR_GKI_PAGE_SIZE);
> @@ -462,25 +462,24 @@ int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img,
> return -1;
> }
> if (img_data.header_version > 2) {
> - ramdisk_ptr = img_data.ramdisk_ptr;
> + ramdisk_ptr = img_data.ramdisk_addr;
> memcpy((void *)(ramdisk_ptr), (void *)img_data.vendor_ramdisk_ptr,
> img_data.vendor_ramdisk_size);
> - memcpy((void *)(ramdisk_ptr + img_data.vendor_ramdisk_size),
> - (void *)img_data.ramdisk_ptr,
> + ramdisk_ptr += img_data.vendor_ramdisk_size;
> + memcpy((void *)(ramdisk_ptr), (void *)img_data.ramdisk_ptr,
> img_data.boot_ramdisk_size);
> + ramdisk_ptr += img_data.boot_ramdisk_size;
> if (img_data.bootconfig_size) {
> memcpy((void *)
> - (ramdisk_ptr + img_data.vendor_ramdisk_size +
> - img_data.boot_ramdisk_size),
> - (void *)img_data.bootconfig_addr,
> + (ramdisk_ptr), (void *)img_data.bootconfig_addr,
> img_data.bootconfig_size);
> }
> }
>
> printf("RAM disk load addr 0x%08lx size %u KiB\n",
> - img_data.ramdisk_ptr, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
> + img_data.ramdisk_addr, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
>
> - *rd_data = img_data.ramdisk_ptr;
> + *rd_data = img_data.ramdisk_addr;
>
> *rd_len = img_data.ramdisk_size;
> return 0;
> --
> 2.40.1
>
Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
--
Best regards - Atentamente - Meilleures salutations
Igor Opaniuk
mailto: igor.opaniuk@gmail.com
skype: igor.opanyuk
https://www.linkedin.com/in/iopaniuk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] android: Fix ramdisk loading for bootimage v3+
2024-05-19 13:09 [PATCH] android: Fix ramdisk loading for bootimage v3+ Roman Stratiienko
2024-05-22 13:30 ` Mattijs Korpershoek
2024-06-10 16:03 ` Igor Opaniuk
@ 2024-06-10 16:51 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2024-06-10 16:51 UTC (permalink / raw)
To: u-boot, Roman Stratiienko
Cc: sjg, igor.opaniuk, mkorpershoek, semen.protsenko, souajih
On Sun, 19 May 2024 13:09:51 +0000, Roman Stratiienko wrote:
> The boot_ramdisk and vendor_ramdisk must be both concatenated together.
> Without this change, Android root is missing some of the necessary tools
> to complete virtual AB OTA.
>
>
Applied to u-boot/next, thanks!
--
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-10 16:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-19 13:09 [PATCH] android: Fix ramdisk loading for bootimage v3+ Roman Stratiienko
2024-05-22 13:30 ` Mattijs Korpershoek
2024-06-10 16:03 ` Igor Opaniuk
2024-06-10 16:51 ` 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.