lilo 22.7.3 corrupts initrd with large kernel images

From: Denis Vlasenko
Date: Sun Sep 24 2006 - 10:00:14 EST


Hello John,

It seems that lilo does something incorrectly with initrd image
if kernel image is around 3MB. I found this when I built Linux 2.6.18
and it failed to mount initrd. Previously I was using 2.6.17.11_64
and earlier kernels with no problems.

I tried loading the same image and initrd from DOS with linld and
it worked flawlessly. Then I loaded the image without initrd
using lilo (this worked) and compared dmesg with DOS one.
The obvious related difference is:

testing NMI watchdog ... OK.
-checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
+checking if image is initramfs...it isn't (bad gzip magic numbers); looks like an initrd
Freeing initrd memory: 1460k freed

Then I built smaller 2.6.18 (excluded some stuff I can boot without)
and it was loaded with initrd using lilo just fine.

More details:

# lilo -V
LILO version 22.7.3

# cd /boot; ls -l */bzImage img-01.gz
-rw-r--r-- 1 root root 2615417 Sep 21 21:34 2.6.17.11_64/bzImage (loads ok)
-rw-r--r-- 1 root root 3024504 Sep 22 02:34 2.6.18_64/bzImage (BAD)
-rw-r--r-- 1 root root 2687906 Sep 24 15:35 2.6.18_64s/bzImage (loads ok)
-r--r--r-- 1 root root 1495860 Sep 2 2005 img-01.gz (initrd image)

lilo.conf:

boot=/dev/hda5
lba32
compact
prompt
timeout=40
vga=ask

image=/boot/2.6.18_64/bzImage
label=2.6.18_64
initrd=/boot/img-01.gz
root=/dev/hda5
append="root=/dev/hda5 init=/bin/sh"
vga=0

image=/boot/2.6.18_64s/bzImage
label=2.6.18_64s
initrd=/boot/img-01.gz
append="root=/dev/ram init=/linuxrc ROOTMAJ=3 ROOTMIN=5 IPCFG=mac INIT=/init"
vga=0

image=/boot/2.6.17.11_64/bzImage
label=2.6.17.11_64
initrd=/boot/img-01.gz
append="root=/dev/ram init=/linuxrc ROOTMAJ=3 ROOTMIN=5 IPCFG=mac INIT=/init"
vga=0

Attached are dmesg outputs from all three boot scenarios:
dmesg_bare - 2.6.18_64 without initrd using lilo, init=/bin/sh
dmesg_dos - 2.6.18_64 with initrd using linld, normal boot
dmesg_smaller - 2.6.18_64s with initrd using lilo, normal boot
--
vda

Attachment: dmesg_bare.bz2
Description: BZip2 compressed data

Attachment: dmesg_smaller.bz2
Description: BZip2 compressed data

Attachment: dmesg_dos.bz2
Description: BZip2 compressed data