[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] loader: pad kernel size when loaded from a uIma
From: |
malc |
Subject: |
Re: [Qemu-devel] [PATCH] loader: pad kernel size when loaded from a uImage |
Date: |
Fri, 30 Jul 2010 10:31:16 +0400 (MSD) |
User-agent: |
Alpine 2.00 (LNX 1167 2008-08-23) |
On Thu, 29 Jul 2010, Hollis Blanchard wrote:
> The kernel's BSS size is lost by mkimage, which only considers file
> size. As a result, loading other blobs (e.g. device tree, initrd)
> immediately after the kernel location can result in them being zeroed by
> the kernel's BSS initialization code.
>
> Signed-off-by: Hollis Blanchard <address@hidden>
> ---
> hw/loader.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/hw/loader.c b/hw/loader.c
> index 79a6f95..35bc25a 100644
> --- a/hw/loader.c
> +++ b/hw/loader.c
> @@ -507,6 +507,13 @@ int load_uimage(const char *filename, target_phys_addr_t
> *ep,
>
> ret = hdr->ih_size;
>
> + /* The kernel's BSS size is lost by mkimage, which only considers file
> + * size. We don't know how big it is, but we do know we can't place
> + * anything immediately after the kernel. The padding seems like it
> should
> + * be proportional to overall file size, but we also make sure it's at
> + * least 4-byte aligned. */
> + ret += (hdr->ih_size / 16) & ~0x3;
> +
This portion uses tabs.
> out:
> if (data)
> qemu_free(data);
>
--
mailto:address@hidden