* [PATCH - kexec] arm: place initrd to safer place according to zImage length
@ 2010-04-23 2:36 Eric Miao
2010-05-11 3:28 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Eric Miao @ 2010-04-23 2:36 UTC (permalink / raw)
To: linux-arm-kernel
commit 4b6d55c7780dbf383c6b64e560d459d15a891006
Author: Eric Miao <eric.miao@canonical.com>
Date: Fri Apr 23 10:19:43 2010 +0800
arm: place initrd to safer place according to zImage length
The original fixed address of 0x800000 may be overwritten after the
kernel is decompressed. Assume a maximum decompression ratio of 4
and place initrd right after that, just to be safer.
Signed-off-by: Eric Miao <eric.miao@canonical.com>
diff --git a/kexec/arch/arm/kexec-zImage-arm.c
b/kexec/arch/arm/kexec-zImage-arm.c
index 72fcdd8..1a446d9 100644
--- a/kexec/arch/arm/kexec-zImage-arm.c
+++ b/kexec/arch/arm/kexec-zImage-arm.c
@@ -130,7 +130,7 @@ struct tag * atag_read_tags(void)
static
int atag_arm_load(struct kexec_info *info, unsigned long base,
const char *command_line, off_t command_line_len,
- const char *initrd, off_t initrd_len)
+ const char *initrd, off_t initrd_len, off_t initrd_off)
{
struct tag *saved_tags = atag_read_tags();
char *buf;
@@ -196,10 +196,8 @@ int atag_arm_load(struct kexec_info *info,
unsigned long base,
add_segment(info, buf, len, base, len);
if (initrd) {
- struct memory_range *range;
- int ranges;
- get_memory_ranges(&range, &ranges, info->kexec_flags);
- *initrd_start = locate_hole(info, initrd_len, getpagesize(),
range[0].start + 0x800000, ULONG_MAX, INT_MAX);
+ *initrd_start = locate_hole(info, initrd_len, getpagesize(),
+ initrd_off, ULONG_MAX, INT_MAX);
if (*initrd_start == ULONG_MAX)
return -1;
add_segment(info, initrd, initrd_len, *initrd_start, initrd_len);
@@ -219,6 +217,7 @@ int zImage_arm_load(int argc, char **argv, const
char *buf, off_t len,
const char *ramdisk;
char *ramdisk_buf;
off_t ramdisk_length;
+ off_t ramdisk_offset;
int opt;
#define OPT_APPEND 'a'
#define OPT_RAMDISK 'r'
@@ -271,9 +270,14 @@ int zImage_arm_load(int argc, char **argv, const
char *buf, off_t len,
if (base == ULONG_MAX)
return -1;
+ /* assume the maximum kernel compression ratio is 4,
+ * and just to be safe, place ramdisk after that
+ */
+ ramdisk_offset = base + len * 4;
+
if (atag_arm_load(info, base + atag_offset,
command_line, command_line_len,
- ramdisk_buf, ramdisk_length) == -1)
+ ramdisk_buf, ramdisk_length, ramdisk_offset) == -1)
return -1;
add_segment(info, buf, len, base + offset, len);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH - kexec] arm: place initrd to safer place according to zImage length
2010-04-23 2:36 [PATCH - kexec] arm: place initrd to safer place according to zImage length Eric Miao
@ 2010-05-11 3:28 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2010-05-11 3:28 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 23, 2010 at 10:36:44AM +0800, Eric Miao wrote:
> commit 4b6d55c7780dbf383c6b64e560d459d15a891006
> Author: Eric Miao <eric.miao@canonical.com>
> Date: Fri Apr 23 10:19:43 2010 +0800
>
> arm: place initrd to safer place according to zImage length
>
> The original fixed address of 0x800000 may be overwritten after the
> kernel is decompressed. Assume a maximum decompression ratio of 4
> and place initrd right after that, just to be safer.
>
> Signed-off-by: Eric Miao <eric.miao@canonical.com>
Thanks, applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-11 3:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-23 2:36 [PATCH - kexec] arm: place initrd to safer place according to zImage length Eric Miao
2010-05-11 3:28 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).