qemu-devel
[Top][All Lists]
Advanced

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

Re: Qemu-PPC problems (was [Qemu-devel] Just to add one single point)


From: Jason Wessel
Subject: Re: Qemu-PPC problems (was [Qemu-devel] Just to add one single point)
Date: Thu, 12 Apr 2007 10:49:50 -0500
User-agent: Thunderbird 1.5.0.10 (X11/20070302)

J. Mayer wrote:
On Wed, 2007-04-11 at 17:49 -0400, Rob Landley wrote:
qemu-system-ppc -M prep -nographic -kernel zImage-powerpc -append \
  "console=/dev/ttyS0"

You cannot append anything to the command line this way, with the PPC
firmware...
You can append options when using yaboot, not with the -kernel option.
Then, you should use the CONFIG_CMDLINE kernel option to add the option
you absolutely need to boot.
If you do not modify the prep loader, then it is impossible to pass arguments or load a kernel that expands to > 4meg. With respect to using an unmodified prep loader, you have to build the boot arguments you want into the kernel itself with the .config file options.
[...]
It also seems that most Linux 2.6 kernels support has been broken. It
used to run too, with some versions having a great problem in
frame-buffer mode (writing black on black is not really usable). Using
the serial console always allowed me to follow the boot until X starts.
I'm trying to use serial console.

I tried and the kernel seem to hang before reaching the start_kernel
routine. That why I said there may now be a CPU emulation bug that broke
everything.... Must do more checks with a debug kernel (with traces,
this time. Using early_printk may help a lot !).

[...]

you may try to boot kernels in PREP format as they look like regular boot partitions...
It may help.


While I am sure folks have the objective to be able to boot something that is not modified, my objective was to modify the kernel to work with qemu until that first objective is met. If you use a 2.6.21rc candidate you can use the attached patches to boot. I provided a .config file as well. The frame buffer is definitely broken, but I had not really looked into why because I was more interested in simply using the ppc instruction sets.

Note I startup with the following and it works perfectly fine with my modified kernels: qemu-system-ppc -nographic -kernel zImage.prep -s -M prep -append "console=ttyS0 ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/export/ppc rw netdev=9,0x300,eth0"

