From patchwork Thu Sep 26 20:28:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 278268 X-Patchwork-Delegate: trini@ti.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 A7A1B2C0331 for ; Fri, 27 Sep 2013 06:31:50 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7F0274A0E6; Thu, 26 Sep 2013 22:30:38 +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 UwHFXfumR-5n; Thu, 26 Sep 2013 22:30:38 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 675504A0B3; Thu, 26 Sep 2013 22:29:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0ECDC4A0D5 for ; Thu, 26 Sep 2013 22:28:55 +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 NIEXU3i6iAPR for ; Thu, 26 Sep 2013 22:28:49 +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-qc0-f180.google.com (mail-qc0-f180.google.com [209.85.216.180]) by theia.denx.de (Postfix) with ESMTPS id 8B77C4A088 for ; Thu, 26 Sep 2013 22:28:23 +0200 (CEST) Received: by mail-qc0-f180.google.com with SMTP id p19so1118550qcv.25 for ; Thu, 26 Sep 2013 13:28:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=BlKkmVe5Nyywh0wpyHszKCeOEgZIUcgsthnwRoYJQ2Q=; b=q5IYUqsDsaJS4HmqVgy3epV92Nd5qeR8GP/yhW3ICQdH9yh11IwvrwYBwnQcQVDhlj s9F0NL9XHBCIlJNhSCHEVJbTIZYTRXa8t4hU9Dt3tqq1WT4ScJ8X+wOJ6ozHwb6YIhIo tMOThsd+YTXeoOdpraucV+3UEI3NXjug1gLYkJ/KFHt1ZKQDHOTXPuW/epQNGdwuVGxZ rd0cWvAH9Tgwg6Ch8Yim3/ZsBPtNJTqUB/jhJ5em1b2jPgc+6XuE6beeqjgGyywDh6Bi SNy37vMz05fXZ86D7HYMr18+0BnAkshpc8Kcbe52dE2r5xUT/MlldHegwLs8hK5BK7/b jviA== X-Received: by 10.224.151.140 with SMTP id c12mr9137845qaw.94.1380227302166; Thu, 26 Sep 2013 13:28:22 -0700 (PDT) Received: from localhost.localdomain (cpe-174-106-216-211.ec.res.rr.com. [174.106.216.211]) by mx.google.com with ESMTPSA id u4sm11180058qat.5.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 13:28:21 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Thu, 26 Sep 2013 16:28:07 -0400 Message-Id: <1380227287-26057-12-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1380227287-26057-1-git-send-email-trini@ti.com> References: <1380227287-26057-1-git-send-email-trini@ti.com> Subject: [U-Boot] [PATCH 11/11] spl_mmc/CONFIG_SPL_OS_BOOT: Allow environment to determine what to boot 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 We add two new environment variables, falcon_args_file and falcon_image_file, which when set will override the compiled in default values for falcon mode. Signed-off-by: Tom Rini --- common/spl/spl_mmc.c | 28 +++++++++++++++++++++++++++- doc/README.falcon | 4 ++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index fc2f226..5405bbc 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -100,7 +100,33 @@ end: static int mmc_load_image_fat_os(struct mmc *mmc) { int err; - +#if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT) + char *file; + + file = getenv("falcon_args_file"); + if (file) { + err = file_fat_read(file, (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0); + if (err <= 0) { + printf("spl: error reading image %s, err - %d, falling back to default\n", + file, err); + goto defaults; + } + file = getenv("falcon_image_file"); + if (file) { + err = mmc_load_image_fat(mmc, file); + if (err != 0) { + puts("spl: falling back to default\n"); + goto defaults; + } + + return 0; + } else + puts("spl: falcon_image_file not set in environment, falling back to default\n"); + } else + puts("spl: falcon_args_file not set in environment, falling back to default\n"); + +defaults: +#endif err = file_fat_read(CONFIG_SPL_FAT_LOAD_ARGS_NAME, (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0); if (err <= 0) { diff --git a/doc/README.falcon b/doc/README.falcon index bccf6c9..82a254b 100644 --- a/doc/README.falcon +++ b/doc/README.falcon @@ -89,6 +89,10 @@ mode. In this case the following variables may be supported: boot_os : Set to yes/Yes/true/True/1 to enable booting to OS, any other value to fall back to U-Boot (including unset) +falcon_args_file : Filename to load as the 'args' portion of falcon mode + rather than the hard-coded value. +falcon_image_file : Filename to load as the OS image portion of falcon + mode rather than the hard-coded value. Using spl command -----------------