[oe] [poky] qemu: virtex5-ml507: Add kernel uImage loading support.

Khem Raj raj.khem at gmail.com
Tue Jun 5 19:19:10 UTC 2012


On Tue, Jun 5, 2012 at 12:09 PM, Elvis Dowson <elvis.dowson at gmail.com> wrote:
> This commit adds kernel uImage loading support for the Xilinx ML507
> development board emulator.

looks ok
>
> Signed-off-by: Elvis Dowson <elvis.dowson at gmail.com>
> ---
>  ...5-ml507-add-kernel-uImage-loading-support.patch |   74 ++++++++++++++++++++
>  meta/recipes-devtools/qemu/qemu_0.15.1.bb          |    3 +-
>  2 files changed, 76 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-devtools/qemu/qemu-0.15.1/qemu-virtex5-ml507-add-kernel-uImage-loading-support.patch
>
> diff --git a/meta/recipes-devtools/qemu/qemu-0.15.1/qemu-virtex5-ml507-add-kernel-uImage-loading-support.patch b/meta/recipes-devtools/qemu/qemu-0.15.1/qemu-virtex5-ml507-add-kernel-uImage-loading-support.patch
> new file mode 100644
> index 0000000..6ddec7f
> --- /dev/null
> +++ b/meta/recipes-devtools/qemu/qemu-0.15.1/qemu-virtex5-ml507-add-kernel-uImage-loading-support.patch
> @@ -0,0 +1,74 @@
> +From 8ba6fc6d75b4da1b84062efdab2543df5ab93792 Mon Sep 17 00:00:00 2001
> +From: Elvis Dowson <elvis.dowson at gmail.com>
> +Date: Tue, 5 Jun 2012 20:03:14 +0200
> +Subject: [PATCH] virtex_ml507: Add support for loading kernel uImage binary.
> +
> +This commit adds support for loading a kernel uImage binary.
> +
> +Signed-off-by: Elvis Dowson <elvis.dowson at gmail.com>
> +---
> + 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 7bde8c7..0a80536 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
> + {
> +@@ -193,7 +194,7 @@ static void virtex_init(ram_addr_t ram_size,
> + {
> +     DeviceState *dev;
> +     CPUState *env;
> +-    target_phys_addr_t ram_base = 0;
> ++    target_phys_addr_t loadaddr = UIMAGE_LOAD_BASE;
> +     DriveInfo *dinfo;
> +     ram_addr_t phys_ram;
> +     ram_addr_t phys_flash;
> +@@ -213,7 +214,7 @@ static void virtex_init(ram_addr_t ram_size,
> +     qemu_register_reset(main_cpu_reset, env);
> +
> +     phys_ram = qemu_ram_alloc(NULL, "ram", ram_size);
> +-    cpu_register_physical_memory(ram_base, ram_size, phys_ram | IO_MEM_RAM);
> ++    cpu_register_physical_memory(loadaddr, ram_size, phys_ram | IO_MEM_RAM);
> +
> +     phys_flash = qemu_ram_alloc(NULL, "virtex.flash", FLASH_SIZE);
> +     dinfo = drive_get(IF_PFLASH, 0, 0);
> +@@ -233,14 +234,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;
> ++        }
> +
> +         if (kernel_size < 0) {
> +             boot_offset = 0x1200000;
> +--
> +1.7.9.5
> +
> diff --git a/meta/recipes-devtools/qemu/qemu_0.15.1.bb b/meta/recipes-devtools/qemu/qemu_0.15.1.bb
> index bcff9f8..f659106 100644
> --- a/meta/recipes-devtools/qemu/qemu_0.15.1.bb
> +++ b/meta/recipes-devtools/qemu/qemu_0.15.1.bb
> @@ -3,7 +3,7 @@ require qemu.inc
>  LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
>                     file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913"
>
> -PR = "r8"
> +PR = "r9"
>
>  FILESPATH = "${FILE_DIRNAME}/qemu-${PV}"
>  FILESDIR = "${WORKDIR}"
> @@ -20,6 +20,7 @@ SRC_URI = "\
>     file://arm-bgr.patch \
>     file://a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch \
>     file://dummy-gl-config.patch \
> +    file://qemu-virtex5-ml507-add-kernel-uImage-loading-support.patch \
>     "
>
>  # Only use the GL passthrough patches for native/nativesdk versions
> --
> 1.7.9.5
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel




More information about the Openembedded-devel mailing list