From patchwork Wed Jul 30 22:54:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Wu X-Patchwork-Id: 375064 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 B821A1400B9 for ; Thu, 31 Jul 2014 09:01:48 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CE9E24B6FF; Thu, 31 Jul 2014 01:01:46 +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 TWL++6m2-h1j; Thu, 31 Jul 2014 01:01:46 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 90EC04B70B; Thu, 31 Jul 2014 01:01:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DAD1D4B70B for ; Thu, 31 Jul 2014 01:01:40 +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 IBwZDFc4ky3U for ; Thu, 31 Jul 2014 01:01:38 +0200 (CEST) X-Greylist: delayed 422 seconds by postgrey-1.27 at theia; Thu, 31 Jul 2014 01:01:34 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-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by theia.denx.de (Postfix) with ESMTPS id A58E84B6FF for ; Thu, 31 Jul 2014 01:01:33 +0200 (CEST) Received: by mail-pa0-f50.google.com with SMTP id et14so2373281pad.37 for ; Wed, 30 Jul 2014 16:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=Ff4JyuMdxFKGi7tfU4nYewyZn6YXDiFJ58yOo+BRar0=; b=FBikxRgBOvT6t6rQk8MdZ5rqABYIAgNMoCKelFrNl5ZjBlSUQ6sIlmHpT1oBtZqiQK /98YYNTtjPlqukobBXiLuERiwUpElewrJGedZGXWaIw6My0fUTWYSDbM77y5yXWg+4KG VskZ3DGPFVYZRrZhkXefoec+oK4v3HlFQtuegTc4AcJtZD+xY0yUQboL6UU08NhTf+Yl Y6F+s4aG9ysVPdNKZ/5XHxFmwfCcC5RjQJZV+Td61igmCIznHlp3LFWh+hJJ/pvPRS4H pYJESZTj9reUtCthr9WTc2hPNcClZ4JXVtF+Ihc8gv+clKmcC1A85ZZ/L8HVbnayzNe5 +AnA== X-Received: by 10.68.177.130 with SMTP id cq2mr95903pbc.119.1406760869353; Wed, 30 Jul 2014 15:54:29 -0700 (PDT) Received: from localhost (thunderhill.nvidia.com. [216.228.112.22]) by mx.google.com with ESMTPSA id uw4sm12232572pab.40.2014.07.30.15.54.27 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Jul 2014 15:54:28 -0700 (PDT) From: Bryan Wu X-Google-Original-From: Bryan Wu To: u-boot@lists.denx.de, swarren@nvidia.com Date: Wed, 30 Jul 2014 15:54:16 -0700 Message-Id: <1406760856-30488-1-git-send-email-pengw@nvidia.com> X-Mailer: git-send-email 1.9.1 Subject: [U-Boot] [PATCH] 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. Signed-off-by: Bryan Wu --- common/cmd_pxe.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index ba48692..a9cf576 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+ */ @@ -771,11 +772,14 @@ 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); + /* Try bootm for legacy and FIT format image */ + if (genimg_get_format(bootm_argv[1]) != 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; }