From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C712BC77B61 for ; Fri, 7 Apr 2023 13:17:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C447585D2F; Fri, 7 Apr 2023 15:17:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="8LVEiVtr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CCC5E85D6B; Fri, 7 Apr 2023 15:17:03 +0200 (CEST) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 891EA8591B for ; Fri, 7 Apr 2023 15:16:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mkorpershoek@baylibre.com Received: by mail-wm1-x336.google.com with SMTP id m8so13118807wmq.5 for ; Fri, 07 Apr 2023 06:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; t=1680873419; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ZkPe9OYAo0JeKzwUMreYC7WjNKxu4TYlz836RIMhUTg=; b=8LVEiVtrcAbWuTahhSbnC7CX94xdqwr0G9/TvAvqSKj6WvZJFVpk47GE6UFdPSEv4Y 5wQv+SSNmd6c8gR5ZcCGiscPGwfOzxkcpvZ67qh1o/lMA4EiLcVLrw/Be/ItXEo5QpKt 0bYEhZqBs8byZlg/tk/EWILy+1dGTWAfAe+Wn4pDbkZbfI2sPWRompYsnQvgLHUOZIlU FKJwjPzApZLYd9byODA+ElQCi2VAA4mv7Z5AyIXUmEmMpkgZUSam5H14WgUOCQT4Q9mq qdv9WM9hlGdswdsHDJZt6qhiOKfGCeESYBuofx69upghwI79RgXQjrh5uSb2cqmDNn7w LoSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680873419; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZkPe9OYAo0JeKzwUMreYC7WjNKxu4TYlz836RIMhUTg=; b=dMeZAI2cN4dhr77j26XS3I/zzcCpn4Vp9fjnExO1Epgbs3PmDpqpT+rXbhR9MG4Yq9 igGV4vCFxlGVIKnq5IlcvsmcYsBnM5g/vj9PsDtcBO4ZQUGl57yoh0TBOQGl64n4KXFM hkMks+6VPeIAxwp8dnfJzAVgxbQHLuSvQ+diKJakUUzFz0RrUW/D1dwOFEjHGToiszzX oNlU8lwaH/7QSTTk6jpIwm3Yzi/dp/HGfGw/p4bt4kWjDZAsTTNWxvqM4nIkWMGSulzN eozwVlpEN6Zr55YyMajZSKtvb5HjK+IriRxGVtTk8r0IVBxbzPMVUEPQqNCjwnYaakyX 5b4Q== X-Gm-Message-State: AAQBX9d1g3euoTmEHlm12WnEWreyIuFex+zpX1X8r4gtA8192kdsET/A 7/rq2I9p4Y9mRLfe+4LBMmxOmg== X-Google-Smtp-Source: AKy350ahisE2xvmVZZEG9BE/XAZtN9tWQDY3VAUKtVKyi/JmvKpt50oAFr0oZuda5d9nf+Ei+nzncg== X-Received: by 2002:a05:600c:378a:b0:3ed:8c60:c512 with SMTP id o10-20020a05600c378a00b003ed8c60c512mr1254599wmr.17.1680873418945; Fri, 07 Apr 2023 06:16:58 -0700 (PDT) Received: from localhost ([2a01:cb19:85e6:1900:2bf7:7388:731d:c4e1]) by smtp.gmail.com with ESMTPSA id p15-20020a7bcc8f000000b003ed4f6c6234sm4569131wma.23.2023.04.07.06.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 06:16:58 -0700 (PDT) From: Mattijs Korpershoek To: Roman Stratiienko Cc: Safae Ouajih , sjg@chromium.org, u-boot@lists.denx.de, sean.anderson@seco.com, glaroque@baylibre.com, khilman@baylibre.com, ouajih.safae@gmail.com Subject: Re: [PATCH v3 11/19] android: boot: ramdisk: support vendor ramdisk In-Reply-To: References: <20230205235021.355410-1-souajih@baylibre.com> <20230205235021.355410-12-souajih@baylibre.com> <87y1p6j48k.fsf@baylibre.com> Date: Fri, 07 Apr 2023 15:16:57 +0200 Message-ID: <87pm8fg7cm.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hi Roman, On ven., avril 07, 2023 at 11:56, Roman Stratiienko wrote: > Hi guys, > > I rebased on uboot/master and all is working for me except for the Thanks a lot for confirming that things work for you. > boot image ramdisk concatenation. > Current memcpy logic overwrites its context. Please find a fix that > works for me here: > https://github.com/GloDroidCommunity/raspberry-pi/blob/151fae1c7ddb7d3470= 34dd135631f8f7075c7968/patches-aosp/glodroid/bootloader/u-boot/0006-android= -Fix-ramdisk-loading-for-bootimage-v3.patch Thanks as well for reporting this problem. I did not observe any problems with the ramdisk concatenation when I tested on a TI AM62x evk boa= rd with these: * https://gitlab.baylibre.com/baylibre/ti/android/aosp/device/ti/am62x/-/me= rge_requests/29 * https://gitlab.baylibre.com/baylibre/ti/ti-u-boot/-/merge_requests/7 * https://gitlab.baylibre.com/baylibre/ti/ti-linux-kernel/-/merge_requests/= 75 Note that it's a bit of unfortunate timing for me. I am leaving my office f= or a month of break. I will have a look at this when I come back after my vacati= on. Regards, Mattijs > > =D1=87=D1=82, 9 =D1=84=D0=B5=D0=B2=D1=80. 2023=E2=80=AF=D0=B3. =D0=B2 16:= 35, Mattijs Korpershoek : >> >> On Mon, Feb 06, 2023 at 00:50, Safae Ouajih wrote: >> >> > Version 3 and 4 of boot image header introduced >> > vendor boot ramdisk: Please check include/android_image.h >> > for details. >> > >> > The ramdisk is now split into a generic ramdisk in boot image >> > and a vendor ramdisk in vendor boot image. >> > >> > Support the new vendor ramdisk. >> > >> > Signed-off-by: Safae Ouajih >> > Reviewed-by: Simon Glass >> >> Reviewed-by: Mattijs Korpershoek >> >> > --- >> > boot/image-android.c | 13 +++++++++++-- >> > include/image.h | 4 ++-- >> > 2 files changed, 13 insertions(+), 4 deletions(-) >> > >> > diff --git a/boot/image-android.c b/boot/image-android.c >> > index 712d437766..35243fd5b1 100644 >> > --- a/boot/image-android.c >> > +++ b/boot/image-android.c >> > @@ -25,6 +25,7 @@ static void android_boot_image_v3_v4_parse_hdr(const= struct andr_boot_img_hdr_v3 >> > >> > data->kcmdline =3D hdr->cmdline; >> > data->header_version =3D hdr->header_version; >> > + data->ramdisk_ptr =3D env_get_ulong("ramdisk_addr_r", 16, 0); >> > >> > /* >> > * The header takes a full page, the remaining components are al= igned >> > @@ -322,10 +323,11 @@ ulong android_image_get_kcomp(const struct andr_= boot_img_hdr_v0 *hdr, >> > return image_decomp_type(p, sizeof(u32)); >> > } >> > >> > -int android_image_get_ramdisk(const struct andr_boot_img_hdr_v0 *hdr, >> > - const void *vendor_boot_img, ulong *rd_dat= a, ulong *rd_len) >> > +int android_image_get_ramdisk(const void *hdr, const void *vendor_boo= t_img, >> > + ulong *rd_data, ulong *rd_len) >> > { >> > struct andr_image_data img_data =3D {0}; >> > + ulong ramdisk_ptr; >> > >> > if (!android_image_get_data(hdr, vendor_boot_img, &img_data)) >> > return -EINVAL; >> > @@ -334,6 +336,13 @@ int android_image_get_ramdisk(const struct andr_b= oot_img_hdr_v0 *hdr, >> > *rd_data =3D *rd_len =3D 0; >> > return -1; >> > } >> > + if (img_data.header_version > 2) { >> > + ramdisk_ptr =3D img_data.ramdisk_ptr; >> > + memcpy((void *)(ramdisk_ptr), (void *)img_data.vendor_ra= mdisk_ptr, >> > + img_data.vendor_ramdisk_size); >> > + memcpy((void *)(ramdisk_ptr + img_data.vendor_ramdisk_si= ze), >> > + (void *)img_data.ramdisk_ptr, img_data.boot_ramdi= sk_size); >> > + } >> > >> > printf("RAM disk load addr 0x%08lx size %u KiB\n", >> > img_data.ramdisk_ptr, DIV_ROUND_UP(img_data.ramdisk_size,= 1024)); >> > diff --git a/include/image.h b/include/image.h >> > index c2e751c136..c4d9b1c575 100644 >> > --- a/include/image.h >> > +++ b/include/image.h >> > @@ -1782,8 +1782,8 @@ int android_image_get_kernel(const struct andr_b= oot_img_hdr_v0 *hdr, >> > * @rd_len: Pointer to a ulong variable, will hold ramdisk length >> > * Return: 0 if succeeded, -1 if ramdisk size is 0 >> > */ >> > -int android_image_get_ramdisk(const struct andr_boot_img_hdr_v0 *hdr, >> > - const void *vendor_boot_img, ulong *rd_dat= a, ulong *rd_len); >> > +int android_image_get_ramdisk(const void *hdr, const void *vendor_boo= t_img, >> > + ulong *rd_data, ulong *rd_len); >> > >> > /** >> > * android_image_get_second() - Extracts the secondary bootloader add= ress >> > -- >> > 2.34.1