Re: [PATCH] Fix initramfs size calculation

Hendrik Brueckner
2010-08-25T19:15:39Z

Sam,

I have work together with Michael on this patch... see my comments below

On Wed, Aug 25, 2010 at 08:06:01PM +0200, Sam Ravnborg wrote:
> On Wed, Aug 25, 2010 at 05:57:12PM +0200, Michael Holzheu wrote:
>
> Another way to fix this could be to align . to an even
> address like this:
> > #define INIT_RAM_FS \
> > . = ALIGN(PAGE_SIZE); \
> > VMLINUX_SYMBOL(__initramfs_start) = .; \
> > *(.init.ramfs) \
> . = ALIGN(32); \
> > VMLINUX_SYMBOL(__initramfs_end) = .;
> >
>
> 32 was selected as this is what we will introduce as the default
> alignment in linker scripts anyway.
>
> This I guess is a problem we have had some time and a minimal fix is
> easier to have backported by the stable team.

The first thought was similar but using ALIGN(2). However, the current
implementation of populate_rootfs() passes the calculated size to the
decompress functions. If __initramfs_end is aligned, the resulting size
might be greater than the real size of the initramfs.
So I guess this might also cause problems.

> > The patch also restructures the "usr/initramfs_data.xxx.S" files to use a
> > common macro that includes the (compressed) initramfs file and calculates
> > the __initramfs_size.
> I like this anyway. Could you do this as a separate patch?

I think that Michael or me could do this.

Kind regards,
Hendrik