qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] make -kernel optional for all ARM boards
@ 2013-09-24  0:01 Peter Maydell
  2013-09-24  0:01 ` [Qemu-devel] [PATCH 1/2] hw/arm/boot: Make user not specifying a kernel not an error Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2013-09-24  0:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Grant Likely, Andreas Färber, patches

Make -kernel optional for all ARM boards, by allowing
arm_load_kernel() to return without doing anything if no
kernel filename was provided. In this case we will start
execution at address zero (as the hardware does). This
allows the user to provide a flash image or similar on
some boards; in particular it's possible to run a UEFI
image on the versatile express boards.

The second patch tidies up a few boards which had already
effectively provided this flexibility at the board level.

Peter Maydell (2):
  hw/arm/boot: Make user not specifying a kernel not an error
  hw/arm: Tidy up conditional calls to arm_load_kernel

 hw/arm/boot.c     |  6 ++++--
 hw/arm/omap_sx1.c | 10 ++++------
 hw/arm/palm.c     | 10 ++++------
 hw/arm/z2.c       | 12 +++++-------
 4 files changed, 17 insertions(+), 21 deletions(-)

-- 
1.7.11.4

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

* [Qemu-devel] [PATCH 1/2] hw/arm/boot: Make user not specifying a kernel not an error
  2013-09-24  0:01 [Qemu-devel] [PATCH 0/2] make -kernel optional for all ARM boards Peter Maydell
@ 2013-09-24  0:01 ` Peter Maydell
  2013-09-24  0:01 ` [Qemu-devel] [PATCH 2/2] hw/arm: Tidy up conditional calls to arm_load_kernel Peter Maydell
  2013-09-30 13:58 ` [Qemu-devel] [PATCH 0/2] make -kernel optional for all ARM boards Andreas Färber
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2013-09-24  0:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Grant Likely, Andreas Färber, patches

Typically ARM boards will have some kind of flash which might contain
a boot ROM; it's therefore a valid use case to provide only an
image for the boot ROM and not require QEMU's internal boot loader
at all. Remove the fatal error if -kernel isn't specified.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/boot.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 1e313af..583ec79 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -354,8 +354,10 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
 
     /* Load the kernel.  */
     if (!info->kernel_filename) {
-        fprintf(stderr, "Kernel image must be specified\n");
-        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.
+         */
+        return;
     }
 
     info->dtb_filename = qemu_opt_get(qemu_get_machine_opts(), "dtb");
-- 
1.7.11.4

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

