提交 55d8b6f6 编写于 作者: Z zhoushilin

delete os_dump

Signed-off-by: Nzhoushilin <zhoushilin1@huawei.com>
上级 487f50c9
......@@ -14,10 +14,7 @@
import("//build/lite/ndk/ndk.gni")
group("utils") {
deps = [
"os_dump:utils_os_dump",
"//foundation/distributeddatamgr/appdatamgr/frameworks/native/kv_store:kv_store",
]
deps = [ "//foundation/distributeddatamgr/appdatamgr/frameworks/native/kv_store:kv_store" ]
if (ohos_kernel_type == "liteos_m") {
deps += [ "file:file" ]
......
......@@ -84,7 +84,6 @@ utils/native/lite/ # Root directory
│ └── src # KV store source file
├── memory
│ └── include # Memory pool management APIs
├── os_dump # System attribute dumping
└── timer_task # Timer implementation
```
......@@ -140,20 +139,6 @@ utils/native/lite/ # Root directory
```
- **System attribute dumping**
LiteOS Cortex-M kernel: Run the following command over the serial port to dump the current system parameters:
```
AT+SYSPARA
```
LiteOS Cortex-A kernel: Run the **os\_dump** command in the **bin** directory to dump the current system parameters:
```
./bin/os_dump syspara
```
## Repositories Involved<a name="section4571352889"></a>
......
......@@ -84,7 +84,6 @@ utils/native/lite/ # 公共基础库根目录
│ └── src # KV存储源文件
├── memory
│ └── include # 内存池管理接口
├── os_dump # Dump系统属性
└── timer_task # Timer实现
```
......@@ -140,20 +139,6 @@ utils/native/lite/ # 公共基础库根目录
```
- **dump系统属性**
LiteOS-M内核:在串口执行如下命令,即可打印当前系统参数
```
AT+SYSPARA
```
LiteOS-A内核:在bin路径下执行os\_dump,即可打印当前系统参数
```
./bin/os_dump syspara
```
## 涉及仓<a name="section4571352889"></a>
......
......@@ -30,7 +30,7 @@
]
},
"build": {
"sub_component": [ "//utils/native/lite/os_dump:utils_os_dump" ],
"sub_component": [],
"inner_kits": [],
"test": []
}
......
# Copyright (c) 2020 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.
import("//build/lite/config/component/lite_component.gni")
lite_component("utils_os_dump") {
features = []
if (ohos_kernel_type == "liteos_a") {
features += [ ":os_dump" ]
}
if (ohos_kernel_type == "liteos_m") {
features += [ ":dump_static" ]
}
}
if (ohos_kernel_type == "liteos_a") {
executable("os_dump") {
sources = [
"dump_syspara.c",
"os_dump.c",
]
include_dirs = [
"./",
"//base/startup/syspara_lite/interfaces/kits",
]
deps = [ "//base/startup/syspara_lite/frameworks/parameter/src:sysparam" ]
}
}
if (ohos_kernel_type == "liteos_m") {
static_library("dump_static") {
sources = [ "dump_syspara.c" ]
include_dirs = [
"//base/startup/syspara_lite/interfaces/kits",
"//base/iot_hardware/interfaces/kits/wifiiot_lite",
]
deps = [ "//base/startup/syspara_lite/frameworks/parameter/src:sysparam" ]
}
}
{
"name": "@openharmony/os_dump",
"version": "3.1.0",
"license": "Apache License 2.0",
"description": "Providing commands for dumping system property.",
"publishAs": "code-segment",
"segment": {
"destPath": "utils/native/lite/os_dump"
},
"dirs": {},
"scripts": {},
"author": {},
"repository": "",
"component": {
"name": "os_dump",
"subsystem": "utils",
"features": [],
"adapted_system_type": [
"mini",
"small"
],
"rom": "3.7KB",
"ram": "~4.75KB",
"deps": {
"thrid_party": [
"bounds_checking_function"
],
"kernel_special": {},
"board_special": {},
"components": [
"syspara_lite",
"iot_controller"
]
},
"build": {
"sub_component": [],
"inner_kits": [],
"test": []
}
}
}
/*
* Copyright (c) 2020 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 "dump_syspara.h"
#include <stdio.h>
#include <stdlib.h>
#include "securec.h"
#include "parameter.h"
#if defined(__LITEOS_RISCV__)
#include "wifiiot_at.h"
#endif
#define API_VERSION_LEN 10
static const char* GetSdkApiLevel(void)
{
static char sdkApiVersion[API_VERSION_LEN] = {0};
int sdkApi = GetSdkApiVersion();
sprintf_s(sdkApiVersion, API_VERSION_LEN, "%d", sdkApi);
return (const char*)sdkApiVersion;
}
static const char* GetFirstApiLevel(void)
{
static char firstApiVersion[API_VERSION_LEN] = {0};
int firstApi = GetFirstApiVersion();
sprintf_s(firstApiVersion, API_VERSION_LEN, "%d", firstApi);
return (const char*)firstApiVersion;
}
static const SysParaInfoItem SYSPARA_LIST[] = {
{"DeviceType", GetDeviceType},
{"Manufacture", GetManufacture},
{"Brand", GetBrand},
{"MarketName", GetMarketName},
{"ProductSeries", GetProductSeries},
{"ProductModel", GetProductModel},
{"SoftwareModel", GetSoftwareModel},
{"HardwareModel", GetHardwareModel},
{"Serial", GetSerial},
{"OSFullName", GetOSFullName},
{"DisplayVersion", GetDisplayVersion},
{"BootloaderVersion", GetBootloaderVersion},
{"GetSecurityPatchTag", GetSecurityPatchTag},
{"AbiList", GetAbiList},
{"SdkApiVersion", GetSdkApiLevel},
{"FirstApiVersion", GetFirstApiLevel},
{"IncrementalVersion", GetIncrementalVersion},
{"VersionId", GetVersionId},
{"BuildType", GetBuildType},
{"BuildUser", GetBuildUser},
{"BuildHost", GetBuildHost},
{"BuildTime", GetBuildTime},
{"BuildRootHash", GetBuildRootHash},
};
int QuerySysparaCmd(void)
{
int index = 0;
int dumpInfoItemNum = (sizeof(SYSPARA_LIST) / sizeof(SysParaInfoItem));
const char *temp = NULL;
int (*pfnPrintf)(const char *format, ...) = NULL;
#if defined(__LITEOS_RISCV__)
pfnPrintf = &AtPrintf;
#else
pfnPrintf = &printf;
#endif
pfnPrintf("Begin dump syspara\r\n");
pfnPrintf("=======================\r\n");
while (index < dumpInfoItemNum) {
temp = SYSPARA_LIST[index].getInfoValue();
pfnPrintf("%s:%s\r\n", SYSPARA_LIST[index].infoName, temp);
index++;
}
pfnPrintf("=======================\r\n");
pfnPrintf("End dump syspara\r\n");
pfnPrintf = NULL;
return 0;
}
/*
* Copyright (c) 2020 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.
*/
#ifndef DUMP_SYSPARA_H
#define DUMP_SYSPARA_H
typedef struct {
char *infoName;
const char *(*getInfoValue)(void);
} SysParaInfoItem;
int QuerySysparaCmd(void);
#endif
/*
* Copyright (c) 2020 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 <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include "dump_syspara.h"
typedef struct {
char *serviceName;
int (*serviceHandler)();
} ServiceItem;
static const ServiceItem SERVICE_LIST[] = {
{"syspara", QuerySysparaCmd},
};
static void Usage()
{
printf("Usage:os_dump [--help | -l | SERVICE]\n"
" --help: shows this help\n"
" -l: only list services, do not dump them\n"
" SERVICE: dumps only service SERVICE\n");
};
int main(int argc, char **argv)
{
static struct option longOptions[] = {
{"help", no_argument, 0, 0},
{0, 0, 0, 0}
};
int serviceNum = (sizeof(SERVICE_LIST) / sizeof(ServiceItem));
int c;
int optionIndex = 0;
if (optind == argc) {
Usage();
return 0;
}
optind = 1;
while (1) {
c = getopt_long(argc, argv, "l", longOptions, &optionIndex);
if (c == -1) {
break;
}
switch (c) {
case 0:
if (!strcmp(longOptions[optionIndex].name, "help")) {
Usage();
}
break;
case 'l':
printf("OptionList:\n");
for (int i = 0; i < serviceNum; i = i + 1) {
printf("%s\n", SERVICE_LIST[i].serviceName);
}
break;
default:
Usage();
break;
}
}
for (int i = optind; i < argc; i++) {
for (int j = 0; j < serviceNum; j++) {
if (!strcmp(argv[i], SERVICE_LIST[j].serviceName)) {
int ret = SERVICE_LIST[j].serviceHandler();
return ret;
}
}
printf("Service %s not registered! Try os_dump --help\n", argv[i]);
break;
}
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册