提交 a9cde315 编写于 作者: C chengjinsong2

支持L0产品自己申请内存以及默认内存

Signed-off-by: Nchengjinsong2 <chengjinsong2@huawei.com>
上级 1cb444dd
......@@ -25,5 +25,8 @@ declare_args() {
enable_ohos_startup_init_feature_loader = false
config_ohos_startup_init_lite_data_path = ""
# config memory size for liteos-m
config_ohos_startup_init_lite_memory_size = 5120
# boot_kernel_extended_cmdline for extend cmdline
}
......@@ -125,6 +125,17 @@ if (defined(ohos_lite)) {
module_install_dir = "etc/param"
}
ohos_prebuilt_para("ohos.startup.para") {
source = "//base/startup/init/services/etc/param/ohos.startup.para"
install_images = [
"system",
"updater",
]
part_name = "init"
subsystem_name = "startup"
module_install_dir = "etc/param"
}
ohos_prebuilt_para("ohos.para.dac") {
source = "//base/startup/init/services/etc/param/ohos.para.dac"
install_images = [
......@@ -232,6 +243,7 @@ if (defined(ohos_lite)) {
":ohos.para",
":ohos.para.dac",
":ohos.para.size",
":ohos.startup.para",
":ohos_const.para",
":passwd",
":syscap.json",
......
......@@ -20,8 +20,6 @@ const.debuggable=1
const.build.characteristics=default
const.product.model=ohos
const.product.name="OpenHarmony 3.2"
persist.sys.usb.config=hdc
persist.init.bootevent.enable=true
const.sandbox=enable
const.product.devicetype=default
const.software.model=default
......
# Copyright (c) 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.
persist.sys.usb.config=hdc
persist.init.bootevent.enable=true
\ No newline at end of file
......@@ -69,6 +69,10 @@ if (defined(ohos_lite)) {
"PARAMWORKSPACE_NEED_MUTEX",
]
}
if (defined(config_ohos_startup_init_lite_memory_size)) {
defines +=
[ "PARAM_WORKSPACE_MAX=${config_ohos_startup_init_lite_memory_size}" ]
}
}
} else {
if (use_musl) {
......
......@@ -59,7 +59,9 @@ extern "C" {
#ifdef STARTUP_INIT_TEST
#define PARAM_WORKSPACE_MAX (1024 * 50)
#else
#define PARAM_WORKSPACE_MAX (1024 * 30)
#ifndef PARAM_WORKSPACE_MAX
#define PARAM_WORKSPACE_MAX (1024 * 5)
#endif
#endif
#define PARAM_WORKSPACE_SMALL PARAM_WORKSPACE_MAX
#define PARAM_WORKSPACE_DEF PARAM_WORKSPACE_MAX
......
......@@ -103,6 +103,10 @@ static_library("param_init_lite") {
"PARAM_SUPPORT_CYCLE_CHECK",
]
}
if (defined(config_ohos_startup_init_lite_memory_size)) {
defines +=
[ "PARAM_WORKSPACE_MAX=${config_ohos_startup_init_lite_memory_size}" ]
}
}
static_library("param_client_lite") {
......@@ -148,5 +152,9 @@ static_library("param_client_lite") {
include_dirs += [ "$root_out_dir/gen/init" ]
defines += [ "PARAM_LOAD_CFG_FROM_CODE" ]
}
if (defined(config_ohos_startup_init_lite_memory_size)) {
defines +=
[ "PARAM_WORKSPACE_MAX=${config_ohos_startup_init_lite_memory_size}" ]
}
}
}
......@@ -215,13 +215,26 @@ INIT_LOCAL_API int ParamMutexDelete(ParamMutex *mutex)
#endif
#ifdef __LITEOS_M__
__attribute__((weak)) void* GetSysParamMem(uint32_t spaceSize)
{
return malloc(spaceSize);
}
__attribute__((weak)) void FreeSysParamMem(void *mem)
{
if (mem == NULL) {
return;
}
free(mem);
}
INIT_LOCAL_API void *GetSharedMem(const char *fileName, MemHandle *handle, uint32_t spaceSize, int readOnly)
{
PARAM_CHECK(spaceSize <= PARAM_WORKSPACE_MAX, return NULL, "Invalid spaceSize %u", spaceSize);
UNUSED(fileName);
UNUSED(handle);
UNUSED(readOnly);
return (void *)malloc(spaceSize);
return GetSysParamMem(spaceSize);
}
INIT_LOCAL_API void FreeSharedMem(const MemHandle *handle, void *mem, uint32_t dataSize)
......@@ -229,7 +242,7 @@ INIT_LOCAL_API void FreeSharedMem(const MemHandle *handle, void *mem, uint32_t d
PARAM_CHECK(mem != NULL && handle != NULL, return, "Invalid mem or handle");
UNUSED(handle);
UNUSED(dataSize);
free(mem);
FreeSysParamMem(mem);
}
INIT_LOCAL_API void paramMutexEnvInit(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册