diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn index 3caa62f5c874fba245cf78f83898719010912d6f..d60b4d71148637bfaa40cb918349f1d47b28a352 100755 --- a/interfaces/innerkits/BUILD.gn +++ b/interfaces/innerkits/BUILD.gn @@ -297,4 +297,43 @@ if (defined(ohos_lite)) { part_name = "init" } + + ohos_static_library("libbegetutil_static") { + sources = [ "//base/startup/init_lite/services/log/init_log.c" ] + sources += syspara_sources + sources += [ "syspara/param_wrapper.cpp" ] + + defines = [ + "INIT_AGENT", + "INIT_FILE", + "_GNU_SOURCE", + ] + if (target_cpu == "arm64") { + defines += [ "SUPPORT_64BIT" ] + } + + include_dirs = [ + "./include", + "//third_party/bounds_checking_function/include", + "//base/startup/init_lite/services/include", + "//base/startup/init_lite/services/include/param", + "//base/startup/init_lite/services/param/include", + "//base/startup/init_lite/interfaces/innerkits/include", + "//base/startup/init_lite/interfaces/innerkits/include/syspara", + "//base/startup/init_lite/interfaces/innerkits/syspara", + ] + deps = [ + "//base/startup/init_lite/services/loopevent:loopevent", + "//base/startup/init_lite/services/param:param_client", + "//base/startup/init_lite/services/utils:libinit_tools", + "//base/startup/init_lite/services/utils:libinit_utils", + "//third_party/bounds_checking_function:libsec_shared", + "//third_party/openssl:libcrypto_shared", + ] + external_deps = [ + "hilog_native:libhilog_base", + "utils_base:utils", + ] + part_name = "init" + } } diff --git a/interfaces/innerkits/syspara/parameter.c b/interfaces/innerkits/syspara/parameter.c index 02d1b23e077b50cee272e2890723e58f62c2717e..5d37cd6f3350f171468016a8ff72037b7ea4acaa 100755 --- a/interfaces/innerkits/syspara/parameter.c +++ b/interfaces/innerkits/syspara/parameter.c @@ -231,8 +231,13 @@ const char *GetBuildTime(void) const char *GetSerial(void) { - static const char *ohos_serial = NULL; - return GetProperty("ohos.boot.sn", &ohos_serial); + static char ohos_serial[PARAM_VALUE_LEN_MAX] = {0}; + uint32_t len = PARAM_VALUE_LEN_MAX; + int ret = SystemGetParameter("ohos.boot.sn", ohos_serial, &len); + if (ret != 0) { + return NULL; + } + return ohos_serial; } int GetDevUdid(char *udid, int size)