qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [qemuppc] virtex_ml507: Add support for loading kernel uI


From: Alexander Graf
Subject: Re: [Qemu-ppc] [qemuppc] virtex_ml507: Add support for loading kernel uImage binary.
Date: Fri, 8 Jun 2012 14:13:31 +0200

On 05.06.2012, at 20:36, Elvis Dowson wrote:

> This commit adds support for loading a kernel uImage binary.
> 
> Signed-off-by: Elvis Dowson <address@hidden>
> ---
> hw/virtex_ml507.c |   23 +++++++++++++++--------
> 1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/virtex_ml507.c b/hw/virtex_ml507.c
> index 4a133b5..a0ba618 100644
> --- a/hw/virtex_ml507.c
> +++ b/hw/virtex_ml507.c
> @@ -43,8 +43,9 @@
> #include "blockdev.h"
> #include "xilinx.h"
> 
> -#define EPAPR_MAGIC    (0x45504150)
> -#define FLASH_SIZE     (16 * 1024 * 1024)
> +#define UIMAGE_LOAD_BASE 0
> +#define EPAPR_MAGIC      (0x45504150)
> +#define FLASH_SIZE       (16 * 1024 * 1024)
> 
> static struct boot_info
> {
> @@ -189,7 +190,7 @@ static void virtex_init(ram_addr_t ram_size,
>     MemoryRegion *address_space_mem = get_system_memory();
>     DeviceState *dev;
>     CPUPPCState *env;
> -    target_phys_addr_t ram_base = 0;
> +    target_phys_addr_t loadaddr = UIMAGE_LOAD_BASE;
>     DriveInfo *dinfo;
>     MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
>     qemu_irq irq[32], *cpu_irq;
> @@ -206,7 +207,7 @@ static void virtex_init(ram_addr_t ram_size,
> 
>     memory_region_init_ram(phys_ram, "ram", ram_size);
>     vmstate_register_ram_global(phys_ram);
> -    memory_region_add_subregion(address_space_mem, ram_base, phys_ram);
> +    memory_region_add_subregion(address_space_mem, loadaddr, phys_ram);

What does the ram offset have to do with the uimage load base?

> 
>     dinfo = drive_get(IF_PFLASH, 0, 0);
>     pflash_cfi01_register(0xfc000000, NULL, "virtex.flash", FLASH_SIZE,
> @@ -226,14 +227,20 @@ static void virtex_init(ram_addr_t ram_size,
>     /* 2 timers at irq 2 @ 62 Mhz.  */
>     xilinx_timer_create(0x83c00000, irq[3], 2, 62 * 1000000);
> 
> +    /* Load kernel. */
>     if (kernel_filename) {
>         uint64_t entry, low, high;
>         target_phys_addr_t boot_offset;
> 
> -        /* Boots a kernel elf binary.  */
> -        kernel_size = load_elf(kernel_filename, NULL, NULL,
> -                               &entry, &low, &high, 1, ELF_MACHINE, 0);
> -        boot_info.bootstrap_pc = entry & 0x00ffffff;
> +        /* Boot a kernel uImage binary. */
> +        kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL);
> +
> +        /* If we failed loading uImage, try again as a kernel elf binary.  */
> +        if (kernel_size < 0) {
> +            kernel_size = load_elf(kernel_filename, NULL, NULL,
> +                                   &entry, &low, &high, 1, ELF_MACHINE, 0);
> +            boot_info.bootstrap_pc = entry & 0x00ffffff;
> +        }

In the uImage case we don't have to set bootstrap_pc? :)


Alex

> 
>         if (kernel_size < 0) {
>             boot_offset = 0x1200000;
> -- 
> 1.7.9.5
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]