提交 e1a4db45 编写于 作者: R renwei

Merge branch 'master' of gitee.com:openharmony/startup_init_lite

Change-Id: I9ff0c097ffbea63d1cc919d4f039f27c1ebe3737
......@@ -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
}
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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" ]
}
......
......@@ -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"
}
......
......@@ -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
......
......@@ -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(
......
......@@ -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;
}
......
......@@ -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))
......
......@@ -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/",
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册