From patchwork Thu Oct 19 14:04:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 116398 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp3463926edb; Thu, 19 Oct 2017 07:05:31 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RQc/ojYKH6LnmMd7lrtB8n5ZN6gt1tc0UDv8dhW2h1bAiCDEv71eISST0biAeOhbdh83My X-Received: by 10.80.130.67 with SMTP id 61mr2568020edf.3.1508421931657; Thu, 19 Oct 2017 07:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508421931; cv=none; d=google.com; s=arc-20160816; b=s2AWzmAqwSBA1HlTsxUy/ihKEU8ZWkW5Bp9RaeNcJoERY07xbG7SNe+Y0g5QYDZ4+F ncchRA/1WHjI0C3qm+TMubJBRlel9yQXRMu6pmPEAnTPSyP/JAWyJLZV9YtCcMC7NSfM fRDrCQGC88P18N9jPdIIAe+LkVH9XZToZLdcjSE9TbiW++a0nzAAAKP4bvgJ1hiGVukF MJqszTdYQQtnSVjBYR4uayG5wJWqGUobkPI2AI27xWFFhYWd9dEa8JZN9yarDN7W1Erq n/6wQz22tOIBrVHLiWJMHjSVTPCM0fnZcc+qV/nAqUlEAxCpQwASi5WjSArfmYduQBbO L83Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=UiBo72ezy3jj/5LRVESUlHSfGBs8kpGTsUO4hAgcBJw=; b=YnO7DlYXNGpG2uT13qbxfl+X6fK1BzurpURJ5pqR2+mNv7mYfRNwi4RfvrLTidIRnp YRF0fpE14gmaPZobUkpxk734L3An2mJjvZHVy7R7/p/7S6dxQuCxAlE1+ttDZxESW2YL mDmRNwXWP6g+0K4J5x8DcP2K8RPlYUwrFTAV7L2C5mVsQvBCiFr9lnxtLvXBwop7awbN bWydVfAIPL09VRI4puDzQJYPCkKGbnbdtf5S5NgjSLA0qnpNSBiACLAdjIBpTKfB66+L wukwfe052aLFNn2aGikZjyNNYibayBVwBvKKZ1zHJeDWfFwGrt0U2qzRDyPNIBP0Lrmr /rfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id k60si4693981edc.530.2017.10.19.07.05.31; Thu, 19 Oct 2017 07:05:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 3F6E0C21FA1; Thu, 19 Oct 2017 14:05:08 +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=none 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 805BFC21FA1; Thu, 19 Oct 2017 14:04:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 666A9C21F8C; Thu, 19 Oct 2017 14:04:38 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 6E30CC21F6E for ; Thu, 19 Oct 2017 14:04:35 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id EA44C20438; Thu, 19 Oct 2017 16:04:33 +0200 (CEST) Received: from localhost (unknown [185.94.189.190]) by mail.free-electrons.com (Postfix) with ESMTPSA id 7E8B42046F; Thu, 19 Oct 2017 16:04:23 +0200 (CEST) From: Maxime Ripard To: Tom Rini Date: Thu, 19 Oct 2017 16:04:18 +0200 Message-Id: <20171019140419.30996-2-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171019140419.30996-1-maxime.ripard@free-electrons.com> References: <20171019140419.30996-1-maxime.ripard@free-electrons.com> Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH 1/2] sunxi: binman: Add U-Boot binary size check 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The U-boot binary may trip over its actual allocated size in the storage. In such a case, the environment will not be readable anymore (because corrupted when the new image was flashed), and any attempt at using saveenv to reconstruct the environment will result in a corrupted U-boot binary. Signed-off-by: Maxime Ripard Reviewed-by: Andre Przywara Tested-by: Frank Kunz --- arch/arm/dts/sunxi-u-boot.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi index 5adfd9bca2ec..b44660e8d37e 100644 --- a/arch/arm/dts/sunxi-u-boot.dtsi +++ b/arch/arm/dts/sunxi-u-boot.dtsi @@ -1,5 +1,13 @@ #include +/* + * This is the maximum size the U-boot binary can be, which is + * basically the start of the environment, minus the (padded) size of + * the SPL), minus the offset at which the generated file is supposed + * to be flashed in the MMC. + */ +#define UBOOT_MAX_SIZE (CONFIG_ENV_OFFSET - CONFIG_SPL_PAD_TO - (8 << 10)) + / { binman { filename = "u-boot-sunxi-with-spl.bin"; @@ -8,6 +16,9 @@ filename = "spl/sunxi-spl.bin"; }; u-boot-img { +#ifdef CONFIG_MMC + size = ; +#endif pos = ; }; }; From patchwork Thu Oct 19 14:04:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 116399 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp3464227edb; Thu, 19 Oct 2017 07:05:46 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TsD8tW1Z4N5DCFbJ9CT4QP0UMJU/C3IfBkXFg1RPsKmxyxEVvLSCFY6L4azwECojTrK8+B X-Received: by 10.80.179.120 with SMTP id r53mr2619106edd.174.1508421945964; Thu, 19 Oct 2017 07:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508421945; cv=none; d=google.com; s=arc-20160816; b=zph7B2jyQdadcVkSaeYBBaSX7fEmMcfj6RE987zUTGQTcD+hOa8fjELBqgSqaVOuiK 4CuGP4hjajfpDve5HEOfsWcGzsYt4RsixrUgOiCuVV4/2jFoj6V/U3LHvHFO1GYt0ZJi aGknsKfctqm8unmGGK3mv7a8F7svLkTqrTzGQzWDoZmeJDygUyVw2IOeDwcTvsqhnSAf yo1vCBdN0wHPn6ErotzwOAyVJl7rs69Yk3XD4NG3eRKrhGoCnGwS8VE+2Q0NCD39CCI5 YC8WL4W/MvsPxDyAeyAvchQdYHfytflO1We7vtnzGnlyoWoAqcTlSkF2pZK63Cpg2WJH nJTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=5N1dYWMxgKOcQS3iZKa4s6pRK7YSpL3DTGnA5j10GPg=; b=Uo2yBzwg75+1UaQQHaS6ZBr6hDyME3c1zOPfWq4wuxNnNPLW+A9SUXCxO6KlH9ygSx Y7X0lQLUSnYNe/+eFUdV8z5yvKxgpMQ6K4b+hdyylBW5+0nDPOySpFKftbJB7tvd0A3o EMv0deN2Ik4UjUJrcwR865hogljgLhHf6b698Mtbar4MLFFoE0AYmR8FBECt2qhGIi57 n0uYOvjxCZZpPK99T5M63e+xI06/jumCoxezC9YPtnY7n2oYuH857WI4H+2ORpd/bPjw M2EanLCBwuCTkjs13l2sZqf07+ZczJfcAgR2nr15MJ2FhnMAJhZ87+xywDKaF5YfsdJG 9zlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 59si1909657edy.340.2017.10.19.07.05.45; Thu, 19 Oct 2017 07:05:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 95C93C21FB1; Thu, 19 Oct 2017 14:04:51 +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=none 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 A67E8C21F5B; Thu, 19 Oct 2017 14:04:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0470BC21F6F; Thu, 19 Oct 2017 14:04:40 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 613F7C21F8C for ; Thu, 19 Oct 2017 14:04:37 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id E077020700; Thu, 19 Oct 2017 16:04:35 +0200 (CEST) Received: from localhost (unknown [185.94.189.190]) by mail.free-electrons.com (Postfix) with ESMTPSA id 704CF20614; Thu, 19 Oct 2017 16:04:25 +0200 (CEST) From: Maxime Ripard To: Tom Rini Date: Thu, 19 Oct 2017 16:04:19 +0200 Message-Id: <20171019140419.30996-3-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171019140419.30996-1-maxime.ripard@free-electrons.com> References: <20171019140419.30996-1-maxime.ripard@free-electrons.com> Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH 2/2] sunxi: Enable THUMB build for the U-Boot binary 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" We start to get to the limit of our main U-Boot binary size (with some boards even crossing it). Enable its build using thumb2 to get some extra room. Suggested-by: Siarhei Siamashka Signed-off-by: Maxime Ripard --- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 64e0ee43f112..83b7aa51dc2c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -698,6 +698,7 @@ config ARCH_SUNXI select SPL_SYS_MALLOC_SIMPLE if SPL select SYS_NS16550 select SPL_SYS_THUMB_BUILD if !ARM64 + select SYS_THUMB_BUILD if !ARM64 select USB if DISTRO_DEFAULTS select USB_STORAGE if DISTRO_DEFAULTS select USB_KEYBOARD if DISTRO_DEFAULTS