From patchwork Fri Apr 1 15:22:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Koenig X-Patchwork-Id: 89293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5AF03B6F8F for ; Sat, 2 Apr 2011 02:29:08 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7C0E628090; Fri, 1 Apr 2011 17:29:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K8agbulptifu; Fri, 1 Apr 2011 17:29:03 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7B87828088; Fri, 1 Apr 2011 17:29:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 03D8628089 for ; Fri, 1 Apr 2011 17:28:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OBRP4lghY+2u for ; Fri, 1 Apr 2011 17:28:56 +0200 (CEST) X-Greylist: delayed 518 seconds by postgrey-1.27 at theia; Fri, 01 Apr 2011 17:28:54 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from authsmtp.rrzn.uni-hannover.de (authsmtp.rrzn.uni-hannover.de [130.75.2.107]) by theia.denx.de (Postfix) with ESMTPS id 041D828087 for ; Fri, 1 Apr 2011 17:28:54 +0200 (CEST) Received: from pc60.ikt.uni-hannover.de (gateway.ikt.uni-hannover.de [130.75.73.1]) by authsmtp.rrzn.uni-hannover.de (8.14.4/8.14.4) with ESMTP id p31FKCPs019020; Fri, 1 Apr 2011 17:20:19 +0200 From: Christoph Koenig To: u-boot@lists.denx.de Date: Fri, 1 Apr 2011 17:22:00 +0200 Message-Id: <1301671320-16131-2-git-send-email-christoph.koenig@ikt.uni-hannover.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1301671320-16131-1-git-send-email-christoph.koenig@ikt.uni-hannover.de> References: <1301671320-16131-1-git-send-email-christoph.koenig@ikt.uni-hannover.de> X-PMX-Version: 5.5.9.395186, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.4.1.151220 Cc: michael.bredel@ikt.uni-hannover.de Subject: [U-Boot] [PATCH 2/2] Implementation of a bootloader area protection during auto-update (new CONFIG_SYSTEM_START_ADDR necessary) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de --- common/update.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/common/update.c b/common/update.c index fe2139a..8b858bd 100644 --- a/common/update.c +++ b/common/update.c @@ -195,6 +195,13 @@ static int update_flash(ulong addr_source, ulong addr_first, ulong size) return 1; } +#ifdef CONFIG_SYSTEM_START_ADDR + if (addr_first < CONFIG_SYSTEM_START_ADDR) { + printf("Error: auto-update does not allow to write a new bootloader\n"); + return 1; + } +#endif + /* remove protection on processed sectors */ if (update_flash_protect(0, addr_first, addr_last) > 0) { printf("Error: could not unprotect flash sectors\n");