* [Qemu-devel] [PATCH 2/2] hw/arm: Tidy up conditional calls to arm_load_kernel
  2013-09-24  0:01 [Qemu-devel] [PATCH 0/2] make -kernel optional for all ARM boards Peter Maydell
  2013-09-24  0:01 ` [Qemu-devel] [PATCH 1/2] hw/arm/boot: Make user not specifying a kernel not an error Peter Maydell
@ 2013-09-24  0:01 ` Peter Maydell
  2013-09-30 13:58 ` [Qemu-devel] [PATCH 0/2] make -kernel optional for all ARM boards Andreas Färber
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2013-09-24  0:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Grant Likely, Andreas Färber, patches

Now that arm_load_kernel doesn't insist on a kernel filename
being present, we can remove some unnecessary conditionals
in board models.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/omap_sx1.c | 10 ++++------
 hw/arm/palm.c     | 10 ++++------
 hw/arm/z2.c       | 12 +++++-------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index b0f8664..03b3816 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -194,12 +194,10 @@ static void sx1_init(QEMUMachineInitArgs *args, const int version)
     }
 
     /* Load the kernel.  */
-    if (args->kernel_filename) {
-        sx1_binfo.kernel_filename = args->kernel_filename;
-        sx1_binfo.kernel_cmdline = args->kernel_cmdline;
-        sx1_binfo.initrd_filename = args->initrd_filename;
-        arm_load_kernel(mpu->cpu, &sx1_binfo);
-    }
+    sx1_binfo.kernel_filename = args->kernel_filename;
+    sx1_binfo.kernel_cmdline = args->kernel_cmdline;
+    sx1_binfo.initrd_filename = args->initrd_filename;
+    arm_load_kernel(mpu->cpu, &sx1_binfo);
 
     /* TODO: fix next line */
     //~ qemu_console_resize(ds, 640, 480);
diff --git a/hw/arm/palm.c b/hw/arm/palm.c
index 3e39044..0b72bbe 100644
--- a/hw/arm/palm.c
+++ b/hw/arm/palm.c
@@ -261,12 +261,10 @@ static void palmte_init(QEMUMachineInitArgs *args)
     }
 
     /* Load the kernel.  */
-    if (kernel_filename) {
-        palmte_binfo.kernel_filename = kernel_filename;
-        palmte_binfo.kernel_cmdline = kernel_cmdline;
-        palmte_binfo.initrd_filename = initrd_filename;
-        arm_load_kernel(mpu->cpu, &palmte_binfo);
-    }
+    palmte_binfo.kernel_filename = kernel_filename;
+    palmte_binfo.kernel_cmdline = kernel_cmdline;
+    palmte_binfo.initrd_filename = initrd_filename;
+    arm_load_kernel(mpu->cpu, &palmte_binfo);
 }
 
 static QEMUMachine palmte_machine = {
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index 2e0d5d4..a00fcc0 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -360,13 +360,11 @@ static void z2_init(QEMUMachineInitArgs *args)
     qdev_connect_gpio_out(mpu->gpio, Z2_GPIO_LCD_CS,
         qemu_allocate_irqs(z2_lcd_cs, z2_lcd, 1)[0]);
 
-    if (kernel_filename) {
-        z2_binfo.kernel_filename = kernel_filename;
-        z2_binfo.kernel_cmdline = kernel_cmdline;
-        z2_binfo.initrd_filename = initrd_filename;
-        z2_binfo.board_id = 0x6dd;
-        arm_load_kernel(mpu->cpu, &z2_binfo);
-    }
+    z2_binfo.kernel_filename = kernel_filename;
+    z2_binfo.kernel_cmdline = kernel_cmdline;
+    z2_binfo.initrd_filename = initrd_filename;
+    z2_binfo.board_id = 0x6dd;
+    arm_load_kernel(mpu->cpu, &z2_binfo);
 }
 
 static QEMUMachine z2_machine = {
-- 
1.7.11.4

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

* Re: [Qemu-devel] [PATCH 0/2] make -kernel optional for all ARM boards
  2013-09-24  0:01 [Qemu-devel] [PATCH 0/2] make -kernel optional for all ARM boards Peter Maydell
  2013-09-24  0:01 ` [Qemu-devel] [PATCH 1/2] hw/arm/boot: Make user not specifying a kernel not an error Peter Maydell
  2013-09-24  0:01 ` [Qemu-devel] [PATCH 2/2] hw/arm: Tidy up conditional calls to arm_load_kernel Peter Maydell
@ 2013-09-30 13:58 ` Andreas Färber
  2 siblings, 0 replies; 4+ messages in thread
From: Andreas Färber @ 2013-09-30 13:58 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Grant Likely, patches

Am 24.09.2013 02:01, schrieb Peter Maydell:
> Make -kernel optional for all ARM boards, by allowing
> arm_load_kernel() to return without doing anything if no
> kernel filename was provided. In this case we will start
> execution at address zero (as the hardware does). This
> allows the user to provide a flash image or similar on
> some boards; in particular it's possible to run a UEFI
> image on the versatile express boards.
> 
> The second patch tidies up a few boards which had already
> effectively provided this flexibility at the board level.
> 
> Peter Maydell (2):
>   hw/arm/boot: Make user not specifying a kernel not an error
>   hw/arm: Tidy up conditional calls to arm_load_kernel

Thanks, applied to qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next

Andreas

> 
>  hw/arm/boot.c     |  6 ++++--
>  hw/arm/omap_sx1.c | 10 ++++------
>  hw/arm/palm.c     | 10 ++++------
>  hw/arm/z2.c       | 12 +++++-------
>  4 files changed, 17 insertions(+), 21 deletions(-)
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

end of thread, other threads:[~2013-09-30 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-24  0:01 [Qemu-devel] [PATCH 0/2] make -kernel optional for all ARM boards Peter Maydell
2013-09-24  0:01 ` [Qemu-devel] [PATCH 1/2] hw/arm/boot: Make user not specifying a kernel not an error Peter Maydell
2013-09-24  0:01 ` [Qemu-devel] [PATCH 2/2] hw/arm: Tidy up conditional calls to arm_load_kernel Peter Maydell
2013-09-30 13:58 ` [Qemu-devel] [PATCH 0/2] make -kernel optional for all ARM boards Andreas Färber

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