All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] KERNEL:  Conditionally include ramdisk-related code.
Date: Sat, 11 Jul 2009 06:39:23 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.0907110636290.2814@localhost> (raw)


Given that BLK_DEV_INITRD defines whether the kernel has any ramdisk
functionality whatsoever, conditionally include ramdisk-related code
in init/main.c.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

  Not a big deal, but there seems to be some precedent in other files
in conditionally whacking out any chunks related to ramdisks if
BLK_DEV_INITRD has not been selected.

  Compile tested on x86 with "defconfig", followed by deselecting
BLK_DEV_INITRD.

diff --git a/init/main.c b/init/main.c
index 2c5ade7..d88c7b4 100644
--- a/init/main.c
+++ b/init/main.c
@@ -119,7 +119,9 @@ char *saved_command_line;
 static char *static_command_line;

 static char *execute_command;
+#ifdef CONFIG_BLK_DEV_INITRD
 static char *ramdisk_execute_command;
+#endif

 #ifdef CONFIG_SMP
 /* Setup configured maximum number of CPUs to activate */
@@ -330,6 +332,8 @@ static int __init init_setup(char *str)
 }
 __setup("init=", init_setup);

+#ifdef CONFIG_BLK_DEV_INITRD
+
 static int __init rdinit_setup(char *str)
 {
 	unsigned int i;
@@ -342,6 +346,9 @@ static int __init rdinit_setup(char *str)
 }
 __setup("rdinit=", rdinit_setup);

+
+#endif
+
 #ifndef CONFIG_SMP

 #ifdef CONFIG_X86_LOCAL_APIC
@@ -850,12 +857,16 @@ static noinline int init_post(void)

 	current->signal->flags |= SIGNAL_UNKILLABLE;

+#ifdef CONFIG_BLK_DEV_INITRD
+
 	if (ramdisk_execute_command) {
 		run_init_process(ramdisk_execute_command);
 		printk(KERN_WARNING "Failed to execute %s\n",
 				ramdisk_execute_command);
 	}

+#endif
+
 	/*
 	 * We try each of these until one succeeds.
 	 *
@@ -909,6 +920,8 @@ static int __init kernel_init(void * unused)

 	do_basic_setup();

+#ifdef CONFIG_BLK_DEV_INITRD
+
 	/*
 	 * check if there is an early userspace init.  If yes, let it do all
 	 * the work
@@ -922,6 +935,8 @@ static int __init kernel_init(void * unused)
 		prepare_namespace();
 	}

+#endif
+
 	/*
 	 * Ok, we have completed the initial bootup, and
 	 * we're essentially up and running. Get rid of the

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
"Kernel Newbie Corner" column @ linux.com:          http://cli.gs/WG6WYX
========================================================================

                 reply	other threads:[~2009-07-11 10:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.0907110636290.2814@localhost \
    --to=rpjday@crashcourse.ca \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.