summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:45:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:45:43 -0500
commit5cbb3d216e2041700231bcfc383ee5f8b7fc8b74 (patch)
treea738fa82dbcefa9bd283c08bc67f38827be63937 /init
parent9bc9ccd7db1c9f043f75380b5a5b94912046a60e (diff)
parent4e9b45a19241354daec281d7a785739829b52359 (diff)
Merge branch 'akpm' (patches from Andrew Morton)
Merge first patch-bomb from Andrew Morton: "Quite a lot of other stuff is banked up awaiting further next->mainline merging, but this batch contains: - Lots of random misc patches - OCFS2 - Most of MM - backlight updates - lib/ updates - printk updates - checkpatch updates - epoll tweaking - rtc updates - hfs - hfsplus - documentation - procfs - update gcov to gcc-4.7 format - IPC" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (269 commits) ipc, msg: fix message length check for negative values ipc/util.c: remove unnecessary work pending test devpts: plug the memory leak in kill_sb ./Makefile: export initial ramdisk compression config option init/Kconfig: add option to disable kernel compression drivers: w1: make w1_slave::flags long to avoid memory corruption drivers/w1/masters/ds1wm.cuse dev_get_platdata() drivers/memstick/core/ms_block.c: fix unreachable state in h_msb_read_page() drivers/memstick/core/mspro_block.c: fix attributes array allocation drivers/pps/clients/pps-gpio.c: remove redundant of_match_ptr kernel/panic.c: reduce 1 byte usage for print tainted buffer gcov: reuse kbasename helper kernel/gcov/fs.c: use pr_warn() kernel/module.c: use pr_foo() gcov: compile specific gcov implementation based on gcc version gcov: add support for gcc 4.7 gcov format gcov: move gcov structs definitions to a gcc version specific file kernel/taskstats.c: return -ENOMEM when alloc memory fails in add_del_listener() kernel/taskstats.c: add nla_nest_cancel() for failure processing between nla_nest_start() and nla_nest_end() kernel/sysctl_binary.c: use scnprintf() instead of snprintf() ...
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig8
-rw-r--r--init/do_mounts.c2
-rw-r--r--init/do_mounts_rd.c12
-rw-r--r--init/main.c40
4 files changed, 50 insertions, 12 deletions
diff --git a/init/Kconfig b/init/Kconfig
index bc8911fab28e..5496f307988e 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -118,7 +118,6 @@ config HAVE_KERNEL_LZ4
118choice 118choice
119 prompt "Kernel compression mode" 119 prompt "Kernel compression mode"
120 default KERNEL_GZIP 120 default KERNEL_GZIP
121 depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_XZ || HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4
122 help 121 help
123 The linux kernel is a kind of self-extracting executable. 122 The linux kernel is a kind of self-extracting executable.
124 Several compression algorithms are available, which differ 123 Several compression algorithms are available, which differ
@@ -137,6 +136,13 @@ choice
137 136
138 If in doubt, select 'gzip' 137 If in doubt, select 'gzip'
139 138
139config KERNEL_UNCOMPRESSED
140 bool "No compression"
141 help
142 No compression at all. The kernel is huge but the compression and
143 decompression times are zero.
144 This is usually not what you want.
145
140config KERNEL_GZIP 146config KERNEL_GZIP
141 bool "Gzip" 147 bool "Gzip"
142 depends on HAVE_KERNEL_GZIP 148 depends on HAVE_KERNEL_GZIP
diff --git a/init/do_mounts.c b/init/do_mounts.c
index a51cddc2ff8c..8e5addc45874 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -197,6 +197,8 @@ done:
197 * is a zero-filled hex representation of the 1-based partition number. 197 * is a zero-filled hex representation of the 1-based partition number.
198 * 7) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation to 198 * 7) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation to
199 * a partition with a known unique id. 199 * a partition with a known unique id.
200 * 8) <major>:<minor> major and minor number of the device separated by
201 * a colon.
200 * 202 *
201 * If name doesn't have fall into the categories above, we return (0,0). 203 * If name doesn't have fall into the categories above, we return (0,0).
202 * block_class is used to check if something is a disk name. If the disk 204 * block_class is used to check if something is a disk name. If the disk
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index 6be2879cca66..7c098ac9068a 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -57,6 +57,11 @@ static int __init crd_load(int in_fd, int out_fd, decompress_fn deco);
57 * cramfs 57 * cramfs
58 * squashfs 58 * squashfs
59 * gzip 59 * gzip
60 * bzip2
61 * lzma
62 * xz
63 * lzo
64 * lz4
60 */ 65 */
61static int __init 66static int __init
62identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) 67identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
@@ -342,6 +347,13 @@ static int __init crd_load(int in_fd, int out_fd, decompress_fn deco)
342 int result; 347 int result;
343 crd_infd = in_fd; 348 crd_infd = in_fd;
344 crd_outfd = out_fd; 349 crd_outfd = out_fd;
350
351 if (!deco) {
352 pr_emerg("Invalid ramdisk decompression routine. "
353 "Select appropriate config option.\n");
354 panic("Could not decompress initial ramdisk image.");
355 }
356
345 result = deco(NULL, 0, compr_fill, compr_flush, NULL, NULL, error); 357 result = deco(NULL, 0, compr_fill, compr_flush, NULL, NULL, error);
346 if (decompress_error) 358 if (decompress_error)
347 result = 1; 359 result = 1;
diff --git a/init/main.c b/init/main.c
index 379090fadac9..67ee8ef0a669 100644
--- a/init/main.c
+++ b/init/main.c
@@ -124,7 +124,6 @@ EXPORT_SYMBOL(system_state);
124extern void time_init(void); 124extern void time_init(void);
125/* Default late time init is NULL. archs can override this later. */ 125/* Default late time init is NULL. archs can override this later. */
126void (*__initdata late_time_init)(void); 126void (*__initdata late_time_init)(void);
127extern void softirq_init(void);
128 127
129/* Untouched command line saved by arch-specific code. */ 128/* Untouched command line saved by arch-specific code. */
130char __initdata boot_command_line[COMMAND_LINE_SIZE]; 129char __initdata boot_command_line[COMMAND_LINE_SIZE];
@@ -811,10 +810,26 @@ static int run_init_process(const char *init_filename)
811 (const char __user *const __user *)envp_init); 810 (const char __user *const __user *)envp_init);
812} 811}
813 812
813static int try_to_run_init_process(const char *init_filename)
814{
815 int ret;
816
817 ret = run_init_process(init_filename);
818
819 if (ret && ret != -ENOENT) {
820 pr_err("Starting init: %s exists but couldn't execute it (error %d)\n",
821 init_filename, ret);
822 }
823
824 return ret;
825}
826
814static noinline void __init kernel_init_freeable(void); 827static noinline void __init kernel_init_freeable(void);
815 828
816static int __ref kernel_init(void *unused) 829static int __ref kernel_init(void *unused)
817{ 830{
831 int ret;
832
818 kernel_init_freeable(); 833 kernel_init_freeable();
819 /* need to finish all async __init code before freeing the memory */ 834 /* need to finish all async __init code before freeing the memory */
820 async_synchronize_full(); 835 async_synchronize_full();
@@ -826,9 +841,11 @@ static int __ref kernel_init(void *unused)
826 flush_delayed_fput(); 841 flush_delayed_fput();
827 842
828 if (ramdisk_execute_command) { 843 if (ramdisk_execute_command) {
829 if (!run_init_process(ramdisk_execute_command)) 844 ret = run_init_process(ramdisk_execute_command);
845 if (!ret)
830 return 0; 846 return 0;
831 pr_err("Failed to execute %s\n", ramdisk_execute_command); 847 pr_err("Failed to execute %s (error %d)\n",
848 ramdisk_execute_command, ret);
832 } 849 }
833 850
834 /* 851 /*
@@ -838,18 +855,19 @@ static int __ref kernel_init(void *unused)
838 * trying to recover a really broken machine. 855 * trying to recover a really broken machine.
839 */ 856 */
840 if (execute_command) { 857 if (execute_command) {
841 if (!run_init_process(execute_command)) 858 ret = run_init_process(execute_command);
859 if (!ret)
842 return 0; 860 return 0;
843 pr_err("Failed to execute %s. Attempting defaults...\n", 861 pr_err("Failed to execute %s (error %d). Attempting defaults...\n",
844 execute_command); 862 execute_command, ret);
845 } 863 }
846 if (!run_init_process("/sbin/init") || 864 if (!try_to_run_init_process("/sbin/init") ||
847 !run_init_process("/etc/init") || 865 !try_to_run_init_process("/etc/init") ||
848 !run_init_process("/bin/init") || 866 !try_to_run_init_process("/bin/init") ||
849 !run_init_process("/bin/sh")) 867 !try_to_run_init_process("/bin/sh"))
850 return 0; 868 return 0;
851 869
852 panic("No init found. Try passing init= option to kernel. " 870 panic("No working init found. Try passing init= option to kernel. "
853 "See Linux Documentation/init.txt for guidance."); 871 "See Linux Documentation/init.txt for guidance.");
854} 872}
855 873