From patchwork Mon Apr 1 10:52:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 1072793 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=de.adit-jv.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44XtkN0d9Jz9sNw for ; Tue, 2 Apr 2019 00:39:56 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id AE297C21EE7; Mon, 1 Apr 2019 13:39:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=KHOP_BIG_TO_CC autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8C494C21EE3; Mon, 1 Apr 2019 13:37:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 598BDC21D65; Mon, 1 Apr 2019 10:54:00 +0000 (UTC) Received: from smtp1.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lists.denx.de (Postfix) with ESMTPS id 09A79C21D4A for ; Mon, 1 Apr 2019 10:54:00 +0000 (UTC) Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id B622D3C014D; Mon, 1 Apr 2019 12:53:59 +0200 (CEST) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EZ3i67Cd3lP7; Mon, 1 Apr 2019 12:53:52 +0200 (CEST) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id 814C03C0149; Mon, 1 Apr 2019 12:53:52 +0200 (CEST) Received: from vmlxhi-102.adit-jv.com (10.72.93.184) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 1 Apr 2019 12:53:51 +0200 From: Eugeniu Rosca To: Simon Glass , Tom Rini , Masahiro Yamada , Stefan Roese , Sam Protsenko , Simon Goldschmidt , Marek Vasut , George McCollister , Alexey Brodkin , Alexander Graf , York Sun , Tuomas Tynkkynen , Thomas Petazzoni , Shawn Guo , Paul Kocialkowski , Pantelis Antoniou , Michal Simek , Max Krummenacher , Marcel Ziswiler , Joe Hershberger , Joakim Tjernlund , Heiko Schocher , Hannes Schmelzer , Hannes Schmelzer , Daniel Schwierzeck , Bin Meng , Date: Mon, 1 Apr 2019 12:52:52 +0200 Message-ID: <20190401105252.30002-1-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401104537.29801-1-erosca@de.adit-jv.com> References: <20190401104537.29801-1-erosca@de.adit-jv.com> MIME-Version: 1.0 X-Originating-IP: [10.72.93.184] X-Mailman-Approved-At: Mon, 01 Apr 2019 13:37:35 +0000 Cc: Eugeniu Rosca , Eugeniu Rosca Subject: [U-Boot] [PATCH v2 5/5] fdt: boot_get_fdt: android: use ENV 'fdtaddr' as fallback X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Our platform doesn't store the DTB into the Android image second area, but rather copies the DTB to RAM from a dedicated dtb.img partition [0], prior to booting the Android image by calling bootm. Similar to [1], we find it useful to just call 'bootm' and have the right DTB being passed to OS (assuming its address has been previously stored in 'fdtaddr' by calling `fdt addr `). Booting Android with DTB from 'fdtaddr' will only occur if: - No DTB is embedded in the second area of Android image - 'fdtaddr' points to a valid DTB in RAM [0] https://source.android.com/devices/architecture/dto/partitions [1] https://patchwork.ozlabs.org/patch/1046652/ ("Support boot Android image without address on bootm command") Signed-off-by: Eugeniu Rosca Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- Changes in v2: - Removed fdt_totalsize() computation, since FDT size verification is only relevant for blobs embedded in U-Boot-supported images - Link v1: https://patchwork.ozlabs.org/patch/1071591/ --- common/image-fdt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/image-fdt.c b/common/image-fdt.c index a5d8b41d0209..3aa5ffff0f69 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -469,7 +469,15 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, debug("## Using FDT in Android image second area\n"); } else { - goto no_fdt; + fdt_addr = env_get_hex("fdtaddr", 0); + if (!fdt_addr) + goto no_fdt; + + fdt_blob = map_sysmem(fdt_addr, 0); + if (fdt_check_header(fdt_blob)) + goto no_fdt; + + debug("## Using FDT at ${fdtaddr}=Ox%lx\n", fdt_addr); } #endif } else {