summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2011-12-16 14:18:06 -0800
committerDima Zavin <dima@android.com>2011-12-20 13:46:17 -0800
commit65a8360795ef9dcdd9a3e6fdacf5a16eacf6f4e1 (patch)
tree98fd53e3e670e3a877ce038471a0f8672441d4f8
parent9f39cde52784e0dd6438b51c9117fe533d464f9b (diff)
downloadsystem_core-65a8360795ef9dcdd9a3e6fdacf5a16eacf6f4e1.zip
system_core-65a8360795ef9dcdd9a3e6fdacf5a16eacf6f4e1.tar.gz
system_core-65a8360795ef9dcdd9a3e6fdacf5a16eacf6f4e1.tar.bz2
init: initialize property area early at boot
The property service is still started later, but the property area and the initial boot properties are initialized before the init.rc file is processed. This allows init.rc files to have access to boot properties during parsing. Change-Id: Iae9ed1093c821831a864b39ae6bc697e62b94757 Signed-off-by: Dima Zavin <dima@android.com>
-rwxr-xr-xinit/init.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/init/init.c b/init/init.c
index d10ca47..6aa9179 100755
--- a/init/init.c
+++ b/init/init.c
@@ -518,17 +518,6 @@ static int wait_for_coldboot_done_action(int nargs, char **args)
return ret;
}
-static int property_init_action(int nargs, char **args)
-{
- bool load_defaults = true;
-
- INFO("property init\n");
- if (!strcmp(bootmode, "charger"))
- load_defaults = false;
- property_init(load_defaults);
- return 0;
-}
-
static int keychord_init_action(int nargs, char **args)
{
keychord_init();
@@ -576,7 +565,7 @@ static int console_init_action(int nargs, char **args)
return 0;
}
-static int set_init_properties_action(int nargs, char **args)
+static int set_init_properties(void)
{
char tmp[PROP_VALUE_MAX];
@@ -668,6 +657,7 @@ int main(int argc, char **argv)
int property_set_fd_init = 0;
int signal_fd_init = 0;
int keychord_fd_init = 0;
+ bool is_charger = false;
if (!strcmp(basename(argv[0]), "ueventd"))
return ueventd_main(argc, argv);
@@ -702,30 +692,34 @@ int main(int argc, char **argv)
open_devnull_stdio();
klog_init();
- INFO("reading config file\n");
- init_parse_config_file("/init.rc");
-
- /* pull the kernel commandline and ramdisk properties file in */
- import_kernel_cmdline(0, import_kernel_nv);
/* don't expose the raw commandline to nonpriv processes */
chmod("/proc/cmdline", 0440);
+ /* pull the kernel commandline and ramdisk properties file in */
+ import_kernel_cmdline(0, import_kernel_nv);
get_hardware_name(hardware, &revision);
+
+ is_charger = !strcmp(bootmode, "charger");
+
+ INFO("property init\n");
+ property_init(!is_charger);
+ set_init_properties();
+
+ INFO("reading config file\n");
+ init_parse_config_file("/init.rc");
snprintf(tmp, sizeof(tmp), "/init.%s.rc", hardware);
init_parse_config_file(tmp);
action_for_each_trigger("early-init", action_add_queue_tail);
queue_builtin_action(wait_for_coldboot_done_action, "wait_for_coldboot_done");
- queue_builtin_action(property_init_action, "property_init");
queue_builtin_action(keychord_init_action, "keychord_init");
queue_builtin_action(console_init_action, "console_init");
- queue_builtin_action(set_init_properties_action, "set_init_properties");
/* execute all the boot actions to get us started */
action_for_each_trigger("init", action_add_queue_tail);
/* skip mounting filesystems in charger mode */
- if (strcmp(bootmode, "charger") != 0) {
+ if (!is_charger) {
action_for_each_trigger("early-fs", action_add_queue_tail);
action_for_each_trigger("fs", action_add_queue_tail);
action_for_each_trigger("post-fs", action_add_queue_tail);
@@ -736,7 +730,7 @@ int main(int argc, char **argv)
queue_builtin_action(signal_init_action, "signal_init");
queue_builtin_action(check_startup_action, "check_startup");
- if (!strcmp(bootmode, "charger")) {
+ if (is_charger) {
action_for_each_trigger("charger", action_add_queue_tail);
} else {
action_for_each_trigger("early-boot", action_add_queue_tail);