aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig18
-rw-r--r--init/do_mounts.c4
-rw-r--r--init/do_mounts_md.c41
-rw-r--r--init/do_mounts_rd.c2
-rw-r--r--init/initramfs.c53
-rw-r--r--init/main.c9
6 files changed, 102 insertions, 25 deletions
diff --git a/init/Kconfig b/init/Kconfig
index c11da38837e5..5ceff3249a2d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -713,6 +713,14 @@ config SHMEM
713 option replaces shmem and tmpfs with the much simpler ramfs code, 713 option replaces shmem and tmpfs with the much simpler ramfs code,
714 which may be appropriate on small systems without swap. 714 which may be appropriate on small systems without swap.
715 715
716config AIO
717 bool "Enable AIO support" if EMBEDDED
718 default y
719 help
720 This option enables POSIX asynchronous I/O which may by used
721 by some high performance threaded applications. Disabling
722 this option saves about 7k.
723
716config VM_EVENT_COUNTERS 724config VM_EVENT_COUNTERS
717 default y 725 default y
718 bool "Enable VM event counters for /proc/vmstat" if EMBEDDED 726 bool "Enable VM event counters for /proc/vmstat" if EMBEDDED
@@ -779,16 +787,6 @@ config MARKERS
779 787
780source "arch/Kconfig" 788source "arch/Kconfig"
781 789
782config PROC_PAGE_MONITOR
783 default y
784 depends on PROC_FS && MMU
785 bool "Enable /proc page monitoring" if EMBEDDED
786 help
787 Various /proc files exist to monitor process memory utilization:
788 /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap,
789 /proc/kpagecount, and /proc/kpageflags. Disabling these
790 interfaces will reduce the size of the kernel by approximately 4kb.
791
792endmenu # General setup 790endmenu # General setup
793 791
794config HAVE_GENERIC_DMA_COHERENT 792config HAVE_GENERIC_DMA_COHERENT
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 3715feb8446d..d055b1914c3d 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -263,6 +263,10 @@ retry:
263 printk("Please append a correct \"root=\" boot option; here are the available partitions:\n"); 263 printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");
264 264
265 printk_all_partitions(); 265 printk_all_partitions();
266#ifdef CONFIG_DEBUG_BLOCK_EXT_DEVT
267 printk("DEBUG_BLOCK_EXT_DEVT is enabled, you need to specify "
268 "explicit textual name for \"root=\" boot option.\n");
269#endif
266 panic("VFS: Unable to mount root fs on %s", b); 270 panic("VFS: Unable to mount root fs on %s", b);
267 } 271 }
268 272
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 693d24694a6c..4c87ee1fe5d3 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -1,5 +1,6 @@
1 1
2#include <linux/raid/md.h> 2#include <linux/raid/md.h>
3#include <linux/delay.h>
3 4
4#include "do_mounts.h" 5#include "do_mounts.h"
5 6
@@ -12,7 +13,12 @@
12 * The code for that is here. 13 * The code for that is here.
13 */ 14 */
14 15
15static int __initdata raid_noautodetect, raid_autopart; 16#ifdef CONFIG_MD_AUTODETECT
17static int __initdata raid_noautodetect;
18#else
19static int __initdata raid_noautodetect=1;
20#endif
21static int __initdata raid_autopart;
16 22
17static struct { 23static struct {
18 int minor; 24 int minor;
@@ -252,6 +258,8 @@ static int __init raid_setup(char *str)
252 258
253 if (!strncmp(str, "noautodetect", wlen)) 259 if (!strncmp(str, "noautodetect", wlen))
254 raid_noautodetect = 1; 260 raid_noautodetect = 1;
261 if (!strncmp(str, "autodetect", wlen))
262 raid_noautodetect = 0;
255 if (strncmp(str, "partitionable", wlen)==0) 263 if (strncmp(str, "partitionable", wlen)==0)
256 raid_autopart = 1; 264 raid_autopart = 1;
257 if (strncmp(str, "part", wlen)==0) 265 if (strncmp(str, "part", wlen)==0)
@@ -264,17 +272,32 @@ static int __init raid_setup(char *str)
264__setup("raid=", raid_setup); 272__setup("raid=", raid_setup);
265__setup("md=", md_setup); 273__setup("md=", md_setup);
266 274
275static void autodetect_raid(void)
276{
277 int fd;
278
279 /*
280 * Since we don't want to detect and use half a raid array, we need to
281 * wait for the known devices to complete their probing
282 */
283 printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n");
284 printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n");
285 while (driver_probe_done() < 0)
286 msleep(100);
287 fd = sys_open("/dev/md0", 0, 0);
288 if (fd >= 0) {
289 sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
290 sys_close(fd);
291 }
292}
293
267void __init md_run_setup(void) 294void __init md_run_setup(void)
268{ 295{
269 create_dev("/dev/md0", MKDEV(MD_MAJOR, 0)); 296 create_dev("/dev/md0", MKDEV(MD_MAJOR, 0));
297
270 if (raid_noautodetect) 298 if (raid_noautodetect)
271 printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n"); 299 printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=autodetect will force)\n");
272 else { 300 else
273 int fd = sys_open("/dev/md0", 0, 0); 301 autodetect_raid();
274 if (fd >= 0) {
275 sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
276 sys_close(fd);
277 }
278 }
279 md_setup_drive(); 302 md_setup_drive();
280} 303}
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index fedef93b586f..a7c748fa977a 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -71,7 +71,7 @@ identify_ramdisk_image(int fd, int start_block)
71 sys_read(fd, buf, size); 71 sys_read(fd, buf, size);
72 72
73 /* 73 /*
74 * If it matches the gzip magic numbers, return -1 74 * If it matches the gzip magic numbers, return 0
75 */ 75 */
76 if (buf[0] == 037 && ((buf[1] == 0213) || (buf[1] == 0236))) { 76 if (buf[0] == 037 && ((buf[1] == 0213) || (buf[1] == 0236))) {
77 printk(KERN_NOTICE 77 printk(KERN_NOTICE
diff --git a/init/initramfs.c b/init/initramfs.c
index 644fc01ad5f0..4f5ba75aaa7c 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -6,6 +6,7 @@
6#include <linux/delay.h> 6#include <linux/delay.h>
7#include <linux/string.h> 7#include <linux/string.h>
8#include <linux/syscalls.h> 8#include <linux/syscalls.h>
9#include <linux/utime.h>
9 10
10static __initdata char *message; 11static __initdata char *message;
11static void __init error(char *x) 12static void __init error(char *x)
@@ -72,6 +73,49 @@ static void __init free_hash(void)
72 } 73 }
73} 74}
74 75
76static long __init do_utime(char __user *filename, time_t mtime)
77{
78 struct timespec t[2];
79
80 t[0].tv_sec = mtime;
81 t[0].tv_nsec = 0;
82 t[1].tv_sec = mtime;
83 t[1].tv_nsec = 0;
84
85 return do_utimes(AT_FDCWD, filename, t, AT_SYMLINK_NOFOLLOW);
86}
87
88static __initdata LIST_HEAD(dir_list);
89struct dir_entry {
90 struct list_head list;
91 char *name;
92 time_t mtime;
93};
94
95static void __init dir_add(const char *name, time_t mtime)
96{
97 struct dir_entry *de = kmalloc(sizeof(struct dir_entry), GFP_KERNEL);
98 if (!de)
99 panic("can't allocate dir_entry buffer");
100 INIT_LIST_HEAD(&de->list);
101 de->name = kstrdup(name, GFP_KERNEL);
102 de->mtime = mtime;
103 list_add(&de->list, &dir_list);
104}
105
106static void __init dir_utime(void)
107{
108 struct dir_entry *de, *tmp;
109 list_for_each_entry_safe(de, tmp, &dir_list, list) {
110 list_del(&de->list);
111 do_utime(de->name, de->mtime);
112 kfree(de->name);
113 kfree(de);
114 }
115}
116
117static __initdata time_t mtime;
118
75/* cpio header parsing */ 119/* cpio header parsing */
76 120
77static __initdata unsigned long ino, major, minor, nlink; 121static __initdata unsigned long ino, major, minor, nlink;
@@ -97,6 +141,7 @@ static void __init parse_header(char *s)
97 uid = parsed[2]; 141 uid = parsed[2];
98 gid = parsed[3]; 142 gid = parsed[3];
99 nlink = parsed[4]; 143 nlink = parsed[4];
144 mtime = parsed[5];
100 body_len = parsed[6]; 145 body_len = parsed[6];
101 major = parsed[7]; 146 major = parsed[7];
102 minor = parsed[8]; 147 minor = parsed[8];
@@ -130,6 +175,7 @@ static inline void __init eat(unsigned n)
130 count -= n; 175 count -= n;
131} 176}
132 177
178static __initdata char *vcollected;
133static __initdata char *collected; 179static __initdata char *collected;
134static __initdata int remains; 180static __initdata int remains;
135static __initdata char *collect; 181static __initdata char *collect;
@@ -271,6 +317,7 @@ static int __init do_name(void)
271 if (wfd >= 0) { 317 if (wfd >= 0) {
272 sys_fchown(wfd, uid, gid); 318 sys_fchown(wfd, uid, gid);
273 sys_fchmod(wfd, mode); 319 sys_fchmod(wfd, mode);
320 vcollected = kstrdup(collected, GFP_KERNEL);
274 state = CopyFile; 321 state = CopyFile;
275 } 322 }
276 } 323 }
@@ -278,12 +325,14 @@ static int __init do_name(void)
278 sys_mkdir(collected, mode); 325 sys_mkdir(collected, mode);
279 sys_chown(collected, uid, gid); 326 sys_chown(collected, uid, gid);
280 sys_chmod(collected, mode); 327 sys_chmod(collected, mode);
328 dir_add(collected, mtime);
281 } else if (S_ISBLK(mode) || S_ISCHR(mode) || 329 } else if (S_ISBLK(mode) || S_ISCHR(mode) ||
282 S_ISFIFO(mode) || S_ISSOCK(mode)) { 330 S_ISFIFO(mode) || S_ISSOCK(mode)) {
283 if (maybe_link() == 0) { 331 if (maybe_link() == 0) {
284 sys_mknod(collected, mode, rdev); 332 sys_mknod(collected, mode, rdev);
285 sys_chown(collected, uid, gid); 333 sys_chown(collected, uid, gid);
286 sys_chmod(collected, mode); 334 sys_chmod(collected, mode);
335 do_utime(collected, mtime);
287 } 336 }
288 } 337 }
289 return 0; 338 return 0;
@@ -294,6 +343,8 @@ static int __init do_copy(void)
294 if (count >= body_len) { 343 if (count >= body_len) {
295 sys_write(wfd, victim, body_len); 344 sys_write(wfd, victim, body_len);
296 sys_close(wfd); 345 sys_close(wfd);
346 do_utime(vcollected, mtime);
347 kfree(vcollected);
297 eat(body_len); 348 eat(body_len);
298 state = SkipIt; 349 state = SkipIt;
299 return 0; 350 return 0;
@@ -311,6 +362,7 @@ static int __init do_symlink(void)
311 clean_path(collected, 0); 362 clean_path(collected, 0);
312 sys_symlink(collected + N_ALIGN(name_len), collected); 363 sys_symlink(collected + N_ALIGN(name_len), collected);
313 sys_lchown(collected, uid, gid); 364 sys_lchown(collected, uid, gid);
365 do_utime(collected, mtime);
314 state = SkipIt; 366 state = SkipIt;
315 next_state = Reset; 367 next_state = Reset;
316 return 0; 368 return 0;
@@ -466,6 +518,7 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
466 buf += inptr; 518 buf += inptr;
467 len -= inptr; 519 len -= inptr;
468 } 520 }
521 dir_utime();
469 kfree(window); 522 kfree(window);
470 kfree(name_buf); 523 kfree(name_buf);
471 kfree(symlink_buf); 524 kfree(symlink_buf);
diff --git a/init/main.c b/init/main.c
index f6f7042331dc..27f6bf6108e9 100644
--- a/init/main.c
+++ b/init/main.c
@@ -708,7 +708,7 @@ int do_one_initcall(initcall_t fn)
708 int result; 708 int result;
709 709
710 if (initcall_debug) { 710 if (initcall_debug) {
711 print_fn_descriptor_symbol("calling %s\n", fn); 711 printk("calling %pF @ %i\n", fn, task_pid_nr(current));
712 t0 = ktime_get(); 712 t0 = ktime_get();
713 } 713 }
714 714
@@ -718,8 +718,8 @@ int do_one_initcall(initcall_t fn)
718 t1 = ktime_get(); 718 t1 = ktime_get();
719 delta = ktime_sub(t1, t0); 719 delta = ktime_sub(t1, t0);
720 720
721 print_fn_descriptor_symbol("initcall %s", fn); 721 printk("initcall %pF returned %d after %Ld msecs\n",
722 printk(" returned %d after %Ld msecs\n", result, 722 fn, result,
723 (unsigned long long) delta.tv64 >> 20); 723 (unsigned long long) delta.tv64 >> 20);
724 } 724 }
725 725
@@ -737,8 +737,7 @@ int do_one_initcall(initcall_t fn)
737 local_irq_enable(); 737 local_irq_enable();
738 } 738 }
739 if (msgbuf[0]) { 739 if (msgbuf[0]) {
740 print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn); 740 printk("initcall %pF returned with %s\n", fn, msgbuf);
741 printk(" returned with %s\n", msgbuf);
742 } 741 }
743 742
744 return result; 743 return result;