public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] pxe: detect image format before calling bootm/bootz
Date: Thu, 31 Jul 2014 11:36:33 -0600	[thread overview]
Message-ID: <53DA7EA1.7010103@wwwdotorg.org> (raw)
In-Reply-To: <1406760856-30488-1-git-send-email-pengw@nvidia.com>

On 07/30/2014 04:54 PM, Bryan Wu wrote:
> 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.

> diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c

> @@ -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);

This breaks the ability to boot a uImage, since the call to 
genimg_get_format() is incorrect.

genimg_get_format() takes the address of an image itself, not the 
address of a string containing a textual representation of the address.

Also, bootm_argv[1] might not be supplied at all, in which case, 
boot_get_kernel() falls back to using load_addr as the address.

This is further complicated by the fact that for FIT images, the string 
in bootm_argv[1] won't just be the address of the image, but perhaps 
have concatenated information indicating which sub-image to select 
(since FIT images pack multiple files into a single image).

You probably need to pull the start of boot_get_kernel() (in 
common/bootm.c) into a utility function and call that to distinguish 
between zImage/not, so as not to duplicate any of the logic.

(Yes, I failed to notice this when I reviewed this downstream, but I 
just actually tested this patch, using a uImage for pxe booting...)

For the zImage case, this patch certainly does remove the annoying error 
message generated when do_bootm() can't identify the image type. So, I 
think it's worth continuing to work on a solution.

P.S. you didn't CC anyone who might apply this patch.

  reply	other threads:[~2014-07-31 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30 22:54 [U-Boot] [PATCH] pxe: detect image format before calling bootm/bootz Bryan Wu
2014-07-31 17:36 ` Stephen Warren [this message]
2014-07-31 21:26   ` Bryan Wu

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=53DA7EA1.7010103@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --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