diff --git a/begetd.gni b/begetd.gni index cd1a134c4fece50734fa86beb875d00b33ad9d4b..920fc32d0018e7bf593635322bcfb935089b85f1 100755 --- a/begetd.gni +++ b/begetd.gni @@ -21,9 +21,8 @@ declare_args() { enable_ohos_startup_init_feature_begetctl_liteos = false enable_ohos_startup_init_lite_use_thirdparty_mbedtls = true enable_ohos_startup_init_lite_use_posix_file_api = false + enable_ohos_startup_init_feature_loader = false config_ohos_startup_init_lite_data_path = "" - if (defined(product_name) && product_name == "rk3568") { - boot_kernel_extended_cmdline = - "hardware=rk3568 default_boot_device=fe310000.sdhci" - } + + # boot_kernel_extended_cmdline for extend cmdline } diff --git a/interfaces/innerkits/init_module_engine/init_modulemgr.c b/interfaces/innerkits/init_module_engine/init_modulemgr.c index 015f0306a70661b0a2a10da87df9a24dc5364211..787582f337f5d54a14db3c4dda2c3e2939dfea95 100644 --- a/interfaces/innerkits/init_module_engine/init_modulemgr.c +++ b/interfaces/innerkits/init_module_engine/init_modulemgr.c @@ -68,7 +68,7 @@ static int ModuleMgrCmdInstall(int id, const char *name, int argc, const char ** static int ModuleMgrCmdUninstall(int id, const char *name, int argc, const char **argv) { INIT_ERROR_CHECK(argv != NULL && argc >= 1, return -1, "Invalid install parameter"); - ModuleMgrUninstall(NULL, argv[0]); + ModuleMgrUninstall(defaultModuleMgr, argv[0]); return 0; } diff --git a/interfaces/innerkits/modulemgr/modulemgr.c b/interfaces/innerkits/modulemgr/modulemgr.c index 1d3c8f2e11b81dbfe4cb8b7c349f55e14e0049b7..057d1497d89da5d6fc865210b49df5b1eeddb2ba 100644 --- a/interfaces/innerkits/modulemgr/modulemgr.c +++ b/interfaces/innerkits/modulemgr/modulemgr.c @@ -109,7 +109,7 @@ static void *moduleInstall(MODULE_ITEM *module, int argc, const char *argv[]) return NULL; } } else { - if (snprintf_s(path, sizeof(path), sizeof(path) - 1, "/system/" MODULE_LIB_NAME "/%s/%s" MODULE_SUFFIX_D, + if (snprintf_s(path, sizeof(path), sizeof(path) - 1, "/system/" MODULE_LIB_NAME "/%s/lib%s" MODULE_SUFFIX_D, module->moduleMgr->name, module->name) < 0) { return NULL; } diff --git a/services/begetctl/BUILD.gn b/services/begetctl/BUILD.gn index 915707a94bef5df1438edabb55e0ad564b884a40..6b3d876f708da7f4e157df00c34ae4c4ba6cd4aa 100755 --- a/services/begetctl/BUILD.gn +++ b/services/begetctl/BUILD.gn @@ -73,7 +73,7 @@ if (defined(ohos_lite)) { defines = [ "_GNU_SOURCE" ] - if (defined(product_name) && product_name == "rk3568") { + if (enable_ohos_startup_init_feature_loader) { defines += [ "PRODUCT_RK" ] } diff --git a/services/etc/BUILD.gn b/services/etc/BUILD.gn index a58dd716ac74be988e0158755556d2f1c040617f..9f3405bacd986b9673dedb9451e3bef0db0f855b 100755 --- a/services/etc/BUILD.gn +++ b/services/etc/BUILD.gn @@ -157,19 +157,18 @@ if (defined(ohos_lite)) { } ohos_prebuilt_etc("syscap.para") { - source = - "${preloader_output_dir}/${product_name}/system/etc/param/syscap.para" + source = "${preloader_output_dir}/system/etc/param/syscap.para" module_install_dir = "etc/param/" part_name = "init" } ohos_prebuilt_etc("syscap.json") { - source = "${preloader_output_dir}/${product_name}/system/etc/syscap.json" + source = "${preloader_output_dir}/system/etc/syscap.json" part_name = "init" } ohos_prebuilt_etc("systemcapability.json") { - source = "${preloader_output_dir}/${product_name}/system/etc/SystemCapability.json" + source = "${preloader_output_dir}/system/etc/SystemCapability.json" part_name = "init" } diff --git a/services/etc/param/ohos.para b/services/etc/param/ohos.para index 48ee5b7ce09ad75253d7221427568fcf15e32be9..0ee6d422425ca06a0f717c85aecd1ce7f5bc49fb 100755 --- a/services/etc/param/ohos.para +++ b/services/etc/param/ohos.para @@ -30,7 +30,7 @@ const.build.product=default const.product.hardwareversion=default const.product.bootloader.version=bootloader const.product.cpu.abilist=default -const.product.software.version=OpenHarmony 3.2.5.1 +const.product.software.version=OpenHarmony 3.2.5.2 const.product.incremental.version=default const.product.firstapiversion=1 const.product.build.type=default diff --git a/services/init/standard/BUILD.gn b/services/init/standard/BUILD.gn index d001aaee939bf8155d4c1347505b8931c2d8e78f..66bdfee60ca93cb9fc8151132ff5e2a8bcf361ec 100644 --- a/services/init/standard/BUILD.gn +++ b/services/init/standard/BUILD.gn @@ -121,7 +121,7 @@ ohos_executable("init") { defines += [ "ASAN_DETECTOR" ] } - if (defined(product_name) && product_name == "rk3568") { + if (enable_ohos_startup_init_feature_loader) { defines += [ "PRODUCT_RK" ] } version_script = get_label_info( diff --git a/services/modules/bootchart/bootchart_static.c b/services/modules/bootchart/bootchart_static.c index bc1e9414ec357eeb2f09ec3322b3a409cf273270..69046bf5479cab6bcb0592814cb71dd27d98022e 100644 --- a/services/modules/bootchart/bootchart_static.c +++ b/services/modules/bootchart/bootchart_static.c @@ -26,7 +26,7 @@ static int bootchartEarlyHook(const HOOK_INFO *info, void *cookie) return 0; } - InitModuleMgrInstall("libbootchart"); + InitModuleMgrInstall("bootchart"); PLUGIN_LOGI("bootchart enabled."); return 0; } diff --git a/services/param/include/param_utils.h b/services/param/include/param_utils.h index ce901682525086b47f2a87e021e2b9ae6f340a08..e2fbecdb3d409e713a202d784d3eb0d051570474 100644 --- a/services/param/include/param_utils.h +++ b/services/param/include/param_utils.h @@ -45,7 +45,9 @@ typedef struct cmdLineInfo { #define FILENAME_LEN_MAX 255 #define MS_UNIT 1000 +#ifndef UNUSED #define UNUSED(x) (void)(x) +#endif #define PARAM_ALIGN(len) (((len) + 0x03) & (~0x03)) #define PARAM_ENTRY(ptr, type, member) (type *)((char *)(ptr)-offsetof(type, member)) diff --git a/services/param/linux/BUILD.gn b/services/param/linux/BUILD.gn index 33f9576ae76e282623938484bae8acd59520fb3c..8324cc7faedee8542b9b0fea0ccb16bc80aa3d3d 100755 --- a/services/param/linux/BUILD.gn +++ b/services/param/linux/BUILD.gn @@ -108,10 +108,6 @@ if (defined(ohos_lite)) { defines += [ "BOOT_EXTENDED_CMDLINE=\"${boot_kernel_extended_cmdline}\"" ] } - if ("${product_name}" == "m40") { - defines += [ "USE_MTK_EMMC" ] - } - if (build_selinux) { include_dirs += [ "//third_party/selinux/libselinux/include/", diff --git a/services/param/manager/param_server.c b/services/param/manager/param_server.c index e75a0c8285cc30c722e54971b818c872d7d513ce..5074e783337461fed509c7e003b82ab7b200b293 100755 --- a/services/param/manager/param_server.c +++ b/services/param/manager/param_server.c @@ -58,34 +58,10 @@ static int CommonDealFun(const char *name, const char *value, int res) return ret; } -static int SnDealFun(const char *name, const char *value, int res) +static int ReadSnFromFile(const char *name, const char *file) { -#ifdef USE_MTK_EMMC - static const char SN_FILE[] = {"/proc/bootdevice/cid"}; -#else - static const char SN_FILE[] = {"/sys/block/mmcblk0/device/cid"}; -#endif - int ret = CheckParamName(name, 0); - PARAM_CHECK(ret == 0, return ret, "Invalid name %s", name); - char *data = NULL; - if (res != 0) { // if cmdline not set sn or set sn value is null,read sn from default file - data = ReadFileData(SN_FILE); - if (data == NULL) { - PARAM_LOGE("Error, Read sn from default file failed!"); - return -1; - } - } else if (value[0] == '/') { - data = ReadFileData(value); - if (data == NULL) { - PARAM_LOGE("Error, Read sn from cmdline file failed!"); - return -1; - } - } else { - PARAM_LOGV("**** name %s, value %s", name, value); - ret = WriteParam(name, value, NULL, 0); - PARAM_CHECK(ret == 0, return ret, "Failed to write param %s %s", name, value); - return ret; - } + char *data = ReadFileData(file); + PARAM_CHECK(data != NULL, return -1, "Read sn from %s file failed!", file); int index = 0; for (size_t i = 0; i < strlen(data); i++) { @@ -100,11 +76,38 @@ static int SnDealFun(const char *name, const char *value, int res) } data[index] = '\0'; PARAM_LOGV("**** name %s, value %s", name, data); - ret = WriteParam(name, data, NULL, 0); - PARAM_CHECK(ret == 0, free(data); - return ret, "Failed to write param %s %s", name, data); + int ret = WriteParam(name, data, NULL, 0); free(data); + PARAM_CHECK(ret == 0, return ret, "Failed to write param %s %s", name, data); + return ret; +} +static int SnDealFun(const char *name, const char *value, int res) +{ + const char *snFileList [] = { + "/sys/block/mmcblk0/device/cid", + "/proc/bootdevice/cid" + }; + int ret = CheckParamName(name, 0); + PARAM_CHECK(ret == 0, return ret, "Invalid name %s", name); + if (value != NULL && res == 0 && value[0] != '/') { + PARAM_LOGV("**** name %s, value %s", name, value); + ret = WriteParam(name, value, NULL, 0); + PARAM_CHECK(ret == 0, return ret, "Failed to write param %s %s", name, value); + return ret; + } + if (value != NULL && value[0] == '/') { + ret = ReadSnFromFile(name, value); + if (ret == 0) { + return ret; + } + } + for (size_t i = 0; i < ARRAY_LENGTH(snFileList); i++) { + ret = ReadSnFromFile(name, snFileList[i]); + if (ret == 0) { + break; + } + } return ret; }