aboutsummaryrefslogtreecommitdiffstats
path: root/init/initramfs.c
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2007-02-10 04:44:33 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:24 -0500
commit0a7b35cb18c52d651f6ed9cd59edc979200ab880 (patch)
tree0f4b9ec8296170f7144637aa05d5b58cb2f56c6c /init/initramfs.c
parent70e840499aae90be1de542894062ad2899d23642 (diff)
[PATCH] Add retain_initrd boot option
Add retain_initrd option to control freeing of initrd memory after extraction. By default, free memory as previously. The first boot will need to hold a copy of the in memory fs for the second boot. This image can be large (much larger than the kernel), hence we can save time when the memory loader is slow. Also, it reduces the memory footprint while extracting the first boot since you don't need another copy of the fs. Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: "Randy.Dunlap" <rdunlap@xenotime.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init/initramfs.c')
-rw-r--r--init/initramfs.c17
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
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}