From patchwork Tue Jul 9 19:34:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 257861 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 6AA6F2C00A2 for ; Wed, 10 Jul 2013 05:35:38 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 10DEA4A097; Tue, 9 Jul 2013 21:35:34 +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 hvm4AmvBNbcB; Tue, 9 Jul 2013 21:35:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 789744A08A; Tue, 9 Jul 2013 21:35:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 36D8F4A046 for ; Tue, 9 Jul 2013 21: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 2R3x35ZrT0Ae for ; Tue, 9 Jul 2013 21:35:16 +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-gg0-f178.google.com (mail-gg0-f178.google.com [209.85.161.178]) by theia.denx.de (Postfix) with ESMTPS id 0B1764A030 for ; Tue, 9 Jul 2013 21:35:08 +0200 (CEST) Received: by mail-gg0-f178.google.com with SMTP id l12so2090864gge.9 for ; Tue, 09 Jul 2013 12:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=osO7tqq79ONJeEaq9RATyLJnKdjIWyWQBqR6pAVn/qA=; b=RGA3ZzCrJFrvRHM8K/df052l8KG2s8wcbt76zQe197gNs8J+tU0bijApAl1M5RMANV v3HlUzuIiJOp8sY7Gs5i4emq5x38AT6089XWJ/f+anqCXCxrru2GHiyDI1ZIR/EKGFFu EoAzCkFMLvj8jQ3d5FsaFcdzsFdxWryXdnxHmIgdcwLSmOHug8QdCHDtxbTs43cmtdWi fwjG9ivYVliZi4JddWNDiiY5WPGsflIX7zUaPdQ4GVL5oN8mj2PWy2FeKk4EFMULGxtc y5/t1LhLJ/kg0I2MRmI/PxT4iVnYQxkmxwqzxfa+l5GBytJEWqbjMpuSsUDi174NpELs Vasg== X-Received: by 10.236.189.73 with SMTP id b49mr15913695yhn.31.1373398507251; Tue, 09 Jul 2013 12:35:07 -0700 (PDT) Received: from localhost.localdomain (cpe-065-184-250-089.ec.res.rr.com. [65.184.250.89]) by mx.google.com with ESMTPSA id 66sm46822258yhe.20.2013.07.09.12.35.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Jul 2013 12:35:06 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Date: Tue, 9 Jul 2013 15:34:57 -0400 Message-Id: <1373398497-4658-2-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1373398497-4658-1-git-send-email-trini@ti.com> References: <1373398497-4658-1-git-send-email-trini@ti.com> Subject: [U-Boot] [PATCH 2/2] cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself 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 As a zImage does not have a U-Boot header, we cannot really do what BOOTM_STATE_FINDOTHER does, exactly. Break the ramdisk/fdt portions of bootm_find_other into bootm_find_ramdisk/fdt which can be called in both cases. Signed-off-by: Tom Rini --- common/cmd_bootm.c | 56 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 3a899bc..1498380 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -309,33 +309,53 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc, return 0; } -static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +static int bootm_find_ramdisk(int flag, int argc, char * const argv[]) +{ + int ret; + + /* find ramdisk */ + ret = boot_get_ramdisk(argc, argv, &images, IH_INITRD_ARCH, + &images.rd_start, &images.rd_end); + if (ret) { + puts("Ramdisk image is corrupt or invalid\n"); + return 1; + } + + return 0; +} + +#if defined(CONFIG_OF_LIBFDT) +static int bootm_find_fdt(int flag, int argc, char * const argv[]) { int ret; + /* find flattened device tree */ + ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images, + &images.ft_addr, &images.ft_len); + if (ret) { + puts("Could not find a valid device tree\n"); + return 1; + } + + set_working_fdt_addr(images.ft_addr); + + return 0; +} +#endif + +static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ if (((images.os.type == IH_TYPE_KERNEL) || (images.os.type == IH_TYPE_KERNEL_NOLOAD) || (images.os.type == IH_TYPE_MULTI)) && (images.os.os == IH_OS_LINUX)) { - /* find ramdisk */ - ret = boot_get_ramdisk(argc, argv, &images, IH_INITRD_ARCH, - &images.rd_start, &images.rd_end); - if (ret) { - puts("Ramdisk image is corrupt or invalid\n"); + if (bootm_find_ramdisk(flag, argc, argv)) return 1; - } #if defined(CONFIG_OF_LIBFDT) - /* find flattened device tree */ - ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images, - &images.ft_addr, &images.ft_len); - if (ret) { - puts("Could not find a valid device tree\n"); + if (bootm_find_fdt(flag, argc, argv)) return 1; - } - - set_working_fdt_addr(images.ft_addr); #endif } @@ -1779,6 +1799,10 @@ static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc, lmb_reserve(&images->lmb, images->ep, zi_end - zi_start); + /* + * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not + * have a header that provide this informaiton. + */ if (bootm_find_ramdisk(flag, argc, argv)) return 1;