diff --git a/begetd.gni b/begetd.gni old mode 100644 new mode 100755 index 64e6f2051bad969bf1c36408a2d9455757532315..49c8dff94aa98994440283bc4bec7682c735c75c --- a/begetd.gni +++ b/begetd.gni @@ -14,4 +14,9 @@ declare_args() { param_feature_watcher = true param_test = false + + if (defined(product_name) && product_name == "rk3568") { + boot_kernel_extended_cmdline = + "hardware=rk3568 default_boot_device=fe310000.sdhci" + } } diff --git a/interfaces/innerkits/fs_manager/fstab_mount.c b/interfaces/innerkits/fs_manager/fstab_mount.c index 68c7f154be38b39e57161f11e808a13b1c07a49a..a55dfdaa7cc6b835adfe515d7c03415b62e6413c 100644 --- a/interfaces/innerkits/fs_manager/fstab_mount.c +++ b/interfaces/innerkits/fs_manager/fstab_mount.c @@ -276,9 +276,11 @@ static int Mount(const char *source, const char *target, const char *fsType, if (errno == EAGAIN) { BEGET_LOGE("Mount %s to %s failed. try again", source, target); continue; - } else { - break; } + if (errno == EBUSY) { + rc = 0; + } + break; } return rc; } diff --git a/services/init/init_config.c b/services/init/init_config.c index 732834f3df4513c9a990479af4c863597d804c15..e1ea9f50705d56c0148c6b42a1ea870c014c8d3e 100755 --- a/services/init/init_config.c +++ b/services/init/init_config.c @@ -87,6 +87,7 @@ void ReadConfig(void) if (InUpdaterMode() == 0) { ParseInitCfg(INIT_CONFIGURATION_FILE, NULL); ReadFileInDir(OTHER_CFG_PATH, ".cfg", ParseInitCfg, NULL); + ReadFileInDir("/vendor/etc/init", ".cfg", ParseInitCfg, NULL); } else { ReadFileInDir("/etc", ".cfg", ParseInitCfg, NULL); } diff --git a/services/init/main.c b/services/init/main.c index 0a442898942e1dfb4fb5f3b080c94b5d59195553..90b6e5837daf9bd5567f46669dbca8c44e5b8208 100755 --- a/services/init/main.c +++ b/services/init/main.c @@ -33,10 +33,11 @@ int main(int argc, char * const argv[]) INIT_LOGE("Process id error %d!", getpid()); return 0; } - LogInit(); + if (isSecondStage == 0) { SystemPrepare(); } + LogInit(); (void)AtlibInit(); SystemInit(); SystemExecuteRcs(); diff --git a/services/init/standard/init.c b/services/init/standard/init.c index a3a330f07c677eee823d98526bc32c71ee193270..3602402836c4f69d757cdd114298e8584d8f3708 100755 --- a/services/init/standard/init.c +++ b/services/init/standard/init.c @@ -121,8 +121,6 @@ void LogInit(void) } } -#ifndef DISABLE_INIT_TWO_STAGES - static char **GetRequiredDevices(Fstab fstab, int *requiredNum) { int num = 0; @@ -167,6 +165,9 @@ static void StartInitSecondStage(void) { const char *fstabFile = "/etc/fstab.required"; Fstab *fstab = NULL; + if (access(fstabFile, F_OK) != 0) { + fstabFile = "/system/etc/fstab.required"; + } INIT_ERROR_CHECK(access(fstabFile, F_OK) == 0, abort(), "Failed get fstab.required"); fstab = ReadFstabFromFile(fstabFile, false); INIT_ERROR_CHECK(fstab != NULL, abort(), "Read fstab file \" %s \" failed\n", fstabFile); @@ -186,10 +187,13 @@ static void StartInitSecondStage(void) // If mount required partitions failure. // There is no necessary to continue. // Just abort - INIT_LOGE("Mount requried partitions failed"); + INIT_LOGE("Mount requried partitions failed; please check fstab file"); + // Execute sh for debugging + execv("/bin/sh", NULL); abort(); } } +#ifndef DISABLE_INIT_TWO_STAGES SwitchRoot("/usr"); // Execute init second stage char * const args[] = { @@ -201,8 +205,8 @@ static void StartInitSecondStage(void) INIT_LOGE("Failed to exec \"/bin/init\", err = %d", errno); exit(-1); } -} #endif +} void SystemPrepare(void) { @@ -210,7 +214,6 @@ void SystemPrepare(void) // Make sure init log always output to /dev/kmsg. EnableDevKmsg(); CreateDeviceNode(); -#ifndef DISABLE_INIT_TWO_STAGES // Only ohos normal system support // two stages of init. // If we are in updater mode, only one stage of init, @@ -218,9 +221,6 @@ void SystemPrepare(void) if (InUpdaterMode() == 0) { StartInitSecondStage(); } -#else - INIT_LOGI("DISABLE_INIT_TWO_STAGES defined"); -#endif } void SystemLoadSelinux(void) diff --git a/services/param/BUILD.gn b/services/param/BUILD.gn index 0094d5e6e34f04a479417cc2080b5c02ef135f8f..5396c1b97540ba7fdbe8425a61e172fb2c0be989 100755 --- a/services/param/BUILD.gn +++ b/services/param/BUILD.gn @@ -10,6 +10,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import("//base/startup/init_lite/begetd.gni") import("//build/ohos.gni") declare_args() { @@ -46,6 +47,10 @@ ohos_static_library("param_service") { defines = [ "PARAM_SUPPORT_SAVE_PERSIST" ] + if (defined(boot_kernel_extended_cmdline)) { + defines += [ "BOOT_EXTENDED_CMDLINE=\"${boot_kernel_extended_cmdline}\"" ] + } + if (param_security == "selinux") { sources += [ "adapter/param_selinux.c" ] defines += [ "PARAM_SUPPORT_SELINUX" ] diff --git a/services/param/service/param_service.c b/services/param/service/param_service.c index f150f240295c492a32cba6839ffbe436fd228660..5e760dcf0551e125f244155a604d0efb969d3230 100755 --- a/services/param/service/param_service.c +++ b/services/param/service/param_service.c @@ -589,6 +589,7 @@ static int GetParamValueFromBuffer(const char *name, const char *buffer, char *v static int LoadParamFromCmdLine(void) { + int ret; static const char *cmdLines[] = { OHOS_BOOT"hardware", OHOS_BOOT"bootgroup", @@ -611,7 +612,14 @@ static int LoadParamFromCmdLine(void) return -1, "Failed to read file %s", PARAM_CMD_LINE); for (size_t i = 0; i < ARRAY_LENGTH(cmdLines); i++) { - int ret = GetParamValueFromBuffer(cmdLines[i], data, value, PARAM_CONST_VALUE_LEN_MAX); + #ifdef BOOT_EXTENDED_CMDLINE + ret = GetParamValueFromBuffer(cmdLines[i], BOOT_EXTENDED_CMDLINE, value, PARAM_CONST_VALUE_LEN_MAX); + if (ret != 0) { + ret = GetParamValueFromBuffer(cmdLines[i], data, value, PARAM_CONST_VALUE_LEN_MAX); + } + #else + ret = GetParamValueFromBuffer(cmdLines[i], data, value, PARAM_CONST_VALUE_LEN_MAX); + #endif if (ret == 0) { PARAM_LOGV("Add param from cmdline %s %s", cmdLines[i], value); ret = CheckParamName(cmdLines[i], 0); @@ -744,4 +752,4 @@ void DumpParametersAndTriggers(void) if (GetTriggerWorkSpace() != NULL) { DumpTrigger(GetTriggerWorkSpace()); } -} \ No newline at end of file +}