summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/builtins.cpp21
-rw-r--r--init/devices.cpp8
-rw-r--r--init/init.cpp3
-rw-r--r--init/ueventd.cpp4
4 files changed, 32 insertions, 4 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 9e5f9ff..bab30d7 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -401,6 +401,7 @@ int do_mount_all(int nargs, char **args)
int ret = -1;
int child_ret = -1;
int status;
+ char boot_mode[PROP_VALUE_MAX] = {0};
struct fstab *fstab;
if (nargs != 2) {
@@ -450,10 +451,13 @@ int do_mount_all(int nargs, char **args)
property_set("vold.decrypt", "trigger_default_encryption");
} else if (ret == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
property_set("ro.crypto.state", "unencrypted");
- /* If fs_mgr determined this is an unencrypted device, then trigger
- * that action.
+ /* If fs_mgr determined this is an unencrypted device and we are
+ * not booting into ffbm(fast factory boot mode),then trigger
+ * that action.
*/
- action_for_each_trigger("nonencrypted", action_add_queue_tail);
+ property_get("ro.bootmode", boot_mode);
+ if (strncmp(boot_mode, "ffbm", 4))
+ action_for_each_trigger("nonencrypted", action_add_queue_tail);
} else if (ret == FS_MGR_MNTALL_DEV_NEEDS_RECOVERY) {
/* Setup a wipe via recovery, and reboot into recovery */
ERROR("fs_mgr_mount_all suggested recovery, so wiping data via recovery.\n");
@@ -468,7 +472,9 @@ int do_mount_all(int nargs, char **args)
// Although encrypted, we have device key, so we do not need to
// do anything different from the nonencrypted case.
- action_for_each_trigger("nonencrypted", action_add_queue_tail);
+ property_get("ro.bootmode", boot_mode);
+ if (strncmp(boot_mode, "ffbm", 4))
+ action_for_each_trigger("nonencrypted", action_add_queue_tail);
} else if (ret == FS_MGR_MNTALL_DEV_NON_DEFAULT_FILE_ENCRYPTED) {
if (e4crypt_install_keyring()) {
return -1;
@@ -578,7 +584,14 @@ int do_powerctl(int nargs, char **args)
}
if (command[len] == ',') {
+ char prop_value[PROP_VALUE_MAX] = {0};
reboot_target = &command[len + 1];
+
+ if ((property_get("init.svc.recovery", prop_value) == 0) &&
+ (strncmp(reboot_target, "keys", 4) == 0)) {
+ ERROR("powerctl: permission denied\n");
+ return -EINVAL;
+ }
} else if (command[len] == '\0') {
reboot_target = "";
} else {
diff --git a/init/devices.cpp b/init/devices.cpp
index 4944cec..9151f06 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -47,6 +47,7 @@
#include "ueventd_parser.h"
#include "util.h"
#include "log.h"
+#include "property_service.h"
#define SYSFS_PREFIX "/sys"
static const char *firmware_dirs[] = { "/etc/firmware",
@@ -55,6 +56,8 @@ static const char *firmware_dirs[] = { "/etc/firmware",
extern struct selabel_handle *sehandle;
+extern char boot_device[PROP_VALUE_MAX];
+
static int device_fd = -1;
struct uevent {
@@ -518,6 +521,11 @@ static char **get_block_device_symlinks(struct uevent *uevent)
else
links[link_num] = NULL;
+ if (pdev && boot_device[0] != '\0' && strstr(device, boot_device)) {
+ /* Create bootdevice symlink for platform boot stroage device */
+ make_link_init(link_path, "/dev/block/bootdevice");
+ }
+
return links;
}
diff --git a/init/init.cpp b/init/init.cpp
index 93fe944..9eb2958 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -1099,6 +1099,9 @@ int main(int argc, char** argv) {
char bootmode[PROP_VALUE_MAX];
if (property_get("ro.bootmode", bootmode) > 0 && strcmp(bootmode, "charger") == 0) {
action_for_each_trigger("charger", action_add_queue_tail);
+ } else if (strncmp(bootmode, "ffbm", 4) == 0) {
+ KLOG_ERROR("Booting into ffbm mode\n");
+ action_for_each_trigger("ffbm", action_add_queue_tail);
} else {
action_for_each_trigger("late-init", action_add_queue_tail);
}
diff --git a/init/ueventd.cpp b/init/ueventd.cpp
index c63fdaa..2dd8b01 100644
--- a/init/ueventd.cpp
+++ b/init/ueventd.cpp
@@ -33,6 +33,8 @@
#include "ueventd_parser.h"
#include "property_service.h"
+char boot_device[PROP_VALUE_MAX];
+
int ueventd_main(int argc, char **argv)
{
/*
@@ -65,6 +67,8 @@ int ueventd_main(int argc, char **argv)
ueventd_parse_config_file("/ueventd.rc");
ueventd_parse_config_file(android::base::StringPrintf("/ueventd.%s.rc", hardware).c_str());
+ property_get("ro.boot.bootdevice", boot_device);
+
device_init();
pollfd ufd;