#805965 boot-s390-common, d390.ins: initrd overwrites kernel due to a low offset

#805965#5
Date:
2015-11-24 11:38:16 UTC
From:
To:
Dear debian-cd Maintainers,

I recently encountered a problem at the installation of Debian on s390:

The d390.ins specifies where to load the kernel image and the initrd into
memory.  The current d390.ins uses:
--------------------------------------------------------------
* Debian GNU/Linux for S/390 (boot from CD-ROM or FTP-Server)
linux_vm 0x00000000
root.off 0x0001040c
root.siz 0x00010414
parmfile 0x00010480
root.bin 0x00800000
--------------------------------------------------------------

The size of the linux_vm is about 11M and the initrd is loaded at
the memory address 0x00800000 (8M) which overrides the kernel image.
A result, the kernel and debian installer cannot be started on logical
partitions (LPAR) on z Systems.

To correct this problem, please update the memory location to which
the initrd is loaded from 0x00800000 (8M) to 0x02000000 (32MB).

The 0x02000000 memory location is the preferred and commonly used
memory location.   As far as I could see, this affects all d390.ins
files, as well as, the boot-s390-common files which create the
root.off file.


Thanks and kind regards,
	Hendrik

#805965#10
Date:
2015-11-24 13:00:13 UTC
From:
To:
ACK, thanks for your report. In fact, just 2 weeks back Philipp Kern
(in CC) has added some fixes in this exact area in debian-cd
git. He's moved the root.bin up to 0x01000000 (16MB); I'd be happy to
move it up to 0x02000000 as you suggest. Phil - what do you think?

I'm also going to make sure the fixes are backported to our stable
build tree for the next point release.

#805965#15
Date:
2015-11-24 16:39:16 UTC
From:
To:
Actually, the best solution would be to calculate this offset dynamically,
and write the modified root.off and d390.ins file.  For the initrd offset
calcuation, take the size of the vmlinuz kernel image + 4MB (0x00400000).

The 4MB just adds some place for the kernel BSS section.  It is not
strictly necessary, as the kernel moves the initrd out of its BSS
section before it clearing it.

This would be the better solution and it works even if the kernel grows
over time.

Thanks.  For backports, it should be sufficient to increase the offset
for current and future, we might consider the dynamic approach above.

Thanks and kind regards,
  Hendrik

#805965#20
Date:
2015-11-24 17:08:17 UTC
From:
To:
OK, that's easy enough. Are there any alignment issues to worry about
on top of that - do we have to pad that to the next 1MB, say?

Yup, it's more sustainable.

Definitely.

#805965#25
Date:
2015-11-24 17:22:03 UTC
From:
To:
No alignment issues.  The initrd could be right after the kernel image.
Adding some space between prevents a potential move of the initrd.  The
kernel includes some checks to ensure the initrd does not collide, for
example, with the BSS section.  If it conflicts, the kernel moves the
initrd after these areas.  So providing some room between avoids some
memory copy operations.

Thanks and kind regards,
  Hendrik