diff options
author | Bryan Wu <cooloney@gmail.com> | 2014-07-31 17:39:59 -0700 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-08-09 11:19:01 -0400 |
commit | 1fb7d0e61996971757876228ceed74c3a401ffea (patch) | |
tree | 1d20489bafa398692ae6fe20fe5acb88340a52fb | |
parent | 0f64140b69ecf18f488164739374ca13aa0a5517 (diff) | |
download | u-boot-imx-1fb7d0e61996971757876228ceed74c3a401ffea.zip u-boot-imx-1fb7d0e61996971757876228ceed74c3a401ffea.tar.gz u-boot-imx-1fb7d0e61996971757876228ceed74c3a401ffea.tar.bz2 |
pxe: detect image format before calling bootm/bootz
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>
-rw-r--r-- | common/cmd_pxe.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index 28999f5..c816339 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; } |