Skip to contentSkip to conversation

initrd not working

Qemu-devel Dick Streefland 2 participants 3 messages Dec 2, 2006 – Dec 4, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I run qemu-0.8.2 on Kubuntu, and I would like to test an initramfs by booting the kernel with qemu. However, I'm having problems with the initrd. The kernel reports "bad gzip magic numbers" when checking the initramfs, both with a compressed ext2 filesystem image and with a compressed cpio archive. What am I doing wrong?

$ hd initrd.gz | head -1
00000000  1f 8b 08 08 6b d2 71 45  00 03 69 6e 69 74 72 64  |....k.qE..initrd|
$ qemu -kernel /boot/linux-2.6.19 -initrd initrd.gz -hda empty -nographic -append console=ttyS0
(qemu) Could not open '/dev/kqemu' - QEMU acceleration layer not activated
Linux version 2.6.19 (dick@zarniwoop) (gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)) #2 SMP Sat Dec 2 23:49:10 CET 2006
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 0000000000100000 - 0000000008000000 (usable)
0MB HIGHMEM available.
128MB LOWMEM available.
Zone PFN ranges:
  DMA             0 ->     4096
  Normal       4096 ->    32768
  HighMem     32768 ->    32768
early_node_map[1] active PFN ranges
    0:        0 ->    32768
DMI not present or invalid.
ACPI: Disabling ACPI support
Allocating PCI resources starting at 10000000 (gap: 08000000:f8000000)
Detected 2405.095 MHz processor.
Built 1 zonelists.  Total pages: 32512
Kernel command line: console=ttyS0
Found and enabled local APIC!
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
PID hash table entries: 512 (order: 9, 2048 bytes)
Console: colour VGA+ 80x25
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 122092k/131072k available (4138k kernel code, 8480k reserved, 2300k data, 320k init, 0k highmem)
virtual kernel memory layout:
    fixmap  : 0xfff9d000 - 0xfffff000   ( 392 kB)
    pkmap   : 0xff800000 - 0xffc00000   (4096 kB)
    vmalloc : 0xc8800000 - 0xff7fe000   ( 879 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
      .init : 0xc0751000 - 0xc07a1000   ( 320 kB)
      .data : 0xc050a9e8 - 0xc0749bec   (2300 kB)
      .text : 0xc0100000 - 0xc050a9e8   (4138 kB)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Calibrating delay using timer specific routine.. 4890.42 BogoMIPS (lpj=9780851)
Mount-cache hash table entries: 512
CPU: L1 I cache: 8K
CPU: L2 cache: 128K
Compat vDSO mapped to ffffe000.
Checking 'hlt' instruction... OK.
SMP alternatives: switching to UP code
Freeing SMP alternatives: 20k freed
CPU0: Intel Pentium II (Klamath) stepping 03
SMP motherboard not detected.
Brought up 1 CPUs
checking if image is initramfs...it isn't (bad gzip magic numbers); looks like an initrd
Signature · 1 line
Dick
#1 lore raw
Quoted 7 lines · Dick Streefland

Hi,

I run qemu-0.8.2 on Kubuntu, and I would like to test an initramfs by booting the kernel with qemu. However, I'm having problems with the initrd. The kernel reports "bad gzip magic numbers" when checking the initramfs, both with a compressed ext2 filesystem image and with a compressed cpio archive. What am I doing wrong?

I don't know, but I'll be interested to find out. I tried two different kernels on Debian amd64, and one of them could load an initrd but the other mysteriously couldn't.

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
#2 lore raw
In reply to Dick Streefland

On Sunday 2006-12-03 00:18, Dick Streefland wrote:

| I run qemu-0.8.2 on Kubuntu, and I would like to test an initramfs by
| booting the kernel with qemu. However, I'm having problems with the
| initrd. The kernel reports "bad gzip magic numbers" when checking the
| initramfs, both with a compressed ext2 filesystem image and with a
| compressed cpio archive. What am I doing wrong?

It looks like the kernel is overwriting the initrd image. When I increase the space for the kernel to 64Mb:

hw/pc.c renamed from hw/pc.c.orig +1 -1
@@ -32,7 +32,7 @@
 #define LINUX_BOOT_FILENAME "linux_boot.bin"
 
 #define KERNEL_LOAD_ADDR     0x00100000
-#define INITRD_LOAD_ADDR     0x00600000
+#define INITRD_LOAD_ADDR     0x04100000
 #define KERNEL_PARAMS_ADDR   0x00090000
 #define KERNEL_CMDLINE_ADDR  0x00099000
 

I can successfully boot. The 5Mb space is not enough for my kernel:

Memory: 120640k/131072k available (4138k kernel code, 9900k reserved, 2300k data, 320k init, 0k highmem)

Perhaps, the load address could be made dynamic?

Signature · 1 line
Dick