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 A3CFAC4321E for ; Sat, 26 Nov 2022 17:18:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DF8A98517E; Sat, 26 Nov 2022 18:18:19 +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="nL/4e+Km"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 33A1485160; Sat, 26 Nov 2022 17:59:41 +0100 (CET) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (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 D70EE85031 for ; Sat, 26 Nov 2022 17:59:37 +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-x331.google.com with SMTP id a11-20020a05600c2d4b00b003cf6f5fd9f1so5522095wmg.2 for ; Sat, 26 Nov 2022 08:59:37 -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=4HMIl8MaBC0QaUvDC/FRUJpEiKrVKyvpVpEWzun2nOA=; b=nL/4e+Kmh6oSgPExVfEXY/XeNRyeXQXkmoMbpr2dpBKIBGGW5jYmUZdb/6y6VIOHVC iLRAIlzhbQ9uUbJ5iwPuj4shreQcWgEjje0E39vI9QR9o7cb/jhx/M2tTl0S/5zmotYt /Ybsf7bkQ/UFcoiSNX4oInf7WkbRS5xo1i4Y+thQSd1qN3tVf+g9H7xOMGiO7FIRonVQ Ucsj7oQHEbrBRWA2Z76NMeUu6DDJz6cKqkoE5wIsPJQChfe6PBbJA5vzw4iUS5FNSlWz WEK7snW28nMndOFWsKQumABVRo3FCZ/0D/VPMCV1ZLqyQmPwn1WSRdofD7qxerQBE7KR rYYg== 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=4HMIl8MaBC0QaUvDC/FRUJpEiKrVKyvpVpEWzun2nOA=; b=N0sPGer4wnc76QXenomNAsFI/ld+vbXpsp6ne2w/uH29q6kEL4JUCPN1hwOInHWUE1 3TzQU7zi0N5W7Au65+lWZqukakmsxRM2MnvtohmAme5gvaW0VPXcJCJTiZ4czSYP+HMD p9h3CVVMSPqlffnfqZW595HS3tvalxlHKLqGIXRamPlt4vZGLKZt1wA5SWajd8lluPHt ZLnuT54FpReEQzBQTRO32ubihIzjidQWTDv88LfU+gqBdcG9JbPuSg8iXGuQYf0nIzMU ugsmx8Di2EbQC6fxOfTCsCRU+cP/fk6nlHXNBUSk/I7j0q1tmqWGLwNQI226f4wKQSnX g8/w== X-Gm-Message-State: ANoB5pllSxiMMpxkmcMUVIyvJkOTVEVBpbn/yP9w6uMsz2In8LcpDsBg F9+f5/xtLIBfso2Fx+zbDYSgCA== X-Google-Smtp-Source: AA0mqf464LUpiSpcVEPXdxIxxlBxxKhOe2usePoiAtDlxxZhsSTKG+d81SrheW5aAiXShYw4Cs/tLQ== X-Received: by 2002:a05:600c:1d12:b0:3cf:8441:4a7c with SMTP id l18-20020a05600c1d1200b003cf84414a7cmr36662110wms.0.1669481977332; Sat, 26 Nov 2022 08:59:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Nov 2022 08:59:36 -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 02/17] android: boot: support vendor boot image in abootimg Date: Sat, 26 Nov 2022 17:59:16 +0100 Message-Id: <20221126165931.197607-3-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 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. [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 de2aa3307d9a..ad61cce7588d 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.25.1