From patchwork Fri Oct 26 02:31:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 194335 X-Patchwork-Delegate: vanbaren@cideas.com 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 41A452C032A for ; Fri, 26 Oct 2012 13:32:53 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 981D14A437; Fri, 26 Oct 2012 04:31:59 +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 hhlkRxhCEWqK; Fri, 26 Oct 2012 04:31:59 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C98DA4A445; Fri, 26 Oct 2012 04:31:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C93EB4A49D for ; Fri, 26 Oct 2012 04:31:32 +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 mVkmpv6s0Fy8 for ; Fri, 26 Oct 2012 04:31:31 +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-vb0-f74.google.com (mail-vb0-f74.google.com [209.85.212.74]) by theia.denx.de (Postfix) with ESMTPS id 291484A444 for ; Fri, 26 Oct 2012 04:31:23 +0200 (CEST) Received: by mail-vb0-f74.google.com with SMTP id s24so300322vbi.3 for ; Thu, 25 Oct 2012 19:31:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=qr/b3B8lGM/1FFuBE7KA8pWhEXFVOMDNXLWVbiGPn3k=; b=HdxYal3zySpsrsffMC8294AVDzFIs8U1P77br4r9StSuZYCQHdMd7neyhnlQkqnVQ+ UmUmTZX2EFzQQ1oxRvd2h++YLVHGGzSvbxRPUXkhnYbihJ/MRZpuz0RkJpLpFvZ949zw gEw1ysuWE8X0AFur3p7xcSTApguCV+5/PjqGrqAnl0P56eAVPt0fhm6wrSqgFjpXzdlA k5VCwuvwfSN++av+MzwkdnGDlcPh3H2cpMcof2ajQs1bDKZRKfOi8As0Noq0WKXsNOZN DbkhNGJb1I7lLklSgIbtZRvSi0nJl3C/W8Yo5oZC+C2sH6VHfManfc9p2jFGplQdZaMA SJwA== Received: by 10.236.78.199 with SMTP id g47mr14076866yhe.0.1351218683283; Thu, 25 Oct 2012 19:31:23 -0700 (PDT) Received: from wpzn3.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id i27si18378yhb.0.2012.10.25.19.31.23 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 25 Oct 2012 19:31:23 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by wpzn3.hot.corp.google.com (Postfix) with ESMTP id B47A7100047; Thu, 25 Oct 2012 19:31:22 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 93E2D16167D; Thu, 25 Oct 2012 19:31:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Thu, 25 Oct 2012 19:31:11 -0700 Message-Id: <1351218671-15228-15-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1351218671-15228-1-git-send-email-sjg@chromium.org> References: <1351218671-15228-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQn1fCBUb6CjmdKiHYmMj9coPygW5Q7q4HF9NvYwpFmyA5yjGVXDbUW2RELNBAfMPhbD/x5yhs3GeQkatbFvAOhXXvYROFojPpLolgaoXIx8R9ElMtlUVjhRDRCy8J5ftQ7UP57x2nkBFo3dSEUFSsM5LML3hbk1EGNbw8OBKaRdfBN4daniAJrAWq84zPN0DGvTosL3 Cc: Tom Rini , Jerry Van Baren , Devicetree Discuss Subject: [U-Boot] [PATCH 14/14] fdt: Set kernaddr if fdt indicates a kernel is present 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de If kernel-offset is specified in the fdt, set an environment variable so that scripts can access the attached kernel. This can be used by a packaging program to tell U-Boot about a kernel that has been downloaded alongside U-Boot. The value in the fdt is the offset of the kernel from the start of the U-Boot image, so we can find it just by adding CONFIG_SYS_TEXT_BASE. It is then fairly easy to put something like this in the environment variables in the board header file: "if test ${kernaddr} != \"\"; then "\ "echo \"Using bundled kernel\"; "\ "bootm ${kernaddr};" \ "fi; "\ /* rest of boot sequence follows here */ Signed-off-by: Simon Glass --- common/main.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/common/main.c b/common/main.c index 03c63b4..3137b75 100644 --- a/common/main.c +++ b/common/main.c @@ -333,6 +333,20 @@ err: hang(); } +static void process_fdt_options(const void *blob) +{ + ulong addr; + + /* Add an env variable to point to a kernel payload, if available */ + addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0); + if (addr) + setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr)); + + /* Add an env variable to point to a root disk, if available */ + addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0); + if (addr) + setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr)); +} #endif /* CONFIG_OF_CONTROL */ @@ -451,6 +465,8 @@ void main_loop (void) if (env) s = env; + process_fdt_options(gd->fdt_blob); + /* * If the bootsecure option was chosen, use secure_boot_cmd(). * Always use 'env' in this case, since bootsecure requres that the