1 From 0384d086e31092628596af98b1e33fad586cef0a Mon Sep 17 00:00:00 2001
2 From: Arjan van de Ven <arjan@linux.intel.com>
3 Date: Sun, 20 Jul 2008 13:01:28 -0700
4 Subject: [PATCH] fastboot: retry mounting the root fs if we can't find init
6 currently we wait until all device init is done before trying to mount
7 the root fs, and to consequently execute init.
9 In preparation for relaxing the first delay, this patch adds a retry
10 attempt in case /sbin/init is not found. Before retrying, the code
11 will wait for all device init to complete.
13 While this patch by itself doesn't gain boot time yet (it needs follow on
14 patches), the alternative already is to panic()...
16 Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
18 --- a/init/main.c 2009-01-07 18:29:11.000000000 -0800
19 +++ b/init/main.c 2009-01-07 18:32:08.000000000 -0800
20 @@ -837,6 +837,7 @@ static void run_init_process(char *init_
22 static noinline int init_post(void)
24 + int retry_count = 1;
25 /* need to finish all async __init code before freeing the memory */
26 async_synchronize_full();
28 @@ -859,6 +860,8 @@ static noinline int init_post(void)
29 ramdisk_execute_command);
35 * We try each of these until one succeeds.
37 @@ -871,6 +874,23 @@ static noinline int init_post(void)
38 "defaults...\n", execute_command);
40 run_init_process("/sbin/init");
42 + if (retry_count > 0) {
45 + * We haven't found init yet... potentially because the device
46 + * is still being probed. We need to
47 + * - flush keventd and friends
48 + * - wait for the known devices to complete their probing
49 + * - try to mount the root fs again
51 + flush_scheduled_work();
52 + while (driver_probe_done() != 0)
54 + prepare_namespace();
58 run_init_process("/etc/init");
59 run_init_process("/bin/init");
60 run_init_process("/bin/sh");