From patchwork Thu Sep 1 11:34:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 112876 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 1C50FB6F7B for ; Thu, 1 Sep 2011 21:35:27 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B8C0128112; Thu, 1 Sep 2011 13:35:24 +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 OT+9lX5nqsDx; Thu, 1 Sep 2011 13:35:24 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 83E2A28105; Thu, 1 Sep 2011 13:35:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 26BB828105 for ; Thu, 1 Sep 2011 13:35:22 +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 wBlkyrZv4Iur for ; Thu, 1 Sep 2011 13:35:21 +0200 (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 mail-bw0-f44.google.com (mail-bw0-f44.google.com [209.85.214.44]) by theia.denx.de (Postfix) with ESMTPS id 985E5280FF for ; Thu, 1 Sep 2011 13:35:19 +0200 (CEST) Received: by bkar4 with SMTP id r4so1508588bka.3 for ; Thu, 01 Sep 2011 04:35:19 -0700 (PDT) Received: by 10.204.130.77 with SMTP id r13mr930532bks.12.1314876919586; Thu, 01 Sep 2011 04:35:19 -0700 (PDT) Received: from Pali-EliteBook.kolej.mff.cuni.cz (rohar.kolej.mff.cuni.cz [78.128.193.202]) by mx.google.com with ESMTPS id a17sm159596bku.56.2011.09.01.04.35.17 (version=SSLv3 cipher=OTHER); Thu, 01 Sep 2011 04:35:17 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: u-boot@lists.denx.de Date: Thu, 1 Sep 2011 13:34:27 +0200 Message-Id: <1314876881-9669-1-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <201109011304.46581.marek.vasut@gmail.com> References: <201109011304.46581.marek.vasut@gmail.com> Subject: [U-Boot] [PATCH 01/15] Make bootm optionally use pre-existing atags for Linux kernel boot. 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 From: Alistair Buxton 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 "atags" is unset, bootm behaves as normal. If "atags" is set, bootm will skip all boot args setup entirely, and pass the address found in "atags". For example, if a previous boot loader already set up the atags struct at 0x80000100: setenv atags 0x80000100; bootm 0x80008000 Signed-off-by: Alistair Buxton --- arch/arm/lib/bootm.c | 37 ++++++++++++++++++++++++++++--------- 1 files changed, 28 insertions(+), 9 deletions(-) diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 802e833..262efda 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -100,6 +100,13 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) int machid = bd->bi_arch_number; void (*kernel_entry)(int zero, int arch, uint params); +#ifdef CONFIG_CHAINLOADER + uint params; + #define PARAMS params +#else + #define PARAMS (bd->bi_boot_params) +#endif + #ifdef CONFIG_CMDLINE_TAG char *commandline = getenv ("bootargs"); #endif @@ -125,34 +132,46 @@ 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); +#ifdef CONFIG_CHAINLOADER + s = getenv ("atags"); + if (s) { + params = simple_strtoul (s, NULL, 16); + printf ("Using existing atags at 0x%x\n", params); + } else { +#endif + #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); #ifdef CONFIG_SERIAL_TAG - setup_serial_tag (¶ms); + setup_serial_tag (¶ms); #endif #ifdef CONFIG_REVISION_TAG - setup_revision_tag (¶ms); + setup_revision_tag (¶ms); #endif #ifdef CONFIG_SETUP_MEMORY_TAGS - setup_memory_tags (bd); + setup_memory_tags (bd); #endif #ifdef CONFIG_CMDLINE_TAG - setup_commandline_tag (bd, commandline); + setup_commandline_tag (bd, commandline); #endif #ifdef CONFIG_INITRD_TAG - if (images->rd_start && images->rd_end) - setup_initrd_tag (bd, images->rd_start, images->rd_end); + if (images->rd_start && images->rd_end) + setup_initrd_tag (bd, images->rd_start, images->rd_end); +#endif + setup_end_tag(bd); #endif - setup_end_tag(bd); + +#ifdef CONFIG_CHAINLOADER + } #endif announce_and_cleanup(); - kernel_entry(0, machid, bd->bi_boot_params); + kernel_entry(0, machid, PARAMS); /* does not return */ return 1;