未验证 提交 273ac06d 编写于 作者: O openharmony_ci 提交者: Gitee

!1516 解耦产品配置hal层依赖

Merge pull request !1516 from zk/cherry-pick-1668408571
#
# Copyright (c) 2020-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
static_library("hal_sys_param") {
sources = [ "hal_sys_param.c" ]
include_dirs = [ "//base/startup/init/interfaces/hals" ]
defines = [
"INCREMENTAL_VERSION=\"${ohos_version}\"",
"BUILD_TYPE=\"${ohos_build_type}\"",
"BUILD_USER=\"${ohos_build_user}\"",
"BUILD_TIME=\"${ohos_build_time}\"",
"BUILD_HOST=\"${ohos_build_host}\"",
"BUILD_ROOTHASH=\"${ohos_build_roothash}\"",
]
}
/*
* Copyright (c) 2020-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
#include "hal_sys_param.h"
static const char OHOS_ABI_LIST[] = {"****"};
static const char OHOS_BOOTLOADER_VERSION[] = {"bootloader"};
static const char OHOS_BRAND[] = {"****"};
static const char OHOS_DEVICE_TYPE[] = {"****"};
static const char OHOS_DISPLAY_VERSION[] = {"OpenHarmony 3.1"};
static const char OHOS_HARDWARE_MODEL[] = {"****"};
static const char OHOS_HARDWARE_PROFILE[] = {"aout:true,display:true"};
static const char OHOS_MARKET_NAME[] = {"****"};
static const char OHOS_MANUFACTURE[] = {"****"};
static const char OHOS_PRODUCT_MODEL[] = {"****"};
static const char OHOS_PRODUCT_SERIES[] = {"****"};
static const char OHOS_SERIAL[] = {"****"}; // provided by OEM.
static const char OHOS_SOFTWARE_MODEL[] = {"****"};
static const int OHOS_FIRST_API_VERSION = 1;
__attribute__((weak)) const char* HalGetDeviceType(void)
{
return OHOS_DEVICE_TYPE;
}
__attribute__((weak)) const char* HalGetManufacture(void)
{
return OHOS_MANUFACTURE;
}
__attribute__((weak)) const char* HalGetBrand(void)
{
return OHOS_BRAND;
}
__attribute__((weak)) const char* HalGetMarketName(void)
{
return OHOS_MARKET_NAME;
}
__attribute__((weak)) const char* HalGetProductSeries(void)
{
return OHOS_PRODUCT_SERIES;
}
__attribute__((weak)) const char* HalGetProductModel(void)
{
return OHOS_PRODUCT_MODEL;
}
__attribute__((weak)) const char* HalGetSoftwareModel(void)
{
return OHOS_SOFTWARE_MODEL;
}
__attribute__((weak)) const char* HalGetHardwareModel(void)
{
return OHOS_HARDWARE_MODEL;
}
__attribute__((weak)) const char* HalGetHardwareProfile(void)
{
return OHOS_HARDWARE_PROFILE;
}
__attribute__((weak)) const char* HalGetSerial(void)
{
return OHOS_SERIAL;
}
__attribute__((weak)) const char* HalGetBootloaderVersion(void)
{
return OHOS_BOOTLOADER_VERSION;
}
__attribute__((weak)) const char* HalGetAbiList(void)
{
return OHOS_ABI_LIST;
}
__attribute__((weak)) const char* HalGetDisplayVersion(void)
{
return OHOS_DISPLAY_VERSION;
}
__attribute__((weak)) const char* HalGetIncrementalVersion(void)
{
return INCREMENTAL_VERSION;
}
__attribute__((weak)) const char* HalGetBuildType(void)
{
return BUILD_TYPE;
}
__attribute__((weak)) const char* HalGetBuildUser(void)
{
return BUILD_USER;
}
__attribute__((weak)) const char* HalGetBuildHost(void)
{
return BUILD_HOST;
}
__attribute__((weak)) const char* HalGetBuildTime(void)
{
return BUILD_TIME;
}
__attribute__((weak)) int HalGetFirstApiVersion(void)
{
return OHOS_FIRST_API_VERSION;
}
\ No newline at end of file
#
# Copyright (c) 2020-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
static_library("static_hal_token") {
sources = [ "hal_token.c" ]
include_dirs = [
"//base/startup/init/interfaces/hals",
"//commonlibrary/utils_lite/include",
]
deps = []
}
/*
* Copyright (c) 2020-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
#include "hal_token.h"
#include "ohos_errno.h"
#include "ohos_types.h"
__attribute__((weak)) static int OEMReadToken(char* token, unsigned int len)
{
// OEM need add here, read token from device
(void)(token);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMWriteToken(const char* token, unsigned int len)
{
// OEM need add here, write token to device
(void)(token);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMGetAcKey(char* acKey, unsigned int len)
{
// OEM need add here, get AcKey
(void)(acKey);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMGetProdId(char* productId, unsigned int len)
{
// OEM need add here, get ProdId
(void)(productId);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMGetProdKey(char* productKey, unsigned int len)
{
// OEM need add here, get ProdKey
(void)(productKey);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) int HalReadToken(char* token, unsigned int len)
{
if (token == NULL) {
return EC_FAILURE;
}
return OEMReadToken(token, len);
}
__attribute__((weak)) int HalWriteToken(const char* token, unsigned int len)
{
if (token == NULL) {
return EC_FAILURE;
}
return OEMWriteToken(token, len);
}
__attribute__((weak)) int HalGetAcKey(char* acKey, unsigned int len)
{
if (acKey == NULL) {
return EC_FAILURE;
}
return OEMGetAcKey(acKey, len);
}
__attribute__((weak)) int HalGetProdId(char* productId, unsigned int len)
{
if (productId == NULL) {
return EC_FAILURE;
}
return OEMGetProdId(productId, len);
}
__attribute__((weak)) int HalGetProdKey(char* productKey, unsigned int len)
{
if (productKey == NULL) {
return EC_FAILURE;
}
return OEMGetProdKey(productKey, len);
}
\ No newline at end of file
......@@ -111,7 +111,17 @@ if (defined(ohos_lite)) {
sources = []
if (enable_ohos_startup_init_feature_begetctl_liteos) {
deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ]
PRODUCT_HAL_SYSPARAM_PATH =
rebase_path("//${ohos_product_adapter_dir}/utils/sys_param")
cmd = "if [ -f ${PRODUCT_HAL_SYSPARAM_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
PRODUCT_HAL_SYSPARAM_EXISTS =
exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
if (PRODUCT_HAL_SYSPARAM_EXISTS) {
deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ]
}
deps += [
"//base/startup/init/interfaces/hals/utils/sys_param:hal_sys_param",
]
defines += [ "LITEOS_SUPPORT" ]
sources += syspara_sources
} else {
......
......@@ -44,8 +44,16 @@ if (ohos_kernel_type == "liteos_m") {
"//base/startup/init/interfaces/innerkits/token",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
]
deps = [ "$ohos_product_adapter_dir/utils/token:hal_token_static" ]
PRODUCT_HAL_TOKEN_PATH =
rebase_path("//${ohos_product_adapter_dir}/utils/token")
cmd = "if [ -f ${PRODUCT_HAL_TOKEN_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
PRODUCT_HAL_TOKEN_EXISTS =
exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
if (PRODUCT_HAL_TOKEN_EXISTS) {
deps += [ "$ohos_product_adapter_dir/utils/token:hal_token_static" ]
}
deps +=
[ "//base/startup/init/interfaces/hals/utils/token:static_hal_token" ]
}
}
......
......@@ -142,10 +142,19 @@ if (defined(ohos_lite)) {
# add cfg.h
if (enable_ohos_startup_init_feature_begetctl_liteos) {
PRODUCT_HAL_SYSPARAM_PATH =
rebase_path("//${ohos_product_adapter_dir}/utils/sys_param")
cmd = "if [ -f ${PRODUCT_HAL_SYSPARAM_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
PRODUCT_HAL_SYSPARAM_EXISTS =
exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
if (PRODUCT_HAL_SYSPARAM_EXISTS) {
deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ]
}
deps += [
"$ohos_product_adapter_dir/utils/sys_param:hal_sysparam",
"//base/startup/init/services/param/liteos:lite_ohos_param_to",
"//base/startup/init/interfaces/hals/utils/sys_param:hal_sys_param",
]
deps +=
[ "//base/startup/init/services/param/liteos:lite_ohos_param_to" ]
include_dirs += [ "$root_out_dir/gen/init" ]
defines += [ "PARAM_LOAD_CFG_FROM_CODE" ]
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册