From: Stephen Warren <swarren@nvidia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] image: Don't detect XIP images as overlapping.
Date: Wed, 9 Nov 2011 10:47:20 -0700 [thread overview]
Message-ID: <1320860840-6347-2-git-send-email-swarren@nvidia.com> (raw)
In-Reply-To: <1320860840-6347-1-git-send-email-swarren@nvidia.com>
bootm_load_os() detects when it writes the decompressed image over
the top of the compressed image. If this happens, the original image
is corrupted. When the original image is a multi-component legacy image,
or a (potentially multi-component) FIT image, this implies that other
components may be corrupted. In turn, this means that booting is unlikely
to be successful.
However, in the case of no image compresssion coupled with an image with
load address equal to where the image is already located (e.g. an XIP
kernel, or IH_TYPE_KERNEL_ANYLOAD), there has been no copy and hence no
corruption, no matter whether it's a single-component legacy image, a
multi-component legacy image, or a FIT image. In this case, disable the
overlap detection, and allow boot to continue.
Without this change, when booting a single-component legacy image that
contains an IH_TYPE_KERNEL_ANYLOAD, bootm_load_os() would have returned
BOOTM_ERR_OVERLAP, but the caller ignores this, and boot continues and
succeeds. Now, the false error is no longer even returned.
Without this change, when booting a FIT image that contains an
IH_TYPE_KERNEL_ANYLOAD, bootm_load_os() would have returned
BOOTM_ERR_OVERLAP, which would then cause the caller to reset the board.
Now, the false error is no longer returned, and boot succeeds.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
common/cmd_bootm.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 2e9df58..8f3c97f 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -319,6 +319,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
ulong image_start = os.image_start;
ulong image_len = os.image_len;
uint unc_len = CONFIG_SYS_BOOTM_LEN;
+ int no_overlap = 0;
#if defined(CONFIG_LZMA) || defined(CONFIG_LZO)
int ret;
#endif /* defined(CONFIG_LZMA) || defined(CONFIG_LZO) */
@@ -329,6 +330,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
case IH_COMP_NONE:
if (load == blob_start || load == image_start) {
printf(" XIP %s ... ", type_name);
+ no_overlap = 1;
} else {
printf(" Loading %s ... ", type_name);
memmove_wd((void *)load, (void *)image_start,
@@ -423,7 +425,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
if (boot_progress)
show_boot_progress(7);
- if ((load < blob_end) && (*load_end > blob_start)) {
+ if (!no_overlap && (load < blob_end) && (*load_end > blob_start)) {
debug("images.os.start = 0x%lX, images.os.end = 0x%lx\n",
blob_start, blob_end);
debug("images.os.load = 0x%lx, load_end = 0x%lx\n", load,
--
1.7.0.4
next prev parent reply other threads:[~2011-11-09 17:47 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-09 17:47 [U-Boot] [PATCH 1/2] image: Implement IH_TYPE_KERNEL_ANYLOAD Stephen Warren
2011-11-09 17:47 ` Stephen Warren [this message]
2011-11-10 9:58 ` Marek Vasut
2011-11-10 16:04 ` Stephen Warren
2011-11-10 17:01 ` Marek Vasut
2011-11-10 17:43 ` Stephen Warren
2011-11-10 17:47 ` Marek Vasut
2011-11-10 18:02 ` Stephen Warren
2011-11-10 18:07 ` Marek Vasut
2011-11-10 18:25 ` Stephen Warren
2011-11-10 18:40 ` Marek Vasut
2011-11-10 19:06 ` Wolfgang Denk
2011-11-10 20:51 ` Marek Vasut
2011-11-10 19:10 ` Stephen Warren
2011-11-10 20:54 ` Marek Vasut
2011-11-10 18:58 ` Wolfgang Denk
2011-11-10 11:59 ` Wolfgang Denk
2011-11-10 16:15 ` Stephen Warren
2011-11-10 18:53 ` Wolfgang Denk
2011-11-10 19:05 ` Stephen Warren
2011-11-10 19:27 ` Wolfgang Denk
-- strict thread matches above, loose matches on Subject: below --
2011-11-10 20:17 [U-Boot] [PATCH 1/2] image: Implement IH_TYPE_KERNEL_NOLOAD Stephen Warren
2011-11-10 20:17 ` [U-Boot] [PATCH 2/2] image: Don't detect XIP images as overlapping Stephen Warren
2011-12-01 8:57 ` Stefan Roese
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=1320860840-6347-2-git-send-email-swarren@nvidia.com \
--to=swarren@nvidia.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