From patchwork Sat Dec 17 17:03:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 132003 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 63DE81007DB for ; Sun, 18 Dec 2011 04:17:40 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 30DAE28367; Sat, 17 Dec 2011 18:17:28 +0100 (CET) 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 hLMo1uAs9WRo; Sat, 17 Dec 2011 18:17:27 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B6AB4282E1; Sat, 17 Dec 2011 18:17:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 904C2282D9 for ; Sat, 17 Dec 2011 18:04:13 +0100 (CET) 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 gM3IHfIK-m-2 for ; Sat, 17 Dec 2011 18:04:13 +0100 (CET) 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 mail-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by theia.denx.de (Postfix) with ESMTPS id 0B5B6282CE for ; Sat, 17 Dec 2011 18:04:12 +0100 (CET) Received: by mail-ee0-f44.google.com with SMTP id c14so2998501eek.3 for ; Sat, 17 Dec 2011 09:04:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=AKRbd8VzD0v/dqwghDC/9if5ntI2vzvDcpodUlmZAbA=; b=APHv+FJzh622BBBekPUJFx4WymxehJoGsYctP1+ppqBVhJNZmhkW+XsnZNkA7vqwxu 30Uzzn+uDNuhJREj6Tz5mpWcGbUoFKTbHCew8tofSwdsMhn0YgxhZE8IehbLUxBFupky 6CXQ8kDhjO2Evll8ozmDIKTpaBMIvhYVU2/Cg= Received: by 10.14.50.206 with SMTP id z54mr1492302eeb.46.1324141452888; Sat, 17 Dec 2011 09:04:12 -0800 (PST) Received: from Pali-EliteBook.kolej.mff.cuni.cz (pali.kolej.mff.cuni.cz. [78.128.193.202]) by mx.google.com with ESMTPS id a60sm17652568eeb.4.2011.12.17.09.04.11 (version=SSLv3 cipher=OTHER); Sat, 17 Dec 2011 09:04:12 -0800 (PST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: u-boot@lists.denx.de Date: Sat, 17 Dec 2011 18:03:04 +0100 Message-Id: <1324141398-14859-2-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1324141398-14859-1-git-send-email-pali.rohar@gmail.com> References: <2772527.Czs1Sl5aoH@pali-elitebook> <1324141398-14859-1-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 17 Dec 2011 18:17:05 +0100 Cc: Sebastian Reichel , Marcel Mol , Martin Jansa , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [U-Boot] [PATCH 02/16] arch/arm/lib/bootm.c: Optionally use existing atags X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch adapts the bootm command so that it can use an existing atags command set up by a previous bootloader. If the environment variable "atagaddr" is unset, bootm behaves as normal. If "atagaddr" is set, bootm will use atags address from environment variable and also append new boot args (if specified in u-boot). For example, if a previous boot loader already set up the atags struct at 0x80000100: setenv atagaddr 0x80000100; bootm 0x80008000 Signed-off-by: Pali Rohár --- README | 2 ++ arch/arm/lib/bootm.c | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/README b/README index ff72e47..3dd5a97 100644 --- a/README +++ b/README @@ -3564,6 +3564,8 @@ Some configuration options can be set using Environment Variables. List of environment variables (most likely not complete): + atagaddr - bootm will use ATAGs struct from specified address (arm only) + baudrate - see CONFIG_BAUDRATE bootdelay - see CONFIG_BOOTDELAY diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 802e833..4a3c423 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -125,12 +125,24 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) debug ("## Transferring control to Linux (at address %08lx) ...\n", (ulong) kernel_entry); + s = getenv ("atagaddr"); + if (s) { + bd->bi_boot_params = simple_strtoul(s, NULL, 16); + printf("Using existing atags at %#x\n", bd->bi_boot_params); + + params = (struct tag *) bd->bi_boot_params; + while (params->hdr.size > 0) + params = tag_next (params); + } else { #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ defined (CONFIG_CMDLINE_TAG) || \ defined (CONFIG_INITRD_TAG) || \ defined (CONFIG_SERIAL_TAG) || \ defined (CONFIG_REVISION_TAG) - setup_start_tag (bd); + setup_start_tag (bd); + } +#endif + #ifdef CONFIG_SERIAL_TAG setup_serial_tag (¶ms); #endif @@ -147,8 +159,19 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) if (images->rd_start && images->rd_end) setup_initrd_tag (bd, images->rd_start, images->rd_end); #endif - setup_end_tag(bd); + + if (s) { + if (params->hdr.size > 0) + setup_end_tag(bd); + } else { +#if defined (CONFIG_SETUP_MEMORY_TAGS) || \ + defined (CONFIG_CMDLINE_TAG) || \ + defined (CONFIG_INITRD_TAG) || \ + defined (CONFIG_SERIAL_TAG) || \ + defined (CONFIG_REVISION_TAG) + setup_end_tag(bd); #endif + } announce_and_cleanup();