mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-24 00:30:12 +00:00
删除build gn中的product name
Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
parent
5756aa46ce
commit
fa59dadda5
@ -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
|
||||
}
|
||||
|
@ -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" ]
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
|
@ -106,10 +106,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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user