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 81B82C4321E for ; Sat, 26 Nov 2022 17:21:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2ADDE852C8; Sat, 26 Nov 2022 18:18:55 +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="CRI6rz/I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B6E2685031; Sat, 26 Nov 2022 18:00:11 +0100 (CET) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 6B25A85023 for ; Sat, 26 Nov 2022 18:00:00 +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=souajih@baylibre.com Received: by mail-wr1-x431.google.com with SMTP id n3so10815557wrp.5 for ; Sat, 26 Nov 2022 09:00:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2i52hx3AvcDJap+HeLcKEfDiv+ciEiBF2fdHI1g+FmA=; b=CRI6rz/IuPs4Nwp9gpKTPwPR3zJF/UPb23fDhL+IaSWpXfuBaM7AHZVvtPqpDB1tcL /juPzh3vgb/EGUh/noznxKogoSEIzXEoFR6F3HM4NF9kesA8jVbRbSo9xIEVbvLvUwMJ 4DliBimLJ09L+8WgGOBFRX/QPX30NZ/M4usbqLT+ICGU6mVe+iGIx+QfSBui38i2lgEd JzC1o0XVtaGvf577JeAp3nBfOSi0WW1znh/zuviLWdDoIO6eqj+QfAA8xwKvw42NaiJ2 Tc8qSht98Fr3kHig24YJs18vdguopP6JTd3BXHWVpUNwZglznpjVsjKMHl3j0MKdkQ7n CTVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2i52hx3AvcDJap+HeLcKEfDiv+ciEiBF2fdHI1g+FmA=; b=OEVhXXgRkelMZ2/0FXx+v1x6jHf7lFTlcZCwo7JTkzE5h2ZYWM8XfmF/fFszJ1bYrS VRpctvwca0YJ/yQkIuzWQMRTazOHjhlKLG1mpJeHw53KPQGasY4jcdeJASOj6UxGlBwh 5nIaOm/ogCpN2bbdLCX5EiPR3nXZOwpGY3mB+XA89h+F4v8KtWYs/5DB397YaDk1Cc8Y rxu1urM4CYerMMQrP7fJNf+FQjSkOrat4Fz27vvzhYuWnzjMLGClPQFDvGBAFkHsMFxi xut2XkkImf+jnmKY+jgYFKLNwgIgLUNlBkx7u8Mh59lbxiT1NpM/J0zCC84EwMGt/SQG +Dgg== X-Gm-Message-State: ANoB5pmP2LvSPaet2US3SohBOk0YQbJWAZWeP2ZDGzCn7hw6/AgUUT4n G9bJg+hdVaifwv/57xrOl8vd3g== X-Google-Smtp-Source: AA0mqf4iACvNR2xIT9krWtF6WyWCmsh6oWTofHU5gD6RBWXlurt+5ypfye1jdQHFWQAuS2jbIA84og== X-Received: by 2002:a5d:6d49:0:b0:236:bad6:44df with SMTP id k9-20020a5d6d49000000b00236bad644dfmr25856837wri.489.1669481999942; Sat, 26 Nov 2022 08:59:59 -0800 (PST) Received: from safae.baylibre.local ([2a04:cec0:11b5:4031:7588:eb2c:a5c2:aa6d]) by smtp.gmail.com with ESMTPSA id c15-20020adfe70f000000b00241e8d00b79sm7462408wrm.54.2022.11.26.08.59.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Nov 2022 08:59:59 -0800 (PST) From: Safae Ouajih To: sjg@chromium.org Cc: u-boot@lists.denx.de, sean.anderson@seco.com, r.stratiienko@gmail.com, mkorpershoek@baylibre.com, glaroque@baylibre.com, khilman@baylibre.com Subject: [PATCH 17/17] android: boot: support bootconfig Date: Sat, 26 Nov 2022 17:59:31 +0100 Message-Id: <20221126165931.197607-18-souajih@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221126165931.197607-1-souajih@baylibre.com> References: <20221126165931.197607-1-souajih@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sat, 26 Nov 2022 18:18:14 +0100 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 This adds support for Bootconfig feature. - The bootconfig feature replaces the androidboot.* kernel cmdline options. - CONFIG_LIBXBC must be enabled Signed-off-by: Safae Ouajih --- boot/image-android.c | 22 +++++++++++++++++++++- include/android_image.h | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/boot/image-android.c b/boot/image-android.c index 557047660bc3..1c4d21e945a1 100644 --- a/boot/image-android.c +++ b/boot/image-android.c @@ -14,6 +14,10 @@ #include #include +#ifdef CONFIG_LIBXB +#include +#endif + #define ANDROID_IMAGE_DEFAULT_KERNEL_ADDR 0x10008000 static char andr_tmp_str[ANDR_BOOT_ARGS_SIZE + 1]; @@ -60,6 +64,7 @@ static void android_vendor_boot_image_v3_v4_parse_hdr(const struct andr_vendor_b data->image_name = hdr->name; data->kernel_addr = hdr->kernel_addr; data->ramdisk_addr = hdr->ramdisk_addr; + data->bootconfig_size = hdr->bootconfig_size; end = (ulong)hdr; end += hdr->page_size; if (hdr->vendor_ramdisk_size) { @@ -74,7 +79,15 @@ static void android_vendor_boot_image_v3_v4_parse_hdr(const struct andr_vendor_b end += ALIGN(hdr->dtb_size, hdr->page_size); end += ALIGN(hdr->vendor_ramdisk_table_size, hdr->page_size); - end += ALIGN(hdr->bootconfig_size, hdr->page_size); +#ifdef CONFIG_LIBXB + data->bootconfig_addr = end; + if (hdr->bootconfig_size) { + data->bootconfig_size += addBootConfigTrailer(data->bootconfig_addr, + data->bootconfig_size); + data->ramdisk_size += data->bootconfig_size; + } +#endif + end += ALIGN(data->bootconfig_size, hdr->page_size); data->vendor_boot_img_total_size = end - (ulong)hdr; } @@ -351,6 +364,13 @@ int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img, img_data.vendor_ramdisk_size); memcpy((void *)(ramdisk_ptr + img_data.vendor_ramdisk_size), (void *)img_data.ramdisk_ptr, img_data.boot_ramdisk_size); +#ifdef CONFIG_LIBXB + if (img_data.bootconfig_size) { + memcpy((void *)(ramdisk_ptr + img_data.vendor_ramdisk_size + + img_data.boot_ramdisk_size), (void *)img_data.bootconfig_addr, + img_data.bootconfig_size); + } +#endif } printf("RAM disk load addr 0x%08lx size %u KiB\n", diff --git a/include/android_image.h b/include/android_image.h index b9591633c9f7..17412a609320 100644 --- a/include/android_image.h +++ b/include/android_image.h @@ -333,6 +333,9 @@ struct andr_image_data { ulong recovery_dtbo_ptr; u32 recovery_dtbo_size; + ulong bootconfig_addr; + ulong bootconfig_size; + const char *kcmdline; const char *kcmdline_extra; const char *image_name; -- 2.25.1