From: Max Filippov <jcmvbkbc@gmail.com>
To: qemu-devel@nongnu.org
Cc: Max Filippov <jcmvbkbc@gmail.com>,
Waldemar Brodkorb <mail@waldemar-brodkorb.de>
Subject: [Qemu-devel] [PATCH 9/9] hw/xtensa/xtfpga: implement initrd loading
Date: Mon, 23 Jun 2014 20:12:56 +0400 [thread overview]
Message-ID: <1403539976-22581-10-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1403539976-22581-1-git-send-email-jcmvbkbc@gmail.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
hw/xtensa/xtfpga.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index 01825d6..a2dff5a 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -180,6 +180,7 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
const char *kernel_filename = qemu_opt_get(machine_opts, "kernel");
const char *kernel_cmdline = qemu_opt_get(machine_opts, "append");
const char *dtb_filename = qemu_opt_get(machine_opts, "dtb");
+ const char *initrd_filename = qemu_opt_get(machine_opts, "initrd");
int n;
if (!cpu_model) {
@@ -263,6 +264,9 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
if (dtb_filename) {
bp_size += get_tag_size(sizeof(uint32_t));
}
+ if (initrd_filename) {
+ bp_size += get_tag_size(sizeof(BpMemInfo));
+ }
/* Put kernel bootparameters to the end of that SRAM */
tagptr = (tagptr - bp_size) & ~0xff;
@@ -289,6 +293,26 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
sizeof(dtb_addr), &dtb_addr);
cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + fdt_size, 4096);
}
+ if (initrd_filename) {
+ BpMemInfo initrd_location = { 0 };
+ int initrd_size = load_ramdisk(initrd_filename, cur_lowmem,
+ lowmem_end - cur_lowmem);
+
+ if (initrd_size < 0) {
+ initrd_size = load_image_targphys(initrd_filename,
+ cur_lowmem,
+ lowmem_end - cur_lowmem);
+ }
+ if (initrd_size < 0) {
+ error_report("could not load initrd '%s'\n", initrd_filename);
+ exit(EXIT_FAILURE);
+ }
+ initrd_location.start = tswap32(cur_lowmem);
+ initrd_location.end = tswap32(cur_lowmem + initrd_size);
+ cur_tagptr = put_tag(cur_tagptr, BP_TAG_INITRD,
+ sizeof(initrd_location), &initrd_location);
+ cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + initrd_size, 4096);
+ }
cur_tagptr = put_tag(cur_tagptr, BP_TAG_LAST, 0, NULL);
env->regs[2] = tagptr;
--
1.8.1.4
prev parent reply other threads:[~2014-06-23 16:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-23 16:12 [Qemu-devel] [PATCH 0/9] target-xtensa: linux booting improvements Max Filippov
2014-06-23 16:12 ` [Qemu-devel] [PATCH 1/9] hw/xtensa: remove extraneous xtensa_ prefix from file names Max Filippov
2014-06-23 16:12 ` [Qemu-devel] [PATCH 2/9] hw/xtensa: replace fprintfs with error_report Max Filippov
2014-06-23 16:12 ` [Qemu-devel] [PATCH 3/9] hw/xtensa/xtfpga: retrieve parameters from machine_opts Max Filippov
2014-06-23 16:12 ` [Qemu-devel] [PATCH 4/9] hw/xtensa/xtfpga: use symbolic constants for bootparam tags Max Filippov
2014-06-23 16:12 ` [Qemu-devel] [PATCH 5/9] hw/xtensa/xtfpga: refactor bootparameters filling Max Filippov
2014-06-23 16:12 ` [Qemu-devel] [PATCH 6/9] hw/xtensa/xtfpga: add memory info to bootparam Max Filippov
2014-06-23 16:12 ` [Qemu-devel] [PATCH 7/9] hw/xtensa/xtfpga: implement uImage loading Max Filippov
2014-06-23 16:12 ` [Qemu-devel] [PATCH 8/9] hw/xtensa/xtfpga: implement DTB loading Max Filippov
2014-06-23 16:12 ` Max Filippov [this message]
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=1403539976-22581-10-git-send-email-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=mail@waldemar-brodkorb.de \
--cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.