Commit 36bee1e3a4bce569e3f3ab4627e5a379a717bc48
1 parent
947f5fcb
target-ppc: always load kernel to KERNEL_LOAD_ADDR
Linux changed its physical address location in the elf header from 0xc0000000 to 0 on 2.6.25, causing later kernels to fail booting with the -kernel option. This patch assures that the lowest segment in the elf binary is loaded to KERNEL_LOAD_ADDR, which is where the firmware expects it. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6437 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
9 additions
and
3 deletions
hw/ppc_oldworld.c
| ... | ... | @@ -207,10 +207,16 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size, |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if (linux_boot) { |
| 210 | + uint64_t lowaddr = 0; | |
| 210 | 211 | kernel_base = KERNEL_LOAD_ADDR; |
| 211 | - /* now we can load the kernel */ | |
| 212 | - kernel_size = load_elf(kernel_filename, kernel_base - 0xc0000000ULL, | |
| 213 | - NULL, NULL, NULL); | |
| 212 | + /* Now we can load the kernel. The first step tries to load the kernel | |
| 213 | + supposing PhysAddr = 0x00000000. If that was wrong the kernel is | |
| 214 | + loaded again, the new PhysAddr being computed from lowaddr. */ | |
| 215 | + kernel_size = load_elf(kernel_filename, kernel_base, NULL, &lowaddr, NULL); | |
| 216 | + if (kernel_size > 0 && lowaddr != KERNEL_LOAD_ADDR) { | |
| 217 | + kernel_size = load_elf(kernel_filename, (2 * kernel_base) - lowaddr, | |
| 218 | + NULL, 0, NULL); | |
| 219 | + } | |
| 214 | 220 | if (kernel_size < 0) |
| 215 | 221 | kernel_size = load_aout(kernel_filename, kernel_base, |
| 216 | 222 | ram_size - kernel_base); | ... | ... |