aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig40
-rw-r--r--init/Makefile7
-rw-r--r--init/initramfs.c17
-rw-r--r--init/main.c34
-rw-r--r--init/noinitramfs.c52
5 files changed, 120 insertions, 30 deletions
diff --git a/init/Kconfig b/init/Kconfig
index a3f83e2c8250..ad33c979e0b3 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -192,6 +192,24 @@ config TASK_DELAY_ACCT
192 192
193 Say N if unsure. 193 Say N if unsure.
194 194
195config TASK_XACCT
196 bool "Enable extended accounting over taskstats (EXPERIMENTAL)"
197 depends on TASKSTATS
198 help
199 Collect extended task accounting data and send the data
200 to userland for processing over the taskstats interface.
201
202 Say N if unsure.
203
204config TASK_IO_ACCOUNTING
205 bool "Enable per-task storage I/O accounting (EXPERIMENTAL)"
206 depends on TASK_XACCT
207 help
208 Collect information on the number of bytes of storage I/O which this
209 task has caused.
210
211 Say N if unsure.
212
195config UTS_NS 213config UTS_NS
196 bool "UTS Namespaces" 214 bool "UTS Namespaces"
197 default n 215 default n
@@ -280,8 +298,12 @@ config RELAY
280 298
281 If unsure, say N. 299 If unsure, say N.
282 300
301if BLK_DEV_INITRD
302
283source "usr/Kconfig" 303source "usr/Kconfig"
284 304
305endif
306
285config CC_OPTIMIZE_FOR_SIZE 307config CC_OPTIMIZE_FOR_SIZE
286 bool "Optimize for size (Look out for broken compilers!)" 308 bool "Optimize for size (Look out for broken compilers!)"
287 default y 309 default y
@@ -295,24 +317,6 @@ config CC_OPTIMIZE_FOR_SIZE
295 317
296 If unsure, say N. 318 If unsure, say N.
297 319
298config TASK_XACCT
299 bool "Enable extended accounting over taskstats (EXPERIMENTAL)"
300 depends on TASKSTATS
301 help
302 Collect extended task accounting data and send the data
303 to userland for processing over the taskstats interface.
304
305 Say N if unsure.
306
307config TASK_IO_ACCOUNTING
308 bool "Enable per-task storage I/O accounting (EXPERIMENTAL)"
309 depends on TASK_XACCT
310 help
311 Collect information on the number of bytes of storage I/O which this
312 task has caused.
313
314 Say N if unsure.
315
316config SYSCTL 320config SYSCTL
317 bool 321 bool
318 322
diff --git a/init/Makefile b/init/Makefile
index 633a268d270d..0154aea1e52d 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -2,7 +2,12 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := main.o version.o mounts.o initramfs.o 5obj-y := main.o version.o mounts.o
6ifneq ($(CONFIG_BLK_DEV_INITRD),y)
7obj-y += noinitramfs.o
8else
9obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o
10endif
6obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o 11obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o
7 12
8mounts-y := do_mounts.o 13mounts-y := do_mounts.o
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}
diff --git a/init/main.c b/init/main.c
index 8b4a7d769162..4e9e92bb2b89 100644
--- a/init/main.c
+++ b/init/main.c
@@ -121,8 +121,12 @@ extern void time_init(void);
121void (*late_time_init)(void); 121void (*late_time_init)(void);
122extern void softirq_init(void); 122extern void softirq_init(void);
123 123
124/* Untouched command line (eg. for /proc) saved by arch-specific code. */ 124/* Untouched command line saved by arch-specific code. */
125char saved_command_line[COMMAND_LINE_SIZE]; 125char __initdata boot_command_line[COMMAND_LINE_SIZE];
126/* Untouched saved command line (eg. for /proc) */
127char *saved_command_line;
128/* Command line for parameter parsing */
129static char *static_command_line;
126 130
127static char *execute_command; 131static char *execute_command;
128static char *ramdisk_execute_command; 132static char *ramdisk_execute_command;
@@ -395,16 +399,25 @@ static void __init smp_init(void)
395 /* Any cleanup work */ 399 /* Any cleanup work */
396 printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus()); 400 printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
397 smp_cpus_done(max_cpus); 401 smp_cpus_done(max_cpus);
398#if 0
399 /* Get other processors into their bootup holding patterns. */
400
401 smp_commence();
402#endif
403} 402}
404 403
405#endif 404#endif
406 405
407/* 406/*
407 * We need to store the untouched command line for future reference.
408 * We also need to store the touched command line since the parameter
409 * parsing is performed in place, and we should allow a component to
410 * store reference of name/value for future reference.
411 */
412static void __init setup_command_line(char *command_line)
413{
414 saved_command_line = alloc_bootmem(strlen (boot_command_line)+1);
415 static_command_line = alloc_bootmem(strlen (command_line)+1);
416 strcpy (saved_command_line, boot_command_line);
417 strcpy (static_command_line, command_line);
418}
419
420/*
408 * We need to finalize in a non-__init function or else race conditions 421 * We need to finalize in a non-__init function or else race conditions
409 * between the root thread and the init thread may cause start_kernel to 422 * between the root thread and the init thread may cause start_kernel to
410 * be reaped by free_initmem before the root thread has proceeded to 423 * be reaped by free_initmem before the root thread has proceeded to
@@ -458,7 +471,7 @@ void __init parse_early_param(void)
458 return; 471 return;
459 472
460 /* All fall through to do_early_param. */ 473 /* All fall through to do_early_param. */
461 strlcpy(tmp_cmdline, saved_command_line, COMMAND_LINE_SIZE); 474 strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
462 parse_args("early options", tmp_cmdline, NULL, 0, do_early_param); 475 parse_args("early options", tmp_cmdline, NULL, 0, do_early_param);
463 done = 1; 476 done = 1;
464} 477}
@@ -508,6 +521,7 @@ asmlinkage void __init start_kernel(void)
508 printk(KERN_NOTICE); 521 printk(KERN_NOTICE);
509 printk(linux_banner); 522 printk(linux_banner);
510 setup_arch(&command_line); 523 setup_arch(&command_line);
524 setup_command_line(command_line);
511 unwind_setup(); 525 unwind_setup();
512 setup_per_cpu_areas(); 526 setup_per_cpu_areas();
513 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ 527 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
@@ -525,9 +539,9 @@ asmlinkage void __init start_kernel(void)
525 preempt_disable(); 539 preempt_disable();
526 build_all_zonelists(); 540 build_all_zonelists();
527 page_alloc_init(); 541 page_alloc_init();
528 printk(KERN_NOTICE "Kernel command line: %s\n", saved_command_line); 542 printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
529 parse_early_param(); 543 parse_early_param();
530 parse_args("Booting kernel", command_line, __start___param, 544 parse_args("Booting kernel", static_command_line, __start___param,
531 __stop___param - __start___param, 545 __stop___param - __start___param,
532 &unknown_bootoption); 546 &unknown_bootoption);
533 if (!irqs_disabled()) { 547 if (!irqs_disabled()) {
diff --git a/init/noinitramfs.c b/init/noinitramfs.c
new file mode 100644
index 000000000000..f4c1a3a1b8c5
--- /dev/null
+++ b/init/noinitramfs.c
@@ -0,0 +1,52 @@
1/*
2 * init/noinitramfs.c
3 *
4 * Copyright (C) 2006, NXP Semiconductors, All Rights Reserved
5 * Author: Jean-Paul Saman <jean-paul.saman@nxp.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/stat.h>
22#include <linux/kdev_t.h>
23#include <linux/syscalls.h>
24
25/*
26 * Create a simple rootfs that is similar to the default initramfs
27 */
28static int __init default_rootfs(void)
29{
30 int err;
31
32 err = sys_mkdir("/dev", 0755);
33 if (err < 0)
34 goto out;
35
36 err = sys_mknod((const char __user *) "/dev/console",
37 S_IFCHR | S_IRUSR | S_IWUSR,
38 new_encode_dev(MKDEV(5, 1)));
39 if (err < 0)
40 goto out;
41
42 err = sys_mkdir("/root", 0700);
43 if (err < 0)
44 goto out;
45
46 return 0;
47
48out:
49 printk(KERN_WARNING "Failed to create a rootfs\n");
50 return err;
51}
52rootfs_initcall(default_rootfs);