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 E4FF7C05027 for ; Thu, 26 Jan 2023 16:06:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D373856E4; Thu, 26 Jan 2023 17:06:50 +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="laQ9qkOD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5D34785559; Thu, 26 Jan 2023 17:05:16 +0100 (CET) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 D8F54856CC for ; Thu, 26 Jan 2023 17:05:09 +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-x433.google.com with SMTP id q10so2267409wrm.4 for ; Thu, 26 Jan 2023 08:05:09 -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=XEYa4uq/LNcQt/kyiYg84u99Ev0QZlFiR6BAWnhk6rc=; b=laQ9qkODG/+7TtoJlAJ404eEiR3w9ovHik4bDypNahBEDrhn/Rb9MRO0Xlstp/qUun KmRMwX7kRalqrDsljPVmCisvPmxH+RAg3QShW+saXGuykHFekV4GPncNe9nr1zMWgC4r 90LFR3bg1MugcrfeZ8oBjrucYzUyEVVrH6GBfyovm50tGDz+eKC+lMwABKbBn+ODCgCw V01NQ/Fwt0wMV+7AWb8ebpkKFUVvOADhEfqg5VIOIFDE/D1o8asdexpaisku+JIwWazk emBR9mPAZQBu2EPylcQNAk4VCi3tSrcDsJIzOPiVUuz37gj7oHq3uQDjwPgLMGoA8qxQ td1g== 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=XEYa4uq/LNcQt/kyiYg84u99Ev0QZlFiR6BAWnhk6rc=; b=kNGh3K8tSV1BzZ7hZ2XWoaR+G0kQgwk+ilMSvLDi8Nv9wOv+3yMjQfmaPTmW62WK/5 AVe8+dYBXITQhgMhwPwfVlxNjpIZZNraypf7y6GoFrKhw/o3925mCE8XbMKA4y9hX7hS f5lDZ3kCdZC3qKRYbEVJYYNI0ZB7r5Gok0EsltSeIvm3R4z1NKmY1FYb5klQ/g8oafPK zZSnklosdZ9junN7U7y3JUJQp8x+X6sap3OW3GvKo2zC43/3Yt2yN3NZCBqXeRbR3EJY EsE0tH22N/KBYftK+WilhDnhHjxd7EGyHy6SHURrPQVqbmL2T1Cc80yKWjago6Lf0sFa nFDA== X-Gm-Message-State: AO0yUKXB6Wnwdij5xOX32HxrJ6cKOMFyasXEZubOJd/r1Ivag8mwrcNh 2wTyBaKXf8rApoc0MZJGr9OocA== X-Google-Smtp-Source: AK7set8BFZnJw/fatN+qcFPhznTfvb+YAIrW22iZHEAs1J6mUxPbuhTKw3vSXMaC1dYYufyjNbG/lQ== X-Received: by 2002:adf:f286:0:b0:2bf:b5ea:8d66 with SMTP id k6-20020adff286000000b002bfb5ea8d66mr7372907wro.16.1674749109592; Thu, 26 Jan 2023 08:05:09 -0800 (PST) Received: from localhost.localdomain (lfbn-nic-1-295-18.w90-116.abo.wanadoo.fr. [90.116.132.18]) by smtp.gmail.com with ESMTPSA id o1-20020adfcf01000000b002bfb6b9f55bsm1721235wrj.16.2023.01.26.08.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 08:05:09 -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 v2 02/17] android: boot: support vendor boot image in abootimg Date: Thu, 26 Jan 2023 17:04:51 +0100 Message-Id: <20230126160506.1026643-3-souajih@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126160506.1026643-1-souajih@baylibre.com> References: <20230126160506.1026643-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 --- 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