From: Max Filippov <jcmvbkbc@gmail.com>
To: qemu-devel@nongnu.org
Cc: Max Filippov <jcmvbkbc@gmail.com>,
Waldemar Brodkorb <mail@waldemar-brodkorb.de>,
qemu-stable@nongnu.org
Subject: [Qemu-devel] [PATCH 2/3] hw/core/loader: implement load_uimage_at
Date: Tue, 12 Aug 2014 08:22:21 +0400 [thread overview]
Message-ID: <1407817342-1373-3-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1407817342-1373-1-git-send-email-jcmvbkbc@gmail.com>
load_uimage_at loads kernel image at the specified address instead of
the address recorded in the uImage header.
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
hw/core/loader.c | 25 +++++++++++++++++++------
include/hw/loader.h | 2 ++
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 5bf7f9b..beb7c2b 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -470,7 +470,7 @@ static int load_uboot_image_header_fd(int fd, uboot_image_header_t *hdr)
/* Load a U-Boot image. */
static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr,
- int *is_linux, uint8_t image_type)
+ bool force_addr, int *is_linux, uint8_t image_type)
{
int fd;
hwaddr address;
@@ -497,9 +497,13 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr,
/* TODO: Implement other image types. */
switch (hdr->ih_type) {
case IH_TYPE_KERNEL:
- address = hdr->ih_load;
- if (loadaddr) {
- *loadaddr = hdr->ih_load;
+ if (force_addr) {
+ address = *loadaddr;
+ } else {
+ address = hdr->ih_load;
+ if (loadaddr) {
+ *loadaddr = hdr->ih_load;
+ }
}
switch (hdr->ih_comp) {
@@ -589,13 +593,22 @@ int load_uboot_image_header(const char *filename, uboot_image_header_t *hdr)
int load_uimage(const char *filename, hwaddr *ep, hwaddr *loadaddr,
int *is_linux)
{
- return load_uboot_image(filename, ep, loadaddr, is_linux, IH_TYPE_KERNEL);
+ return load_uboot_image(filename, ep, loadaddr, false, is_linux,
+ IH_TYPE_KERNEL);
+}
+
+int load_uimage_at(const char *filename, hwaddr *ep, hwaddr loadaddr,
+ int *is_linux)
+{
+ return load_uboot_image(filename, ep, &loadaddr, true, is_linux,
+ IH_TYPE_KERNEL);
}
/* Load a ramdisk. */
int load_ramdisk(const char *filename, hwaddr addr, uint64_t max_sz)
{
- return load_uboot_image(filename, NULL, &addr, NULL, IH_TYPE_RAMDISK);
+ return load_uboot_image(filename, NULL, &addr, false, NULL,
+ IH_TYPE_RAMDISK);
}
/*
diff --git a/include/hw/loader.h b/include/hw/loader.h
index a8cd0cf..76f068d 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -31,6 +31,8 @@ int load_aout(const char *filename, hwaddr addr, int max_sz,
int load_uboot_image_header(const char *filename, uboot_image_header_t *hdr);
int load_uimage(const char *filename, hwaddr *ep,
hwaddr *loadaddr, int *is_linux);
+int load_uimage_at(const char *filename, hwaddr *ep,
+ hwaddr loadaddr, int *is_linux);
/**
* load_ramdisk:
--
1.8.1.4
next prev parent reply other threads:[~2014-08-12 4:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 4:22 [Qemu-devel] [PATCH 0/3] target-xtensa: fix loading uImage kernels on MMUv2 cores Max Filippov
2014-08-12 4:22 ` [Qemu-devel] [PATCH 1/3] hw/core/loader: implement load_uboot_image_header Max Filippov
2014-08-12 4:22 ` Max Filippov [this message]
2014-08-21 9:16 ` [Qemu-devel] [PATCH 2/3] hw/core/loader: implement load_uimage_at Alexander Graf
2014-08-21 20:56 ` Max Filippov
2014-08-21 21:21 ` Alexander Graf
2014-08-12 4:22 ` [Qemu-devel] [PATCH 3/3] target-xtensa: treat uImage load address as virtual Max Filippov
2014-08-16 1:30 ` [Qemu-devel] [PATCH 0/3] target-xtensa: fix loading uImage kernels on MMUv2 cores Max Filippov
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=1407817342-1373-3-git-send-email-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=mail@waldemar-brodkorb.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).