diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2006-02-11 17:51:46 -0500 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-11 17:51:46 -0500 |
| commit | cbefa3258eade263dbc9ae2c1f1ea2ca96e6b457 (patch) | |
| tree | 51f012ef93cc828be4eb693c0ced0503217d1025 /init/initramfs.c | |
| parent | 489ff4c7d167be954f715128790bd80d3c888322 (diff) | |
| parent | 25bf368b3d98668c5d5f38e2201d8bca16e52680 (diff) | |
Merge branch 'master'
Diffstat (limited to 'init/initramfs.c')
| -rw-r--r-- | init/initramfs.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/init/initramfs.c b/init/initramfs.c index 0c5d9a3f951..637344b0598 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -466,10 +466,32 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) extern char __initramfs_start[], __initramfs_end[]; #ifdef CONFIG_BLK_DEV_INITRD #include <linux/initrd.h> +#include <linux/kexec.h> static void __init free_initrd(void) { - free_initrd_mem(initrd_start, initrd_end); +#ifdef CONFIG_KEXEC + unsigned long crashk_start = (unsigned long)__va(crashk_res.start); + unsigned long crashk_end = (unsigned long)__va(crashk_res.end); + + /* + * If the initrd region is overlapped with crashkernel reserved region, + * free only memory that is not part of crashkernel region. + */ + if (initrd_start < crashk_end && initrd_end > crashk_start) { + /* + * Initialize initrd memory region since the kexec boot does + * not do. + */ + memset((void *)initrd_start, 0, initrd_end - initrd_start); + if (initrd_start < crashk_start) + free_initrd_mem(initrd_start, crashk_start); + if (initrd_end > crashk_end) + free_initrd_mem(crashk_end, initrd_end); + } else +#endif + free_initrd_mem(initrd_start, initrd_end); + initrd_start = 0; initrd_end = 0; } |
