From patchwork Sun Dec 18 21:33:58 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: 132123 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 57192B7034 for ; Mon, 19 Dec 2011 09:08:01 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B999E2836C; Sun, 18 Dec 2011 23:07:50 +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 du2Clq45tUf6; Sun, 18 Dec 2011 23:07:50 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2918A282E8; Sun, 18 Dec 2011 23:07:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DC09E281D5 for ; Sun, 18 Dec 2011 22:34:43 +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 AO9uGYAQdCRG for ; Sun, 18 Dec 2011 22:34:43 +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 8772B28230 for ; Sun, 18 Dec 2011 22:34:42 +0100 (CET) Received: by mail-ee0-f44.google.com with SMTP id c14so3969612eek.3 for ; Sun, 18 Dec 2011 13:34:42 -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=neCUuR0tnU5mG7hMnQKMniBelza9lCF/06kSkDXCgDc=; b=nX36TI8WcfCorc8gUJYZ6trJM/ZrGKJOGSFx26IFha4ac3kH2zinfPdHmL/7lpuq/Z 2sfySmewj+EGOUHGGjr9tOlfABgxaeD9Uy3ErjGQTYwwmNYhCMBxcozJZkbWTw1Kj9zO eBBYHwOUlL3lrRM0G/z/+nqqPckGVEYzhwDVE= Received: by 10.14.99.132 with SMTP id x4mr3134212eef.74.1324244081857; Sun, 18 Dec 2011 13:34:41 -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 t1sm35684688eeb.3.2011.12.18.13.34.40 (version=SSLv3 cipher=OTHER); Sun, 18 Dec 2011 13:34:40 -0800 (PST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: u-boot@lists.denx.de Date: Sun, 18 Dec 2011 22:33:58 +0100 Message-Id: <1324244051-25756-2-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1324244051-25756-1-git-send-email-pali.rohar@gmail.com> References: <1778406.ezGto4lKnu@pali-elitebook> <1324244051-25756-1-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 18 Dec 2011 23:07:27 +0100 Cc: Sebastian Reichel , Marcel Mol , Martin Jansa Subject: [U-Boot] [PATCH 02/15] 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 | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 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..1d76774 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -93,6 +93,14 @@ static void announce_and_cleanup(void) cleanup_before_linux(); } +#if defined(CONFIG_SETUP_MEMORY_TAGS) || \ +defined(CONFIG_CMDLINE_TAG) || \ +defined(CONFIG_INITRD_TAG) || \ +defined(CONFIG_SERIAL_TAG) || \ +defined(CONFIG_REVISION_TAG) +#define CONFIG_SETUP_ANY_TAG +#endif + int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) { bd_t *bd = gd->bd; @@ -125,12 +133,20 @@ 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); -#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); + 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 { +#ifdef CONFIG_SETUP_ANY_TAG + setup_start_tag(bd); +#endif + } + #ifdef CONFIG_SERIAL_TAG setup_serial_tag (¶ms); #endif @@ -147,8 +163,15 @@ 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 { +#ifdef CONFIG_SETUP_ANY_TAG + setup_end_tag(bd); #endif + } announce_and_cleanup();