There is a new regression between Apr 9 and Apr 10 in the QEMU CVS HEAD where tcp checksums are failing again. :-(

If it would help, I can certainly provide some of my zImage files which run with several different 2.6.x kernels.

Jason.


Attachment: dot_config.gz
Description: GNU Zip compressed data

Adjust prep loader to deal with larger kernel images.

signed-off-by: Jason Wessel <address@hidden>

Index: linux-2.6.21-rc3/arch/ppc/boot/simple/misc.c
===================================================================
--- linux-2.6.21-rc3.orig/arch/ppc/boot/simple/misc.c
+++ linux-2.6.21-rc3/arch/ppc/boot/simple/misc.c
@@ -17,6 +17,7 @@
 #include <linux/types.h>
 #include <linux/string.h>
 
+#include <asm/residual.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
 #include <asm/bootinfo.h>
@@ -27,6 +28,7 @@
 
 #include "nonstdio.h"
 
+#define CONFIG_RUNTIME_CMDLINE 0x17ff000
 /* Default cmdline */
 #ifdef CONFIG_CMDLINE
 #define CMDLINE CONFIG_CMDLINE
@@ -53,7 +55,7 @@
 char *avail_ram;
 char *end_avail;
 char *zimage_start;
-char cmd_preset[] = CMDLINE;
+char cmd_preset[256] = CMDLINE;
 char cmd_buf[256];
 char *cmd_line = cmd_buf;
 int keyb_present = HAS_KEYB;
@@ -91,9 +93,11 @@ get_mem_size(void)
 #endif
 
 struct bi_record *
-decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
+decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum
+,RESIDUAL *residual, void *OFW_interface)
 {
 #ifdef INTERACTIVE_CONSOLE
+    int do_console = 0;
        int timer = 0;
        char ch;
 #endif
@@ -120,9 +124,12 @@ decompress_kernel(unsigned long load_add
         * and we must have the correct file linked in here.
         */
        TotalMemory = get_mem_size();
+       puts("TotalMemory: "); puthex(TotalMemory); puts("\n");
+       puts("TotalResid: "); puthex(residual->TotalMemory); puts("\n");
+       puts("Resid at: "); puthex((unsigned int)residual); puts("\n");
 
-       /* assume the chunk below 8M is free */
-       end_avail = (char *)0x00800000;
+       /* assume the chunk below 10M is free */
+       end_avail = (char *)0x00A00000;
 
        /*
         * Reveal where we were loaded at and where we
@@ -139,6 +146,13 @@ decompress_kernel(unsigned long load_add
                puts("\n");
        }
 
+       if (residual) {
+               puts("board data at: "); puthex((unsigned long)residual);
+               puts(" ");
+               puthex((unsigned long)((unsigned long)residual +
+                                       sizeof(RESIDUAL)));
+               puts("\n");
+       }
        /*
         * We link ourself to 0x00800000.  When we run, we relocate
         * ourselves there.  So we just need __image_begin for the
@@ -167,15 +181,21 @@ decompress_kernel(unsigned long load_add
        }
 
 #ifndef CONFIG_40x /* don't overwrite the 40x image located at 0x00400000! */
-       avail_ram = (char *)0x00400000;
+       avail_ram = (char *)0x00500000;
 #endif
-       end_avail = (char *)0x00800000;
+       end_avail = (char *)0x00A00000;
        puts("avail ram:     "); puthex((unsigned long)avail_ram); puts(" ");
        puthex((unsigned long)end_avail); puts("\n");
 
        if (keyb_present)
                CRT_tstc();  /* Forces keyboard to be initialized */
 
+#ifdef CONFIG_RUNTIME_CMDLINE
+    if (*(char *)CONFIG_RUNTIME_CMDLINE != '\0')
+    {
+        memcpy (cmd_preset, (char *)CONFIG_RUNTIME_CMDLINE, 
sizeof(cmd_preset));
+    }
+#endif
        /* Display standard Linux/PPC boot prompt for kernel args */
        puts("\nLinux/PPC load: ");
        cp = cmd_line;
@@ -187,7 +207,7 @@ decompress_kernel(unsigned long load_add
         * If they have a console, allow them to edit the command line.
         * Otherwise, don't bother wasting the five seconds.
         */
-       while (timer++ < 5*1000) {
+       while (do_console && timer++ < 5*1000) {
                if (tstc()) {
                        while ((ch = getc()) != '\n' && ch != '\r') {
                                /* Test for backspace/delete */
@@ -215,8 +235,9 @@ decompress_kernel(unsigned long load_add
 #endif
        puts("\n");
 
-       puts("Uncompressing Linux...");
-       gunzip(NULL, 0x400000, zimage_start, &zimage_size);
+       puts("Compressed size: "); puthex((unsigned long)(zimage_size));
+       puts("\nUncompressing Linux...");
+       gunzip(NULL, 0x500000, zimage_start, &zimage_size);
        puts("done.\n");
 
        /* get the bi_rec address */
@@ -274,5 +295,5 @@ load_kernel(unsigned long load_addr, int
                void *ign1, void *ign2)
 {
                board_isa_init();
-               return decompress_kernel(load_addr, num_words, cksum);
+               return decompress_kernel(load_addr, num_words, cksum, ign1, 
ign2);
 }
Workaround for QEMU ppc 32 to force interrupt acknoledgement

signed-off-by: Jason Wessel <address@hidden>

Index: linux-2.6.21-rc1/kernel/irq/chip.c
===================================================================
--- linux-2.6.21-rc1.orig/kernel/irq/chip.c
+++ linux-2.6.21-rc1/kernel/irq/chip.c
@@ -225,11 +225,17 @@ static void default_enable(unsigned int 
        desc->status &= ~IRQ_MASKED;
 }
 
+#define IRQ_DELAYED_DISABLE    0x10000000      /* IRQ disable (masking) 
happens delayed. */
+
 /*
  * default disable function
  */
 static void default_disable(unsigned int irq)
 {
+       struct irq_desc *desc = irq_desc + irq;
+
+       if (!(desc->status & IRQ_DELAYED_DISABLE))
+               desc->chip->mask(irq);
 }
 
 /*

reply via email to

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