qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/arm/boot: load device tree to base of DRAM if no -kernel option was passed
@ 2014-08-26 15:31 Ard Biesheuvel
  2014-09-01 17:36 ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Ard Biesheuvel @ 2014-08-26 15:31 UTC (permalink / raw)
  To: qemu-devel, peter.maydell; +Cc: Ard Biesheuvel

If we are running the 'virt' machine, we may have a device tree blob but no
kernel to supply it to if no -kernel option was passed. In that case, copy it
to the base of DRAM where it can be picked up by a bootloader executing from
NOR flash.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 hw/arm/boot.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 3d1f4a255b48..ff6a727613aa 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -455,6 +455,14 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
 
     /* Load the kernel.  */
     if (!info->kernel_filename) {
+        /*
+         * If we have a device tree blob, but no kernel to supply it to, copy it
+         * to the base of DRAM for a bootloader executing from NOR flash to
+         * pick up.
+         */
+        if (have_dtb(info))
+            load_dtb(info->loader_start, info);
+
         /* If no kernel specified, do nothing; we will start from address 0
          * (typically a boot ROM image) in the same way as hardware.
          */
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH] hw/arm/boot: load device tree to base of DRAM if no -kernel option was passed
@ 2014-09-03 12:01 Ard Biesheuvel
  2014-09-03 12:32 ` Peter Crosthwaite
  0 siblings, 1 reply; 8+ messages in thread
From: Ard Biesheuvel @ 2014-09-03 12:01 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: Ard Biesheuvel

If we are running the 'virt' machine, we may have a device tree blob but no
kernel to supply it to if no -kernel option was passed. In that case, copy it
to the base of DRAM where it can be picked up by a bootloader executing from
NOR flash.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
v2: comment style, call exit(1) on load_dtb() failure

 hw/arm/boot.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index e32f2f415885..a32ff28d9be1 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -459,6 +459,17 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
 
     /* Load the kernel.  */
     if (!info->kernel_filename) {
+
+        if (have_dtb(info)) {
+            /* If we have a device tree blob, but no kernel to supply it to,
+             * copy it to the base of DRAM for a bootloader executing from
+             * NOR flash to pick up.
+             */
+            if (load_dtb(info->loader_start, info)) {
+                exit(1);
+            }
+        }
+
         /* If no kernel specified, do nothing; we will start from address 0
          * (typically a boot ROM image) in the same way as hardware.
          */
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-09-03 12:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-26 15:31 [Qemu-devel] [PATCH] hw/arm/boot: load device tree to base of DRAM if no -kernel option was passed Ard Biesheuvel
2014-09-01 17:36 ` Peter Maydell
2014-09-01 17:46   ` Ard Biesheuvel
2014-09-01 17:50     ` Peter Maydell
2014-09-01 18:04       ` Ard Biesheuvel
2014-09-01 18:27         ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2014-09-03 12:01 Ard Biesheuvel
2014-09-03 12:32 ` Peter Crosthwaite

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).