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 265D8C636CC for ; Sun, 5 Feb 2023 23:51:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 14CC985B35; Mon, 6 Feb 2023 00:50:44 +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="7lPcIWnf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6FFD385755; Mon, 6 Feb 2023 00:50:35 +0100 (CET) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 E5CBC85755 for ; Mon, 6 Feb 2023 00:50:28 +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-wm1-x32d.google.com with SMTP id f23-20020a05600c491700b003dff4480a17so1605909wmp.1 for ; Sun, 05 Feb 2023 15:50:28 -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=C9okDMqLGueMi4tqjmXZbmxlF6tCI75Eu4WHUs+YIPE=; b=7lPcIWnffjFIzmOn0bQm7/eGbvgE4ZtDGtog4gBvKsHeoKuS42tA3ywSq7pXE+FMAu +Q037s2uNuNjM/ghaqiIXDk09LQEdnDpFi1IIMONC1dteeMFeJclavTWW2hUePYSfrbv pFGmWgbkFKn/b0NF+N9PMYEpuxHYP2gb6zF//XxZI20psnR13VaryiIcykDwEg0gSs0M nonECcV277Fo19whrtI8uT71S/Tp77gxeJdjHpB5C4geIJgducXWI+2NY9Qo1n0gXfwf Dokn1NQtWRm2xQe1I/yAHn42N57+1GRUucY5d41Qi9rBk9C/Zx9dy7SuDkPGxtw2HAS2 GvHw== 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=C9okDMqLGueMi4tqjmXZbmxlF6tCI75Eu4WHUs+YIPE=; b=mHXaBTU0s7M00iU7hU8H5wsiWSIsqDVnXhybMAWz1gNxOKE3ME0bWDqjK+xKQYS/sI Sn124ExivBuZ2wQLRop6fnxstwbWKBJMbw/wJYenp6qCtZT2F2ifyvgek+iT/UIooWpt zvH2dPULCC5B669yfgg1I8BEgPlLZIRK84Eq8wlgkHvjCDL/1stC/GWNf9D9cRDILyE2 KlSrH4LD7rZO/FbscDRqwAlBSAxN7c1vYeFXal4J2tKm7kK304GrHkZHCECN+Ur0jNjx OLJpOYchlaNHWlHBOkvzXRnmRUBFPzMHdvv/qXyI18PxBExQnhKagjCCMmzFR/j5Ewhc U+/A== X-Gm-Message-State: AO0yUKXrM7vncX19HSYvDSDCyzWHpr4opLz6dihQQF58NRiq8Klz8MkB PCpbw5Oqh2Z6kxVrfvjPWvl5Lw== X-Google-Smtp-Source: AK7set/djRawjmdW6Ed12z9BWC+Dajn874N3tFDtxYj112ifor7h5e+/mI+4Zrw1fBWu61rRZJ5IKQ== X-Received: by 2002:a05:600c:c06:b0:3dc:5a7c:f8ad with SMTP id fm6-20020a05600c0c0600b003dc5a7cf8admr21477265wmb.21.1675641028503; Sun, 05 Feb 2023 15:50:28 -0800 (PST) Received: from safae-ThinkPad-T480.. ([2a04:cec0:11ad:6643:93a:a991:f152:4df7]) by smtp.gmail.com with ESMTPSA id w2-20020a5d6802000000b002bfb1de74absm7430196wru.114.2023.02.05.15.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Feb 2023 15:50:28 -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 v3 02/19] android: boot: support vendor boot image in abootimg Date: Mon, 6 Feb 2023 00:50:04 +0100 Message-Id: <20230205235021.355410-3-souajih@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230205235021.355410-1-souajih@baylibre.com> References: <20230205235021.355410-1-souajih@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Vendor boot image is introduced in boot image header version 3 and 4. Please check [1] for more details. To prepare for boot image v3/v4 support, allow the abootimg command to store the vendor_boot image address. Full support for this new format will be done in a future patch. Link:[1] https://source.android.com/docs/core/architecture/bootloader/partitions/vendor-boot-partitions Signed-off-by: Safae Ouajih Reviewed-by: Simon Glass Reviewed-by: Mattijs Korpershoek --- cmd/abootimg.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cmd/abootimg.c b/cmd/abootimg.c index 0262adb1e5..026c03f91c 100644 --- a/cmd/abootimg.c +++ b/cmd/abootimg.c @@ -15,6 +15,7 @@ /* Please use abootimg_addr() macro to obtain the boot image address */ static ulong _abootimg_addr = -1; +static ulong _avendor_bootimg_addr = -1; static int abootimg_get_ver(int argc, char *const argv[]) { @@ -158,7 +159,7 @@ static int do_abootimg_addr(struct cmd_tbl *cmdtp, int flag, int argc, char *endp; ulong img_addr; - if (argc != 2) + if (argc < 2 || argc > 3) return CMD_RET_USAGE; img_addr = hextoul(argv[1], &endp); @@ -168,6 +169,17 @@ static int do_abootimg_addr(struct cmd_tbl *cmdtp, int flag, int argc, } _abootimg_addr = img_addr; + + if (argc == 3) { + img_addr = simple_strtoul(argv[2], &endp, 16); + if (*endp != '\0') { + printf("Error: Wrong vendor image address\n"); + return CMD_RET_FAILURE; + } + + _avendor_bootimg_addr = img_addr; + } + return CMD_RET_SUCCESS; } @@ -211,7 +223,7 @@ static int do_abootimg_dump(struct cmd_tbl *cmdtp, int flag, int argc, } static struct cmd_tbl cmd_abootimg_sub[] = { - U_BOOT_CMD_MKENT(addr, 2, 1, do_abootimg_addr, "", ""), + U_BOOT_CMD_MKENT(addr, 3, 1, do_abootimg_addr, "", ""), U_BOOT_CMD_MKENT(dump, 2, 1, do_abootimg_dump, "", ""), U_BOOT_CMD_MKENT(get, 5, 1, do_abootimg_get, "", ""), }; @@ -239,7 +251,7 @@ static int do_abootimg(struct cmd_tbl *cmdtp, int flag, int argc, U_BOOT_CMD( abootimg, CONFIG_SYS_MAXARGS, 0, do_abootimg, "manipulate Android Boot Image", - "addr \n" + "addr []>\n" " - set the address in RAM where boot image is located\n" " ($loadaddr is used by default)\n" "abootimg dump dtb\n" -- 2.34.1