Loading init/builtins.cpp +25 −12 Original line number Diff line number Diff line Loading @@ -418,20 +418,32 @@ static int wipe_data_via_recovery() { while (1) { pause(); } // never reached } static void import_late() { /* Imports .rc files from the specified paths. Default ones are applied if none is given. * * start_index: index of the first path in the args list */ static void import_late(const std::vector<std::string>& args, size_t start_index) { Parser& parser = Parser::GetInstance(); if (args.size() <= start_index) { // Use the default set if no path is given static const std::vector<std::string> init_directories = { "/system/etc/init", "/vendor/etc/init", "/odm/etc/init" }; Parser& parser = Parser::GetInstance(); for (const auto& dir : init_directories) { parser.ParseConfig(dir.c_str()); parser.ParseConfig(dir); } } else { for (size_t i = start_index; i < args.size(); ++i) { parser.ParseConfig(args[i]); } } } /* /* mount_all <fstab> [ <path> ]* * * This function might request a reboot, in which case it will * not return. */ Loading Loading @@ -478,7 +490,8 @@ static int do_mount_all(const std::vector<std::string>& args) { return -1; } import_late(); /* Paths of .rc files are specified at the 2nd argument and beyond */ import_late(args, 2); if (ret == FS_MGR_MNTALL_DEV_NEEDS_ENCRYPTION) { property_set("vold.decrypt", "trigger_encryption"); Loading Loading @@ -900,7 +913,7 @@ BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { {"load_system_props", {0, 0, do_load_system_props}}, {"loglevel", {1, 1, do_loglevel}}, {"mkdir", {1, 4, do_mkdir}}, {"mount_all", {1, 1, do_mount_all}}, {"mount_all", {1, kMax, do_mount_all}}, {"mount", {3, kMax, do_mount}}, {"powerctl", {1, 1, do_powerctl}}, {"restart", {1, 1, do_restart}}, Loading init/readme.txt +8 −3 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ The intention of these directories is as follows actions or daemons needed for motion sensor or other peripheral functionality. One may specify paths in the mount_all command line to have it import .rc files at the specified paths instead of the default ones described above. Actions ------- Loading Loading @@ -263,8 +265,10 @@ mkdir <path> [mode] [owner] [group] owned by the root user and root group. If provided, the mode, owner and group will be updated if the directory exists already. mount_all <fstab> Calls fs_mgr_mount_all on the given fs_mgr-format fstab. mount_all <fstab> [ <path> ]* Calls fs_mgr_mount_all on the given fs_mgr-format fstab and imports .rc files at the specified paths (e.g., on the partitions just mounted). Refer to the section of "Init .rc Files" for detail. mount <type> <device> <dir> [ <flag> ]* [<options>] Attempt to mount the named device at the directory <dir> Loading Loading @@ -358,7 +362,8 @@ import <path> There are only two times where the init executable imports .rc files, 1) When it imports /init.rc during initial boot 2) When it imports /{system,vendor,odm}/etc/init/ during mount_all 2) When it imports /{system,vendor,odm}/etc/init/ or .rc files at specified paths during mount_all Properties Loading Loading
init/builtins.cpp +25 −12 Original line number Diff line number Diff line Loading @@ -418,20 +418,32 @@ static int wipe_data_via_recovery() { while (1) { pause(); } // never reached } static void import_late() { /* Imports .rc files from the specified paths. Default ones are applied if none is given. * * start_index: index of the first path in the args list */ static void import_late(const std::vector<std::string>& args, size_t start_index) { Parser& parser = Parser::GetInstance(); if (args.size() <= start_index) { // Use the default set if no path is given static const std::vector<std::string> init_directories = { "/system/etc/init", "/vendor/etc/init", "/odm/etc/init" }; Parser& parser = Parser::GetInstance(); for (const auto& dir : init_directories) { parser.ParseConfig(dir.c_str()); parser.ParseConfig(dir); } } else { for (size_t i = start_index; i < args.size(); ++i) { parser.ParseConfig(args[i]); } } } /* /* mount_all <fstab> [ <path> ]* * * This function might request a reboot, in which case it will * not return. */ Loading Loading @@ -478,7 +490,8 @@ static int do_mount_all(const std::vector<std::string>& args) { return -1; } import_late(); /* Paths of .rc files are specified at the 2nd argument and beyond */ import_late(args, 2); if (ret == FS_MGR_MNTALL_DEV_NEEDS_ENCRYPTION) { property_set("vold.decrypt", "trigger_encryption"); Loading Loading @@ -900,7 +913,7 @@ BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { {"load_system_props", {0, 0, do_load_system_props}}, {"loglevel", {1, 1, do_loglevel}}, {"mkdir", {1, 4, do_mkdir}}, {"mount_all", {1, 1, do_mount_all}}, {"mount_all", {1, kMax, do_mount_all}}, {"mount", {3, kMax, do_mount}}, {"powerctl", {1, 1, do_powerctl}}, {"restart", {1, 1, do_restart}}, Loading
init/readme.txt +8 −3 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ The intention of these directories is as follows actions or daemons needed for motion sensor or other peripheral functionality. One may specify paths in the mount_all command line to have it import .rc files at the specified paths instead of the default ones described above. Actions ------- Loading Loading @@ -263,8 +265,10 @@ mkdir <path> [mode] [owner] [group] owned by the root user and root group. If provided, the mode, owner and group will be updated if the directory exists already. mount_all <fstab> Calls fs_mgr_mount_all on the given fs_mgr-format fstab. mount_all <fstab> [ <path> ]* Calls fs_mgr_mount_all on the given fs_mgr-format fstab and imports .rc files at the specified paths (e.g., on the partitions just mounted). Refer to the section of "Init .rc Files" for detail. mount <type> <device> <dir> [ <flag> ]* [<options>] Attempt to mount the named device at the directory <dir> Loading Loading @@ -358,7 +362,8 @@ import <path> There are only two times where the init executable imports .rc files, 1) When it imports /init.rc during initial boot 2) When it imports /{system,vendor,odm}/etc/init/ during mount_all 2) When it imports /{system,vendor,odm}/etc/init/ or .rc files at specified paths during mount_all Properties Loading