From patchwork Tue Aug 5 00:43:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Wu X-Patchwork-Id: 376489 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 1AB2614003E for ; Tue, 5 Aug 2014 10:44:38 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EEE0EAB591; Tue, 5 Aug 2014 02:44:23 +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 Y58C2tc5oPgM; Tue, 5 Aug 2014 02:44:23 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 925E5B3791; Tue, 5 Aug 2014 02:44:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 07E2EA74EC for ; Tue, 5 Aug 2014 02:44:00 +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 TkxhnwZIVj3H for ; Tue, 5 Aug 2014 02:43:55 +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-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by theia.denx.de (Postfix) with ESMTPS id 4E4C9A74E8 for ; Tue, 5 Aug 2014 02:43:52 +0200 (CEST) Received: by mail-pd0-f182.google.com with SMTP id fp1so272441pdb.27 for ; Mon, 04 Aug 2014 17:43:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=+V7CMVJwPvO5bGjgLqedv34rsfq5OoD0bIc8haci/C4=; b=E+mqVGByQpnnwjc1KMu5CMH+saBB5ZYprT/N30nQeBJhqpAOwQjvyWB1YCnWjrbCdq Sj/XP6UPGtbp9Dv9+ayaR6fbyr4Tmh7hWHyghBj7hPAtCHWAPLRJMc922gGSTerBmZbA IoGrsnzb222PqkBllVHtST0/x+OL43IKZ+ULoUEwm44k3COnNd+WnJztmyItfUssaxPp vDZeRekDJwOeyy/MGr9TduzpqX4Lr6376XNOI5CBjNKfj45oNjGz30UZhJAamZR3ZbnU UZbjM+ob/ahB4EbQCr2JAW2zfbyQ8dPtMxD7fiFikWuj3J9d3Bd/J23yliwJBIzkU9fT Suyg== X-Received: by 10.68.204.4 with SMTP id ku4mr261659pbc.39.1407199430294; Mon, 04 Aug 2014 17:43:50 -0700 (PDT) Received: from localhost (thunderhill.nvidia.com. [216.228.112.22]) by mx.google.com with ESMTPSA id wd7sm273226pab.47.2014.08.04.17.43.48 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 04 Aug 2014 17:43:49 -0700 (PDT) From: Bryan Wu X-Google-Original-From: Bryan Wu To: sjg@chromium.org, trini@ti.com, swarren@wwwdotorg.org, u-boot@lists.denx.de Date: Mon, 4 Aug 2014 17:43:27 -0700 Message-Id: <1407199408-4348-3-git-send-email-pengw@nvidia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407199408-4348-1-git-send-email-pengw@nvidia.com> References: <1407199408-4348-1-git-send-email-pengw@nvidia.com> Subject: [U-Boot] [PATCH v2 2/3] pxe: detect image format before calling bootm/bootz 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 Trying bootm for zImage will print out several error message which is not necessary for this case. So detect image format firstly, only try bootm for legacy and FIT format image then try bootz for others. This patch needs new function genimg_get_kernel_addr(). Signed-off-by: Bryan Wu Tested-by: Stephen Warren Reviewed-by: Stephen Warren --- common/cmd_pxe.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index ba48692..59b3598 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -1,5 +1,6 @@ /* * Copyright 2010-2011 Calxeda, Inc. + * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -609,6 +610,8 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label) char *bootargs; int bootm_argc = 3; int len = 0; + ulong kernel_addr; + void *buf; label_print(label); @@ -771,11 +774,15 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label) if (bootm_argv[3]) bootm_argc = 4; - do_bootm(cmdtp, 0, bootm_argc, bootm_argv); - + kernel_addr = genimg_get_kernel_addr(bootm_argv[1]); + buf = map_sysmem(kernel_addr, 0); + /* Try bootm for legacy and FIT format image */ + if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID) + do_bootm(cmdtp, 0, bootm_argc, bootm_argv); #ifdef CONFIG_CMD_BOOTZ - /* Try booting a zImage if do_bootm returns */ - do_bootz(cmdtp, 0, bootm_argc, bootm_argv); + /* Try booting a zImage */ + else + do_bootz(cmdtp, 0, bootm_argc, bootm_argv); #endif return 1; }