aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig57
-rw-r--r--init/do_mounts.c3
-rw-r--r--init/do_mounts_initrd.c1
-rw-r--r--init/initramfs.c12
-rw-r--r--init/main.c69
5 files changed, 55 insertions, 87 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 38416a199def..3b36a1d53656 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -214,6 +214,17 @@ config CPUSETS
214 214
215 Say N if unsure. 215 Say N if unsure.
216 216
217config RELAY
218 bool "Kernel->user space relay support (formerly relayfs)"
219 help
220 This option enables support for relay interface support in
221 certain file systems (such as debugfs).
222 It is designed to provide an efficient mechanism for tools and
223 facilities to relay large amounts of data from kernel space to
224 user space.
225
226 If unsure, say N.
227
217source "usr/Kconfig" 228source "usr/Kconfig"
218 229
219config UID16 230config UID16
@@ -354,43 +365,6 @@ config SHMEM
354 option replaces shmem and tmpfs with the much simpler ramfs code, 365 option replaces shmem and tmpfs with the much simpler ramfs code,
355 which may be appropriate on small systems without swap. 366 which may be appropriate on small systems without swap.
356 367
357config CC_ALIGN_FUNCTIONS
358 int "Function alignment" if EMBEDDED
359 default 0
360 help
361 Align the start of functions to the next power-of-two greater than n,
362 skipping up to n bytes. For instance, 32 aligns functions
363 to the next 32-byte boundary, but 24 would align to the next
364 32-byte boundary only if this can be done by skipping 23 bytes or less.
365 Zero means use compiler's default.
366
367config CC_ALIGN_LABELS
368 int "Label alignment" if EMBEDDED
369 default 0
370 help
371 Align all branch targets to a power-of-two boundary, skipping
372 up to n bytes like ALIGN_FUNCTIONS. This option can easily
373 make code slower, because it must insert dummy operations for
374 when the branch target is reached in the usual flow of the code.
375 Zero means use compiler's default.
376
377config CC_ALIGN_LOOPS
378 int "Loop alignment" if EMBEDDED
379 default 0
380 help
381 Align loops to a power-of-two boundary, skipping up to n bytes.
382 Zero means use compiler's default.
383
384config CC_ALIGN_JUMPS
385 int "Jump alignment" if EMBEDDED
386 default 0
387 help
388 Align branch targets to a power-of-two boundary, for branch
389 targets where the targets can only be reached by jumping,
390 skipping up to n bytes like ALIGN_FUNCTIONS. In this case,
391 no dummy operations need be executed.
392 Zero means use compiler's default.
393
394config SLAB 368config SLAB
395 default y 369 default y
396 bool "Use full SLAB allocator" if EMBEDDED 370 bool "Use full SLAB allocator" if EMBEDDED
@@ -459,15 +433,6 @@ config MODULE_FORCE_UNLOAD
459 rmmod). This is mainly for kernel developers and desperate users. 433 rmmod). This is mainly for kernel developers and desperate users.
460 If unsure, say N. 434 If unsure, say N.
461 435
462config OBSOLETE_MODPARM
463 bool
464 default y
465 depends on MODULES
466 help
467 You need this option to use module parameters on modules which
468 have not been converted to the new module parameter system yet.
469 If unsure, say Y.
470
471config MODVERSIONS 436config MODVERSIONS
472 bool "Module versioning support" 437 bool "Module versioning support"
473 depends on MODULES 438 depends on MODULES
diff --git a/init/do_mounts.c b/init/do_mounts.c
index b27c11064409..adb7cad3e6ee 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -19,11 +19,10 @@ extern int get_filesystem_list(char * buf);
19 19
20int __initdata rd_doload; /* 1 = load RAM disk, 0 = don't load */ 20int __initdata rd_doload; /* 1 = load RAM disk, 0 = don't load */
21 21
22int root_mountflags = MS_RDONLY | MS_VERBOSE; 22int root_mountflags = MS_RDONLY | MS_SILENT;
23char * __initdata root_device_name; 23char * __initdata root_device_name;
24static char __initdata saved_root_name[64]; 24static char __initdata saved_root_name[64];
25 25
26/* this is initialized in init/main.c */
27dev_t ROOT_DEV; 26dev_t ROOT_DEV;
28 27
29static int __init load_ramdisk(char *str) 28static int __init load_ramdisk(char *str)
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index a05cabd0fd10..405f9031af87 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -56,6 +56,7 @@ static void __init handle_initrd(void)
56 sys_chroot("."); 56 sys_chroot(".");
57 mount_devfs_fs (); 57 mount_devfs_fs ();
58 58
59 current->flags |= PF_NOFREEZE;
59 pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD); 60 pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
60 if (pid > 0) { 61 if (pid > 0) {
61 while (pid != sys_wait4(-1, NULL, 0, NULL)) 62 while (pid != sys_wait4(-1, NULL, 0, NULL))
diff --git a/init/initramfs.c b/init/initramfs.c
index 637344b05981..679d870d991b 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -506,6 +506,7 @@ void __init populate_rootfs(void)
506 panic(err); 506 panic(err);
507#ifdef CONFIG_BLK_DEV_INITRD 507#ifdef CONFIG_BLK_DEV_INITRD
508 if (initrd_start) { 508 if (initrd_start) {
509#ifdef CONFIG_BLK_DEV_RAM
509 int fd; 510 int fd;
510 printk(KERN_INFO "checking if image is initramfs..."); 511 printk(KERN_INFO "checking if image is initramfs...");
511 err = unpack_to_rootfs((char *)initrd_start, 512 err = unpack_to_rootfs((char *)initrd_start,
@@ -518,13 +519,22 @@ void __init populate_rootfs(void)
518 return; 519 return;
519 } 520 }
520 printk("it isn't (%s); looks like an initrd\n", err); 521 printk("it isn't (%s); looks like an initrd\n", err);
521 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 700); 522 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700);
522 if (fd >= 0) { 523 if (fd >= 0) {
523 sys_write(fd, (char *)initrd_start, 524 sys_write(fd, (char *)initrd_start,
524 initrd_end - initrd_start); 525 initrd_end - initrd_start);
525 sys_close(fd); 526 sys_close(fd);
526 free_initrd(); 527 free_initrd();
527 } 528 }
529#else
530 printk(KERN_INFO "Unpacking initramfs...");
531 err = unpack_to_rootfs((char *)initrd_start,
532 initrd_end - initrd_start, 0);
533 if (err)
534 panic(err);
535 printk(" done\n");
536 free_initrd();
537#endif
528 } 538 }
529#endif 539#endif
530} 540}
diff --git a/init/main.c b/init/main.c
index 4c194c47395f..4a2f0898dda1 100644
--- a/init/main.c
+++ b/init/main.c
@@ -306,8 +306,6 @@ static int __init rdinit_setup(char *str)
306} 306}
307__setup("rdinit=", rdinit_setup); 307__setup("rdinit=", rdinit_setup);
308 308
309extern void setup_arch(char **);
310
311#ifndef CONFIG_SMP 309#ifndef CONFIG_SMP
312 310
313#ifdef CONFIG_X86_LOCAL_APIC 311#ifdef CONFIG_X86_LOCAL_APIC
@@ -325,7 +323,7 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { }
325#else 323#else
326 324
327#ifdef __GENERIC_PER_CPU 325#ifdef __GENERIC_PER_CPU
328unsigned long __per_cpu_offset[NR_CPUS]; 326unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
329 327
330EXPORT_SYMBOL(__per_cpu_offset); 328EXPORT_SYMBOL(__per_cpu_offset);
331 329
@@ -333,6 +331,7 @@ static void __init setup_per_cpu_areas(void)
333{ 331{
334 unsigned long size, i; 332 unsigned long size, i;
335 char *ptr; 333 char *ptr;
334 unsigned long nr_possible_cpus = num_possible_cpus();
336 335
337 /* Copy section for each CPU (we discard the original) */ 336 /* Copy section for each CPU (we discard the original) */
338 size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); 337 size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
@@ -340,12 +339,12 @@ static void __init setup_per_cpu_areas(void)
340 if (size < PERCPU_ENOUGH_ROOM) 339 if (size < PERCPU_ENOUGH_ROOM)
341 size = PERCPU_ENOUGH_ROOM; 340 size = PERCPU_ENOUGH_ROOM;
342#endif 341#endif
342 ptr = alloc_bootmem(size * nr_possible_cpus);
343 343
344 ptr = alloc_bootmem(size * NR_CPUS); 344 for_each_possible_cpu(i) {
345
346 for (i = 0; i < NR_CPUS; i++, ptr += size) {
347 __per_cpu_offset[i] = ptr - __per_cpu_start; 345 __per_cpu_offset[i] = ptr - __per_cpu_start;
348 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 346 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
347 ptr += size;
349 } 348 }
350} 349}
351#endif /* !__GENERIC_PER_CPU */ 350#endif /* !__GENERIC_PER_CPU */
@@ -438,6 +437,15 @@ void __init parse_early_param(void)
438 * Activate the first processor. 437 * Activate the first processor.
439 */ 438 */
440 439
440static void __init boot_cpu_init(void)
441{
442 int cpu = smp_processor_id();
443 /* Mark the boot cpu "present", "online" etc for SMP and UP case */
444 cpu_set(cpu, cpu_online_map);
445 cpu_set(cpu, cpu_present_map);
446 cpu_set(cpu, cpu_possible_map);
447}
448
441asmlinkage void __init start_kernel(void) 449asmlinkage void __init start_kernel(void)
442{ 450{
443 char * command_line; 451 char * command_line;
@@ -447,17 +455,13 @@ asmlinkage void __init start_kernel(void)
447 * enable them 455 * enable them
448 */ 456 */
449 lock_kernel(); 457 lock_kernel();
458 boot_cpu_init();
450 page_address_init(); 459 page_address_init();
451 printk(KERN_NOTICE); 460 printk(KERN_NOTICE);
452 printk(linux_banner); 461 printk(linux_banner);
453 setup_arch(&command_line); 462 setup_arch(&command_line);
454 setup_per_cpu_areas(); 463 setup_per_cpu_areas();
455 464 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
456 /*
457 * Mark the boot cpu "online" so that it can call console drivers in
458 * printk() and can access its per-cpu storage.
459 */
460 smp_prepare_boot_cpu();
461 465
462 /* 466 /*
463 * Set up the scheduler prior starting any interrupts (such as the 467 * Set up the scheduler prior starting any interrupts (such as the
@@ -565,17 +569,23 @@ static void __init do_initcalls(void)
565 int count = preempt_count(); 569 int count = preempt_count();
566 570
567 for (call = __initcall_start; call < __initcall_end; call++) { 571 for (call = __initcall_start; call < __initcall_end; call++) {
568 char *msg; 572 char *msg = NULL;
573 char msgbuf[40];
574 int result;
569 575
570 if (initcall_debug) { 576 if (initcall_debug) {
571 printk(KERN_DEBUG "Calling initcall 0x%p", *call); 577 printk("Calling initcall 0x%p", *call);
572 print_fn_descriptor_symbol(": %s()", (unsigned long) *call); 578 print_fn_descriptor_symbol(": %s()",
579 (unsigned long) *call);
573 printk("\n"); 580 printk("\n");
574 } 581 }
575 582
576 (*call)(); 583 result = (*call)();
577 584
578 msg = NULL; 585 if (result && (result != -ENODEV || initcall_debug)) {
586 sprintf(msgbuf, "error code %d", result);
587 msg = msgbuf;
588 }
579 if (preempt_count() != count) { 589 if (preempt_count() != count) {
580 msg = "preemption imbalance"; 590 msg = "preemption imbalance";
581 preempt_count() = count; 591 preempt_count() = count;
@@ -585,8 +595,10 @@ static void __init do_initcalls(void)
585 local_irq_enable(); 595 local_irq_enable();
586 } 596 }
587 if (msg) { 597 if (msg) {
588 printk(KERN_WARNING "error in initcall at 0x%p: " 598 printk(KERN_WARNING "initcall at 0x%p", *call);
589 "returned with %s\n", *call, msg); 599 print_fn_descriptor_symbol(": %s()",
600 (unsigned long) *call);
601 printk(": returned with %s\n", msg);
590 } 602 }
591 } 603 }
592 604
@@ -633,24 +645,6 @@ static void run_init_process(char *init_filename)
633 execve(init_filename, argv_init, envp_init); 645 execve(init_filename, argv_init, envp_init);
634} 646}
635 647
636static inline void fixup_cpu_present_map(void)
637{
638#ifdef CONFIG_SMP
639 int i;
640
641 /*
642 * If arch is not hotplug ready and did not populate
643 * cpu_present_map, just make cpu_present_map same as cpu_possible_map
644 * for other cpu bringup code to function as normal. e.g smp_init() etc.
645 */
646 if (cpus_empty(cpu_present_map)) {
647 for_each_cpu(i) {
648 cpu_set(i, cpu_present_map);
649 }
650 }
651#endif
652}
653
654static int init(void * unused) 648static int init(void * unused)
655{ 649{
656 lock_kernel(); 650 lock_kernel();
@@ -672,7 +666,6 @@ static int init(void * unused)
672 666
673 do_pre_smp_initcalls(); 667 do_pre_smp_initcalls();
674 668
675 fixup_cpu_present_map();
676 smp_init(); 669 smp_init();
677 sched_init_smp(); 670 sched_init_smp();
678 671