machyve / xhyve

xhyve, a lightweight OS X virtualization solution
Other
6.44k stars 353 forks source link

initramfs memory is overwritten when booting Debian’s hd-media install #116

Closed VinDuv closed 5 years ago

VinDuv commented 8 years ago

I attempted to start the Debian installer using the vmlinuz and initrd.img found on here: http://ftp.nl.debian.org/debian/dists/testing/main/installer-amd64/current/images/hd-media/

I used the following command:

xhyve -s 0:0,hostbridge -s 31,lpc -l com1,stdio -f kexec,vmlinuz,initrd.gz,"console=ttyS0"

Unfortunately the boot process doesn’t go very far because the kernel encounters a corrupt initramfs:

[    0.410425] Unpacking initramfs...
[    0.410681] Initramfs unpacking failed: junk in compressed archive

The initramfs is actually corrupted by the Linux self-decompression mechanism. The decompressed kernel is written (in this case) from address 0x01000000 (16MB) to 0x0210c388 (~33MB). xhyve puts the initramfs at 0x01343000 (19MB), which gets overwritten.

Adding a sufficient offset to ramdisk_start in kexec.c allows the installer to start successfully. I have not tested it further.

I checked what qemu does. It apparently puts the initrd near the end of the allocated RAM. With 128 MB of memory, the 12MB initrd is put at 0x07fdf573 (~115MB), with 1GB it is put at 0x000000003f395000 (~1011MB).

barnumbirr commented 8 years ago

Already discussed in #74 .