Skip to content

Commit

Permalink
init: Support for emmc boot and init.target.rc
Browse files Browse the repository at this point in the history
 * Via CodeAurora

Change-Id: Iaa9ed356574f364d8061e8941cffc3d458efc603
  • Loading branch information
hyperb1iss committed Jul 24, 2013
1 parent 879bd75 commit 42e62ab
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ static time_t process_needs_restart;

static const char *ENV[32];

static unsigned emmc_boot = 0;

/* add_environment - add "key=value" to the current environment */
int add_environment(const char *key, const char *val)
{
Expand Down Expand Up @@ -611,6 +613,10 @@ static void import_kernel_nv(char *name, int for_emulator)

if (!strcmp(name,"qemu")) {
strlcpy(qemu, value, sizeof(qemu));
} else if (!strcmp(name,"androidboot.emmc")) {
if (!strcmp(value,"true")) {
emmc_boot = 1;
}
} else if (!strncmp(name, "androidboot.", 12) && name_len > 12) {
const char *boot_prop_name = name + 12;
char prop[PROP_NAME_MAX];
Expand Down Expand Up @@ -659,6 +665,7 @@ static void export_kernel_boot_props(void)

snprintf(tmp, PROP_VALUE_MAX, "%d", revision);
property_set("ro.revision", tmp);
property_set("ro.emmc",emmc_boot ? "1" : "0");

/* TODO: these are obsolete. We should delete them */
if (!strcmp(bootmode,"factory"))
Expand Down Expand Up @@ -890,6 +897,12 @@ int main(int argc, char **argv)
INFO("reading config file\n");
init_parse_config_file("/init.rc");

/* Check for a target specific initialisation file and read if present */
if (access("/init.target.rc", R_OK) == 0) {
INFO("Reading target specific config file");
init_parse_config_file("/init.target.rc");
}

action_for_each_trigger("early-init", action_add_queue_tail);

queue_builtin_action(wait_for_coldboot_done_action, "wait_for_coldboot_done");
Expand All @@ -902,7 +915,11 @@ int main(int argc, char **argv)
/* skip mounting filesystems in charger mode */
if (!is_charger) {
action_for_each_trigger("early-fs", action_add_queue_tail);
if(emmc_boot) {
action_for_each_trigger("emmc-fs", action_add_queue_tail);
} else {
action_for_each_trigger("fs", action_add_queue_tail);
}
action_for_each_trigger("post-fs", action_add_queue_tail);
action_for_each_trigger("post-fs-data", action_add_queue_tail);
}
Expand Down

0 comments on commit 42e62ab

Please sign in to comment.