public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bryan Wu <cooloney@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] pxe: detect image format before calling bootm/bootz
Date: Thu, 31 Jul 2014 17:39:59 -0700	[thread overview]
Message-ID: <1406853600-30615-3-git-send-email-pengw@nvidia.com> (raw)
In-Reply-To: <1406853600-30615-1-git-send-email-pengw@nvidia.com>

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 <pengw@nvidia.com>
---
 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;
 }
-- 
1.9.1

  parent reply	other threads:[~2014-08-01  0:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  0:39 [U-Boot] [PATCH 0/3] introduce genimg_get_kernel_addr() Bryan Wu
2014-08-01  0:39 ` [U-Boot] [PATCH 1/3] image: " Bryan Wu
2014-08-04 10:15   ` Simon Glass
2014-08-10 22:21   ` [U-Boot] [U-Boot, " Tom Rini
2014-08-12 17:27     ` Bryan Wu
2014-08-01  0:39 ` Bryan Wu [this message]
2014-08-10 22:21   ` [U-Boot] [U-Boot, 2/3] pxe: detect image format before calling bootm/bootz Tom Rini
2014-08-01  0:40 ` [U-Boot] [PATCH 3/3] bootm: use genimg_get_kernel_addr() Bryan Wu
2014-08-01 19:18   ` Stephen Warren
2014-08-05  0:46     ` Bryan Wu
2014-08-04 10:22   ` Simon Glass
2014-08-10 22:21   ` [U-Boot] [U-Boot,3/3] " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406853600-30615-3-git-send-email-pengw@nvidia.com \
    --to=cooloney@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox