aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt2
-rw-r--r--init/initramfs.c17
2 files changed, 18 insertions, 1 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 25d298517104..d25acd51e181 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1396,6 +1396,8 @@ and is between 256 and 4096 characters. It is defined in the file
1396 in <PAGE_SIZE> units (needed only for swap files). 1396 in <PAGE_SIZE> units (needed only for swap files).
1397 See Documentation/power/swsusp-and-swap-files.txt 1397 See Documentation/power/swsusp-and-swap-files.txt
1398 1398
1399 retain_initrd [RAM] Keep initrd memory after extraction
1400
1399 rhash_entries= [KNL,NET] 1401 rhash_entries= [KNL,NET]
1400 Set number of hash buckets for route cache 1402 Set number of hash buckets for route cache
1401 1403
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
494static int __initdata do_retain_initrd;
495
496static 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
494extern char __initramfs_start[], __initramfs_end[]; 505extern 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 537skip:
523 initrd_start = 0; 538 initrd_start = 0;
524 initrd_end = 0; 539 initrd_end = 0;
525} 540}