diff options
Diffstat (limited to 'init/initramfs.c')
-rw-r--r-- | init/initramfs.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/init/initramfs.c b/init/initramfs.c index 4fa0f7977de1..00eff7a11085 100644 --- a/init/initramfs.c +++ b/init/initramfs.c | |||
@@ -491,6 +491,17 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) | |||
491 | return message; | 491 | return message; |
492 | } | 492 | } |
493 | 493 | ||
494 | static int __initdata do_retain_initrd; | ||
495 | |||
496 | static int __init retain_initrd_param(char *str) | ||
497 | { | ||
498 | if (*str) | ||
499 | return 0; | ||
500 | do_retain_initrd = 1; | ||
501 | return 1; | ||
502 | } | ||
503 | __setup("retain_initrd", retain_initrd_param); | ||
504 | |||
494 | extern char __initramfs_start[], __initramfs_end[]; | 505 | extern char __initramfs_start[], __initramfs_end[]; |
495 | #ifdef CONFIG_BLK_DEV_INITRD | 506 | #ifdef CONFIG_BLK_DEV_INITRD |
496 | #include <linux/initrd.h> | 507 | #include <linux/initrd.h> |
@@ -501,7 +512,11 @@ static void __init free_initrd(void) | |||
501 | #ifdef CONFIG_KEXEC | 512 | #ifdef CONFIG_KEXEC |
502 | unsigned long crashk_start = (unsigned long)__va(crashk_res.start); | 513 | unsigned long crashk_start = (unsigned long)__va(crashk_res.start); |
503 | unsigned long crashk_end = (unsigned long)__va(crashk_res.end); | 514 | unsigned long crashk_end = (unsigned long)__va(crashk_res.end); |
515 | #endif | ||
516 | if (do_retain_initrd) | ||
517 | goto skip; | ||
504 | 518 | ||
519 | #ifdef CONFIG_KEXEC | ||
505 | /* | 520 | /* |
506 | * If the initrd region is overlapped with crashkernel reserved region, | 521 | * If the initrd region is overlapped with crashkernel reserved region, |
507 | * free only memory that is not part of crashkernel region. | 522 | * free only memory that is not part of crashkernel region. |
@@ -519,7 +534,7 @@ static void __init free_initrd(void) | |||
519 | } else | 534 | } else |
520 | #endif | 535 | #endif |
521 | free_initrd_mem(initrd_start, initrd_end); | 536 | free_initrd_mem(initrd_start, initrd_end); |
522 | 537 | skip: | |
523 | initrd_start = 0; | 538 | initrd_start = 0; |
524 | initrd_end = 0; | 539 | initrd_end = 0; |
525 | } | 540 | } |