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 A9EA2C61DA4 for ; Thu, 9 Feb 2023 14:36:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 24C9685712; Thu, 9 Feb 2023 15:36:02 +0100 (CET) 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="K+sZJ+5Y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3AA6B85868; Thu, 9 Feb 2023 15:36:00 +0100 (CET) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 2E5CF85479 for ; Thu, 9 Feb 2023 15:35:57 +0100 (CET) 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-x335.google.com with SMTP id bg5-20020a05600c3c8500b003e00c739ce4so1661738wmb.5 for ; Thu, 09 Feb 2023 06:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Uk2TTto8Yl9iWcwNgji05wqS/0thppmFA2E8+gK6I2k=; b=K+sZJ+5Yv7d1BVNuOppFyFGN+Glx4JUOSo7kX0fdPUkShm/ISsi1huoQW6IxC4KJhX 2h2iYlw25w8uu1yOE0iMeLcKJivQ4SGyXTb9/QgjoHODW0yD0/HNPhDN5AdHkJB/wCWa P60gXzNyulryVT0R+74IOY0Anv9o8Jf36CYInG30n5BnnAaEaler4tMXc6qLLBBvt8w2 ZNtYq6vX1mHXb6uE+uucKYpMP8KPOeJLJbyFLs5/v6EL096SmkdS8Qn8JkwldO4Yu+k9 8Y0M+Nin/c7xfpwpCIvZY7yBnXOPgyOztQ8bJw6M8dvwPDRFY0fiJ4YgBwp1goXieWFc OxrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=Uk2TTto8Yl9iWcwNgji05wqS/0thppmFA2E8+gK6I2k=; b=jldO/BAy/tUWQsnfKAYY+w6smqSIn0rOqyWarLWJkBb/Tp9dbRpn1iR2Qe8CRezh2/ xowYcLHcFkBnf/KA2AEC34ozEvKWnNW74PqcYQEV82OYq/AGiIwbEtgE291xHR6b8F4T nvM3YZPtn/cuzgIDH3weNe/JBPF/FXBPPQfqtcHQh8vMGmrXYQYmMeZYqK7HlQENjH+x or0/8VXcEhXGjVYTk2bWRrAdbAWIJOaZWNwzAKvVRypQ+pAfk68yFQxUzvH0QQo+RNPI PdKZwBs3dxTSJYrMaMSS1sUBAcRduSgTioNBpquOHsT29mZSO7ItCfBDaAo3alul4ngO Msrg== X-Gm-Message-State: AO0yUKWUmLDRGYQU73g88Rg6SzjZ4d+M6Wh/ZVXxjQUSBjhprZ67ymDt VrCaGBTrEGlUNn8MS0KRs1hhQg== X-Google-Smtp-Source: AK7set8yHTdcjyZtK3wQ3YPamuQteiOUa2LuF7RIsiER0QBeNwoyYpGxYPCc4+DBT6U+qIlHM3Oo0g== X-Received: by 2002:a05:600c:16d6:b0:3e1:541:2b55 with SMTP id l22-20020a05600c16d600b003e105412b55mr5872809wmn.16.1675953356657; Thu, 09 Feb 2023 06:35:56 -0800 (PST) Received: from localhost ([82.66.159.240]) by smtp.gmail.com with ESMTPSA id h28-20020a05600c2cbc00b003dc3f3d77e3sm2258875wmc.7.2023.02.09.06.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 06:35:56 -0800 (PST) From: Mattijs Korpershoek To: Safae Ouajih , sjg@chromium.org Cc: u-boot@lists.denx.de, sean.anderson@seco.com, r.stratiienko@gmail.com, glaroque@baylibre.com, khilman@baylibre.com Subject: Re: [PATCH v3 11/19] android: boot: ramdisk: support vendor ramdisk In-Reply-To: <20230205235021.355410-12-souajih@baylibre.com> References: <20230205235021.355410-1-souajih@baylibre.com> <20230205235021.355410-12-souajih@baylibre.com> Date: Thu, 09 Feb 2023 15:35:55 +0100 Message-ID: <87y1p6j48k.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain 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.6 at phobos.denx.de X-Virus-Status: Clean 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 = 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 > @@ -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_data, ulong *rd_len) > +int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img, > + ulong *rd_data, ulong *rd_len) > { > struct andr_image_data img_data = {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_boot_img_hdr_v0 *hdr, > *rd_data = *rd_len = 0; > return -1; > } > + if (img_data.header_version > 2) { > + ramdisk_ptr = img_data.ramdisk_ptr; > + 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, img_data.boot_ramdisk_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_boot_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_data, ulong *rd_len); > +int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img, > + ulong *rd_data, ulong *rd_len); > > /** > * android_image_get_second() - Extracts the secondary bootloader address > -- > 2.34.1