546
社区成员




分布式软总线;initsoftbusserver;upg_size;
环境
设备型号:HI3861
系统版本:3.1release
问题现象:在OpenHarmony3.1版本,通过hb工具编译Hi3861_L0设备的代码时,在软总线的InitSoftBusServer方法时会编译错误,在后续编译软总线组网和传输接口时,会出现ota.bin的文件大小超过限制656KB的问题。
编译成功
编译失败
client_trans_proxy_manager.c
******从495行起******
static char *GetAndCheckRealPath(const char *filePath, char *absPath)
{
...
// char *realPath = NULL;
// if (realpath(filePath, absPath) == NULL) {
// SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "realpath failed, err[%s]", strerror(errno));
// return NULL;
// } else {
// realPath = absPath;
// }
// if (strstr(realPath, "..") != NULL) {
// SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "real path is not canonical form");
// return NULL;
// }
// int32_t pathLength = strlen(realPath);
// if ((pathLength > (MAX_FILE_PATH_NAME_LEN - 1)) || (pathLength > PATH_MAX)) {
// SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "pathLength[%d] is too large", pathLength);
// return NULL;
// }
}
******从870行起******
static int32_t CreateDirAndGetAbsPath(const char *filePath, char *recvAbsPath, int32_t pathSize)
{
...
// if (access(tempPath, 0) == -1) {
// ret = mkdir(tempPath, DEFAULT_NEW_PATH_AUTHORITY);
// if (ret == -1 && errno != EEXIST) {
// SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "mkdir failed(%d)", errno);
// SoftBusFree(tempPath);
// return SOFTBUS_ERR;
// }
// }
...
}
******从1046行起******
static int32_t ProcessOneFrame(FileFrame fileFrame, SingleFileInfo fileInfo, int32_t seq)
{
...
// int32_t writeLength = pwrite(fileInfo.fileFd, fileFrame.data + FRAME_DATA_SEQ_OFFSET, frameDataLength,
// (uint64_t)fileInfo.fileOffset);
// if (writeLength < 0) {
// SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "pwrite file failed");
// return SOFTBUS_ERR;
// }
...
}
hc_file.c
******从120行起******
void HcFileGetSubFileName(const char *path, StringVector *nameVec)
{
// DIR *dir = NULL;
// struct dirent *entry = NULL;
// if ((dir = opendir(path)) == NULL) {
// LOGI("opendir failed!");
// return;
// }
// while ((entry = readdir(dir)) != NULL) {
// if ((strcmp(entry->d_name, ".") == 0) || (strcmp(entry->d_name, "..") == 0)) {
// continue;
// }
// HcString subFileName = CreateString();
// if (!StringSetPointer(&subFileName, entry->d_name)) {
// LOGE("Failed to copy subFileName!");
// DeleteString(&subFileName);
// continue;
// }
// if (nameVec->pushBackT(nameVec, subFileName) == NULL) {
// LOGE("Failed to push name!");
// DeleteString(&subFileName);
// }
// }
// if (closedir(dir) < 0) {
// LOGE("Failed to close file");
// }
}
编译通过。
避免出现构建的空间占用过大的问题,修改配置文件,裁去不必要的部件:
进入目录:vendor/hisilicon/hispark_pegasus/config.json
裁掉DFX子系统的hilog_lite,hievent_lite,blackbox
{
"subsystem": "hiviewdfx",
"components": [
{ "component": "hidumper_mini", "features":[] }
]
},
裁掉updater部件
{
"subsystem": "updater",
"components": [
{ "component": "ota_lite", "features":[] }
]
},//全部去掉
裁掉xts部件
{
"subsystem": "xts",
"components": [
/* { "component": "xts_acts", "features":
[
"enable_ohos_test_xts_acts_use_thirdparty_lwip = false"
]
},
{ "component": "xts_tools", "features":[] }
]
}*/
],//从注释部分开始去掉
}
编译通过
根据编译时的报错,定位到对应的代码段
分布式软总线在3.1release版本以后将不把软总线分为softbus_lite和dsoftbus,而是将软总线合为一个dsoftbus仓,在使用时应注意区分版本和使用方式。
大佬,你的Hi3861最后能跑dsoftbus软总线吗?
可不可以提供一下在Hi3861上运行软总线的发现端和被发现端的demo,最近也在搞这个东西,在gitee上找的两三年前的编译不通