qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] Modify qemu/hw/virtex5_ml507.c to accept a kernel uImage


From: Elvis Dowson
Subject: Re: [Qemu-ppc] Modify qemu/hw/virtex5_ml507.c to accept a kernel uImage file
Date: Tue, 5 Jun 2012 20:30:28 +0200

Hi,
      
On Jun 5, 2012, at 7:19 PM, Alexander Graf wrote:

On 05.06.2012, at 18:58, Elvis Dowson wrote:

Which machine model should I look at, to adapt qemu/hw/virtex5_ml507.c to support loading vmlinux and uImage kernel image formats?

I'd say the best target to look at as example today would be hw/ppce500_mpc8544ds.c. It should be pretty straight forward to add uimage loading support :).

I was able to add kernel uImage loading support but it hangs while attempting to probe the the ethernet device. Is there any way to get past this? 

Should I modify the Xilinx ISE 14.1 BSP project to remove ethernet support, or is there a quicker way to bypass probing the ethernet and allowing the boot process to continue normally.

Here is how my qemu-run.sh script looks like

#!/bin/sh

MACH="-M virtex-ml507"

# Select your QEMU binary.
QEMU=/tool/yocto/poky/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-ppc
#QEMU=/project/qemu/ppc-softmmu/qemu-system-ppc
#QEMU=qemu-system-ppc

KERNEL="-kernel uImage" 
ROOTFS="-hda core-image-minimal-virtex5-ml507.ext3"
NETWORK="-net nic,model=pcnet -net tap,vlan=0,ifname=tap0,script=no,downscript=no"

$QEMU $MACH $BOOTROM $NIC0 $KERNEL $ROOTFS -m 256 -append "rdinit=/boot.sh console=ttyS0" -nographic $* --append "root=/dev/hda rw console=ttyS0 console=tty mem=256M"


Here is the output of the linux boot process:

Using Xilinx Virtex440 machine description
Linux version 3.0.0-14.1-build3 (address@hidden) (gcc version 4.7.1 20120421 (prerelease) (GCC) ) #1 PREEMPT Mon Jun 4 09:39:22 CEST 2012
Zone PFN ranges:
  DMA      0x00000000 -> 0x00010000
  Normal   empty
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0: 0x00000000 -> 0x00010000
MMU: Allocated 1088 bytes of context maps for 255 contexts
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: root=/dev/hda rw console=ttyS0 console=tty mem=256M
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 254540k/262144k available (3940k kernel code, 7604k reserved, 132k data, 1139k bss, 168k init)
Kernel virtual memory layout:
  * 0xfffdf000..0xfffff000  : fixmap
  * 0xfde00000..0xfe000000  : consistent mem
  * 0xfde00000..0xfde00000  : early ioremap
  * 0xd1000000..0xfde00000  : vmalloc & ioremap
Preemptible hierarchical RCU implementation.
NR_IRQS:512 nr_irqs:512 16
clocksource: timebase mult[a00000] shift[22] registered
Console: colour dummy device 80x25
console [tty0] enabled
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
devtmpfs: initialized
NET: Registered protocol family 16
PCI: Probing PCI hardware
bio: create slab <bio-0> at 0
XGpio: /address@hidden/address@hidden: registered
XGpio: /address@hidden/address@hidden: registered
XGpio: /address@hidden/address@hidden: registered
XGpio: /address@hidden/address@hidden: registered
vgaarb: loaded
Switching to clocksource timebase
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
ROMFS MTD (C) 2007 Red Hat, Inc.
JFS: nTxBlock = 1996, nTxLock = 15972
msgmni has been set to 499
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
83e00000.serial: ttyS0 at MMIO 0x83e01003 (irq = 20) is a 16550
console [ttyS0] enabled
brd: module loaded
loop: module loaded
xsysace 83600000.sysace: xsysace: error initializing device at 0x83600000
xsysace 83600000.sysace: could not initialize device, err=-12
xsysace: probe of 83600000.sysace failed with error -12
Xilinx SystemACE device driver, major=254
pflash_write: Unimplemented flash cmd sequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0xf0f0)
of-flash fc000000.flash: do_map_probe() failed
Device Tree Probing 'ethernet'


Here is the patch for the current master:

From d1b83614551446a7d71b899d649707ef46c1ee82 Mon Sep 17 00:00:00 2001
From: Elvis Dowson <address@hidden>
Date: Tue, 5 Jun 2012 19:44:33 +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 <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);
 
     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;
+        }
 
         if (kernel_size < 0) {
             boot_offset = 0x1200000;
-- 
1.7.9.5

Best regards,

Elvis Dowson

reply via email to

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