</imageRes>
*/
// memset_s((void *)surface.phy_addr, surface.size, 0xFF, surface.size);
+#ifdef SINGLE_USER_PARTITION
+ recovery_dispay_read_image_and_savein_surface("/user/system/OTAUpdataRecover.bin",&surface);
+#else
recovery_dispay_read_image_and_savein_surface("/system/OTAUpdataRecover.bin",&surface);
+#endif
ret = uapi_dpu_create_layer(&layer_info, &dpu_handle);
if (ret != ERRCODE_SUCC) {
return;
std::string pureName = strSongName.substr(0, strSongName.rfind(".")); // 播放音乐的路径需要引用.号
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayerInit, url:%s ", sliceId);
//std::string strSrcMusic(APP_MUSIC_PATH);
+ #ifdef SINGLE_USER_PARTITION
+ std::string strSrcMusic("/user/music/ring");
+ #else
std::string strSrcMusic("/music/ring");
+ #endif
std::string tempStr("/");
std::string strName = sliceId;
uri = strSrcMusic + tempStr + strName;
/*\r
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-04-07 18:15:53\r
- * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-10-11 16:08:37\r
+ * @LastEditors: SnickerSun snickersun@163.com\r
+ * @LastEditTime: 2024-10-21 11:35:37\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/include/CountDownModel.h\r
*/\r
#ifndef COUNTDOWN_MODEL_H\r
AudioSession sessionId;\r
AudioInterrupt interrupt;\r
// const char *RingMusicPath = "/user/music/alarm.mp3"; // 铃声路径\r
+#ifdef SINGLE_USER_PARTITION \r
+ const char *RingMusicPath = "/user/music/ring/alarm.mp3"; // 铃声路径\r
+#else\r
const char *RingMusicPath = "/music/ring/alarm.mp3"; // 铃声路径\r
-\r
+#endif\r
std::string countdownDuration{nullptr};\r
std::string RingTime{"00:00:00"}; // 响铃时间\r
std::string CountTime{"00:00:00"}; // 倒计时时间\r
std::string pureName = strSongName.substr(0, strSongName.rfind(".")); // 播放音乐的路径需要引用.号
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayerInit, url:%s ", uri.c_str());
//std::string strSrcMusic(APP_MUSIC_PATH);
+#ifdef SINGLE_USER_PARTITION
+ std::string strSrcMusic("/user/music/ring");
+#else
std::string strSrcMusic("/music/ring");
+#endif
std::string tempStr("/");
std::string strName = uri;
uri = strSrcMusic + tempStr + strName;
bool resfile_checksum_thread(void);
}
-
+#ifdef SINGLE_USER_PARTITION
+static const char *CHECK_DIFFERENTIAL_FILE = "/user/system/check_differential.txt";
+#else
static const char *CHECK_DIFFERENTIAL_FILE = "/system/check_differential.txt";
-
+#endif
void repair_file_start() {
OHOS::SafeModeManagerModel::GetInstance()->RepairStart();
}
#define JSON_URL "http://snicker.com.cn:8089/fd230otanew.jsp?product=FD230&imei=%s&pkgver=%s"//获取升级url
#endif
-#define UPDATAJSONPATH "/update/ota_start_.json"//获取升级的得到的json
+#ifdef SINGLE_USER_PARTITION
-#define UPDATAREPORT "/update/ota_start_reported_.json"//点升级后保存下来的json
+#define UPDATAJSONPATH "/user/update/ota_start_.json"//获取升级的得到的json
+#define UPDATAREPORT "/user/update/ota_start_reported_.json"//点升级后保存下来的json
+#define UPDATAFWPKGPATH "/user/update/update.fwpkg" //升级包
+#define UPDATAREPORT_ "/user/update/ota_report_.json"//上报升级得到的json
-#define UPDATAFWPKGPATH "/update/update.fwpkg" //升级包
+#else
+#define UPDATAJSONPATH "/update/ota_start_.json"//获取升级的得到的json
+#define UPDATAREPORT "/update/ota_start_reported_.json"//点升级后保存下来的json
+#define UPDATAFWPKGPATH "/update/update.fwpkg" //升级包
#define UPDATAREPORT_ "/update/ota_report_.json"//上报升级得到的json
+#endif
namespace OHOS
{
/*
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-05-07 11:26:14
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-07 16:31:17
+ * @LastEditors: SnickerSun snickersun@163.com
+ * @LastEditTime: 2024-10-21 11:38:16
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateModel.h
*/
#define JSON_URL "http://snicker.com.cn:8089/fd230otanew.jsp?product=FD230&imei=%s&pkgver=%s"//获取升级url
#endif
+#ifdef SINGLE_USER_PARTITION
+
+#define UPDATAJSONPATH "/user/update/ota_start_.json"//获取升级的得到的json
+
+#define UPDATAREPORT "/user/update/ota_start_reported_.json"//点升级后保存下来的json
+
+#define UPDATAFWPKGPATH "/user/update/update.fwpkg" //升级包
+
+#define UPDATAREPORT_ "/user/update/ota_report_.json"//上报升级得到的json
+
+#else
#define UPDATAJSONPATH "/update/ota_start_.json"//获取升级的得到的json
#define UPDATAREPORT "/update/ota_start_reported_.json"//点升级后保存下来的json
#define UPDATAREPORT_ "/update/ota_report_.json"//上报升级得到的json
+#endif
+
#define UPDATAFWPKGPATHURL 256
#define MSG_LEN 64
{
if(falg)
{
+#ifdef SINGLE_USER_PARTITION
+ testPlayerStart_("/user/music/ring/ring.mp3");
+#else
testPlayerStart_("/music/ring/ring.mp3");
+#endif
}
else
{
uint64_t free_size=0;\r
int i;\r
struct statfs file_buf = {0};\r
+#ifdef SINGLE_USER_PARTITION\r
+ static const char * const g_volume_names[1] = { "/user/"};\r
+ for (i = 0; i < 1; i++) {\r
+#else\r
static const char * const g_volume_names[4] = {"/system/", "/update/", "/music/", "/user/"};\r
-\r
+ \r
for (i = 0; i < 4; i++) {\r
+#endif\r
/* 获取文件系统状态 */\r
if (statfs(g_volume_names[i], &file_buf) != 0) {\r
return ;\r
buffer_handle->file_recv_stat.lrcvalue = 0;\r
if (buffer_handle->file_recv_stat.file_type == 1)\r
{\r
- buffer_handle->file_recv_stat.file = fopen("/update/update.fwpkg","w+");\r
+ buffer_handle->file_recv_stat.file = fopen("/user/update/update.fwpkg","w+");\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"create file /update/update.fwpkg %X\n",buffer_handle->file_recv_stat.file);\r
\r
}\r
buffer_handle->file_recv_stat.lrcvalue = 0;\r
if (buffer_handle->file_recv_stat.file_type == 1)\r
{\r
- buffer_handle->file_recv_stat.file = fopen("/update/update.fwpkg","w+");\r
+ buffer_handle->file_recv_stat.file = fopen("/user/update/update.fwpkg","w+");\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"create file /update/update.fwpkg %X\n",buffer_handle->file_recv_stat.file);\r
\r
}\r
/*
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-25 17:31:19
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-09 21:29:37
+ * @LastEditors: SnickerSun snickersun@163.com
+ * @LastEditTime: 2024-10-21 11:49:04
* @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h
*/
#ifndef FIND_WATCH_NOTIFICATION_H
std::shared_ptr<FindWatchRingPlayerListener> playerInterruptListener{nullptr};
AudioSession sessionId;
AudioInterrupt interrupt;
+#ifdef SINGLE_USER_PARTITION
+ const char *RingMusicName = "/user/music/ring/findwatch.mp3";
+#else
const char *RingMusicName = "/music/ring/findwatch.mp3";
+#endif
const char * path_{nullptr};
bool FindWatchNotifyFlag{false}; // 判断是查找手表, 由notify生成界面
bool X_DRAG_FLAG{false};
if(true != ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()) && true != ConfigModel::GetInstance()->GetSilentMode())
{
+#ifdef SINGLE_USER_PARTITION
+ AlarmClockModel::GetInstance()->testPlayerStart("/user/music/ring/ring.mp3");
+#else
AlarmClockModel::GetInstance()->testPlayerStart("/music/ring/ring.mp3");
+#endif
}
CallerLogModel::GetInstance()->SetoperateNumber(call_data,strlen(call_data));
void AlarmViewEventListener::PopAlarmRing()
{
+#ifdef SINGLE_USER_PARTITION
+ FindWatchViewEventListener::GetInstance().PopInterPlayMusic("/user/music/ring/alarm.mp3");//播放铃声
+#else
FindWatchViewEventListener::GetInstance().PopInterPlayMusic("/music/ring/alarm.mp3");//播放铃声
+#endif
}
void AlarmViewEventListener::CancelAlarmRing()
{
// 本地播放文件路径和状态
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RingPlayerInit start!");
+#ifdef SINGLE_USER_PARTITION
+ std::string strSrcMusic("/user/music/ring");
+#else
std::string strSrcMusic("/music/ring");
+#endif
std::string tempStr("/");
std::string strName = RingMusicName;
uri = strSrcMusic + tempStr + strName;
#define CALENDAR_PARAM_LEN 0x6\r
#ifdef CFG_DRIVERS_MMC\r
#define FS_VOLUMES_NUM 4\r
-#define FS_VOLUME_STRS "/system/", "/user/", "/update/", "/music/"\r
+#define FS_VOLUME_STRS "/user/system/", "/user/", "/user/update/", "/user/music/"\r
extern unsigned int mmc_set_clock_with_way2(struct hci_softc *sc, unsigned int cfg_clock);\r
uint32_t g_app_emmc_clk = SDIOM_SRC_CLK_FREQ_LVL_98M_VAL;\r
#endif\r
\r
#ifdef CFG_DRIVERS_NANDFLASH\r
#ifndef MEMORY_MINI\r
+#ifdef SINGLE_USER_PARTITION\r
+#define FS_VOLUMES_NUM 1\r
+#define FS_VOLUME_STRS "/user/"\r
+#else\r
#define FS_VOLUMES_NUM 4\r
-#define FS_VOLUME_STRS "/system/", "/update/", "/music/", "/user/"\r
+#define FS_VOLUME_STRS "/system/", "/user/update/", "/user/music/", \r
+#endif\r
#else\r
#define FS_VOLUMES_NUM 1\r
#define FS_VOLUME_STRS "/user/"\r
void app_fs_test_basic(void)\r
{\r
file_basic_test("/user/user_test.log");\r
+#ifdef SINGLE_USER_PARTITION\r
+ file_basic_test("/user/update/upd_test.log");\r
+ file_basic_test("/user/music/music_test.log");\r
+#else\r
file_basic_test("/update/upd_test.log");\r
file_basic_test("/music/music_test.log");\r
+#endif\r
}\r
\r
#ifdef CFG_DRIVERS_MMC\r
#define MAX_FILE_PATH_SIZE 25
#define TCXO_ERROR 40
-#define FS_PARTITION_NAME_SYSTEM "/system"
-#define FS_PARTITION_NAME_USER "/user"
-#define FS_PARTITION_NAME_UPDATE "/update"
-#define FS_PARTITION_NAME_MUSIC "/music"
+// #define FS_PARTITION_NAME_SYSTEM "/system"
+// #define FS_PARTITION_NAME_USER "/user"
+// #define FS_PARTITION_NAME_UPDATE "/update"
+// #define FS_PARTITION_NAME_MUSIC "/music"
typedef struct {
uint32_t randm;
'SUPPORT_TCPIP',
'SUPPORT_HID_SERVICE',
'SUPPORT_BAIDU_MAP',
+ 'SINGLE_USER_PARTITION',
'CFG_FLASH_SIZE=16'
],
'ram_component': ["algorithm", "dfx_port_brandy", "dfx_update", 'dfx_nv', "osal", "arch_port", "-:testsuite",
'dsp_version': 'max',
'packet': True,
'image_analysis': False,
+ 'single_user_partition': 'True',
# 'fs_image_path':'evb4',
'fs_image': True
+
},
#native-js-user: liteos + uikit + nandflash + mipi + psram + audio 典型合封UIKIT版本
#离线日志版本
if __name__ == '__main__':
target_tmp_dir = sys.argv[1]+"/fs"
- target_filelist_name=target_tmp_dir+"/system/fileschecksum.txt"
+ target_filelist_name=target_tmp_dir+"/user/fileschecksum.txt"
if os.path.exists(target_filelist_name):
os.remove(target_filelist_name)
filelist=getAllFiles(target_tmp_dir)
- create_dirs(target_tmp_dir+"/system/")
+ create_dirs(target_tmp_dir+"/user/")
with open(target_filelist_name, 'w') as file:
for f in filelist:
fullpath=target_tmp_dir+f
# 配置nandflash信息
cfg_page_size = 2048
cfg_obb_size = 64
-
+single_user_partition = False
# 配置分区信息,请根据实际情况进行配置,添加格式为[分区路径, 分区大小]
# 分区大小需要根据按照百分系统分配好后的blocks数进行计算,大小=blocks(文件块个数)*pages_per_block(每个文件块包含的页数)*bytes_per_page(每页包含字节数)
# 前面按照比例分好分区,最后分区置成null,即代表剩下所有blocks
# drivers/drivers/driver/nand_flash/nand/nandflash_config.c
# #ifndef MEMORY_MINI
-# #define YF_NAME_STRS "/system/", "/update/", "/music/", "/user/"
+# #define YF_NAME_STRS "/user/system/", "/user/update/", "/user/music/", "/user/"
# uint32_t yf_volume_percent[YF_VOLUMES_NUM] = { 1, 1, 1, 97 };
# 0x140000
# 10 10 10 70
# 0xcc0000
-
partition_list = [
[os.path.join(cur_dir, 'fs', 'system'), "0xcc0000"],
[os.path.join(cur_dir, 'fs', 'update'), "0xcc0000"],
[os.path.join(cur_dir, 'fs', 'music'), "0xcc0000"],
[os.path.join(cur_dir, 'fs', 'user'), "null"]
]
+partition_list_single = [
+ [os.path.join(cur_dir, 'fs', 'user'), "null"]
+]
# 将生成image文件转换大小端,保存成另外文件
def convert(src_file, dest_file):
if __name__ == "__main__":
image_file = os.path.join(cur_dir, "%s.bin" %image_name)
tmp_file = os.path.join(cur_dir, "%s_tmp.bin" %image_name)
- if len(sys.argv) == 3 :
+ if len(sys.argv) == 4 :
out_path = os.path.join(sys.argv[1], "%s.bin" %image_name)
if sys.argv[2] == '128' :
cfg_obb_size = 128
+ if sys.argv[3] == 'True':
+ single_user_partition = True
else:
print("need give parms output path and oobsize!")
sys.exit(1)
+ print("=========== oobsize {} single_user_partition {}".format(cfg_obb_size,single_user_partition))
if sys.platform == 'linux2' or sys.platform == 'linux':
partition_total = 0
page_type = get_page_type(cfg_page_size)
os.remove(tmp_file)
if os.path.exists(image_file):
os.remove(image_file)
-
- for partition in partition_list:
- if (partition[1] != "null"):
- partition_total = partition_total + int(partition[1][2:], 16)
- command = mkyaffstool + " " + partition[0] + " " + tmp_file + page_type + obb_type + (" 0x%x" %partition_total)
- else:
- command = mkyaffstool + " " + partition[0] + " " + tmp_file + page_type + obb_type
- print(command)
- os.system(command)
+ if single_user_partition :
+ for partition in partition_list_single:
+ if (partition[1] != "null"):
+ partition_total = partition_total + int(partition[1][2:], 16)
+ command = mkyaffstool + " " + partition[0] + " " + tmp_file + page_type + obb_type + (" 0x%x" %partition_total)
+ else:
+ command = mkyaffstool + " " + partition[0] + " " + tmp_file + page_type + obb_type
+ print(command)
+ os.system(command)
+ else:
+ for partition in partition_list:
+ if (partition[1] != "null"):
+ partition_total = partition_total + int(partition[1][2:], 16)
+ command = mkyaffstool + " " + partition[0] + " " + tmp_file + page_type + obb_type + (" 0x%x" %partition_total)
+ else:
+ command = mkyaffstool + " " + partition[0] + " " + tmp_file + page_type + obb_type
+ print(command)
+ os.system(command)
convert(tmp_file, image_file)
if os.path.exists(image_file):
output_path = env.get_output_path()
print(output_path)
# errcode = exec_shell([self.python_path, fs_script_path], None, True)
+ if env.get("single_user_partition") == 'True' :
+ single_user_partition = 'True'
+ else:
+ single_user_partition = 'False'
+
if env.get("nandflash_oobsize") :
- errcode = exec_shell([self.python_path, fs_script_path, output_path, env.get("nandflash_oobsize")], None, True)
+ oobsize=env.get("nandflash_oobsize")
else :
- errcode = exec_shell([self.python_path, fs_script_path, output_path, '64' ], None, True)
+ oobsize = '64'
+ errcode = exec_shell([self.python_path, fs_script_path, output_path, oobsize,single_user_partition], None, True)
if errcode != 0:
print("creat fs image error!")
self.print_build_result(target, errcode)
#endif /* __cplusplus */
#endif /* __cplusplus */
-#define FF_VOLUMES_NUM 4
#define EMMC_PINMUX_NUM 10
#define EMMC_PAD_PINMUX_NUM 9
#define SDIO_PINMUX_NUM 6
#define EMMC_MSLEEP_20 20
#define EMMC_ACCESS_OFFSET 20
#define EMMC_SECTOR_TO_KB 2
+#ifdef SINGLE_USER_PARTITION
+#define FF_VOLUMES_NUM 1
+#define FF_VOLUME_NAME_STRS "/user/"
+uint32_t g_volume_percent[FF_VOLUMES_NUM] = { 100 };
+#else
+#define FF_VOLUMES_NUM 4
#define FF_VOLUME_NAME_STRS "/user/", "/system/", "/update/", "/music/"
uint32_t g_volume_percent[FF_VOLUMES_NUM] = { 11, 11, 8, 70 };
+#endif
static const char * const g_volume_names[FF_VOLUMES_NUM] = { FF_VOLUME_NAME_STRS };
int32_t g_fail_mount_index = 0;
#include "nandflash.h"
#include "hal_nandflash.h"
-#ifndef MEMORY_MINI
-#define YF_VOLUMES_NUM 4
-#else
-#define YF_VOLUMES_NUM 1
-#endif
#define NAND_BYTE_ALIGN 4
#define ERASE_ALL_TIMES 10
int has_nandflash_init = 0;
#ifndef MEMORY_MINI
-#define YF_NAME_STRS "/system/", "/update/", "/music/", "/user/"
+#ifdef SINGLE_USER_PARTITION
+#define YF_VOLUMES_NUM 1
+#define YF_NAME_STRS "/user/"
+uint32_t yf_volume_percent[YF_VOLUMES_NUM] = {100};
+#else
+#define YF_VOLUMES_NUM 4
+#define YF_NAME_STRS "/user/system/", "/user/update/", "/user/music/", "/user/"
uint32_t yf_volume_percent[YF_VOLUMES_NUM] = { 10, 10, 10, 70 };
// uint32_t yf_volume_percent[YF_VOLUMES_NUM] = { 1, 1, 1, 97 };
+#endif
#else
+#define YF_VOLUMES_NUM 1
#define YF_NAME_STRS "/user/"
uint32_t yf_volume_percent[YF_VOLUMES_NUM] = {100};
#endif
cJSON *get_item(ConfigItem item);
private:
+#ifdef SINGLE_USER_PARTITION
+ const std::string filePath = "/user/system/ConfigModel.json";
+#else
const std::string filePath = "/system/ConfigModel.json";
+#endif
cJSON *cjson_json{nullptr};
#endif
}
//UtilsSetEnv从ScreenModels.cpp移动到此,因此不收 USE_KVSTORE_STORE_CONFIG管理只是为了使用KVStore时更方便。
+#ifdef SINGLE_USER_PARTITION
+ int rets = UtilsSetEnv("/user/system");
+#else
int rets = UtilsSetEnv("/system");
+#endif
WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "UtilsSetEnv /system ret = %d", rets);
#ifdef USE_KVSTORE_STORE_CONFIG
/** 0: old format 1字节cmd, 1: new format 2字节cmd */
static uint8_t g_msg_format_type = 0;
-
+#ifdef SINGLE_USER_PARTITION
+#define CAT1_PY_PATH "/user/system/cat1ota" //存放需要升级的py文件路径
+#else
#define CAT1_PY_PATH "/system/cat1ota" //存放需要升级的py文件路径
+#endif
#define CAT1_REPLYA_FILE_SIZE_FUN 1 //是否需要CAT1回复文件大小一致传输完单个文件是否与SIZE大小匹配比较
static osTimerId_t file_transfer_timer=NULL;
static uint8_t timerOut_count = 0;
#define MAX_FILE_NAME_LEN 256
#define MAX_FILE_CHECKSUM_STR_LEN (256 + 64)
+#ifdef SINGLE_USER_PARTITION
+#define RESFILE_CHECKSUM_FILE "/user/system/fileschecksum.txt"
+#define CHECK_DIFFERENTER_FILE "/user/system/check_differential.txt"
+#else
#define RESFILE_CHECKSUM_FILE "/system/fileschecksum.txt"
#define CHECK_DIFFERENTER_FILE "/system/check_differential.txt"
+#endif
// #define ENABLE_RESFILECHECK_LOG
#ifdef ENABLE_RESFILECHECK_LOG
#define LOG_RESCHECK printf
//恢复存储
resume_report_log();
+#ifdef SINGLE_USER_PARTITION
+ char *filebuf[] = {"/user/system/ConfigModel.json",
+ "/user/userdata",
+ "/user/system/kvstore",
+ };
+
+#else
char *filebuf[] = {"/system/ConfigModel.json",
"/user/userdata",
"/system/kvstore",
};
+#endif
for(int i = 0; i < (sizeof(filebuf)/sizeof(filebuf[0])); i++)
uapi_delete_files(filebuf[i]);
}
#ifdef CYWEE_MAC_ACTIVE
+#ifdef SINGLE_USER_PARTITION
+#define CYWEE_MAC_KEY_PATH "/user/system/cywee_mac_key.bin"
+#else
#define CYWEE_MAC_KEY_PATH "/system/cywee_mac_key.bin"
#endif
+#endif
+
void uapi_cywee_save_mac_key(const uint8_t *key_data,uint16_t len)
{
#define UPG_RES_INDEX_PATH "/user/res_index.bin"
#define UPG_FILE_NAME "/user/update.fwpkg"
#else
+
+#ifdef SINGLE_USER_PARTITION
+#define UPG_FILE_PATH "/user/update/"
+#define UPG_RES_INDEX_PATH "/user/update/res_index.bin"
+#define UPG_FILE_NAME "/user/update/update.fwpkg"
+#else
#define UPG_FILE_PATH "/update/"
#define UPG_RES_INDEX_PATH "/update/res_index.bin"
#define UPG_FILE_NAME "/update/update.fwpkg"
#endif
+#endif
#define UPG_FLASH_SIZE (FLASH_MAX_END - FLASH_START)
#define UPG_FLASH_PAGE_SIZE FLASH_PAGE_SIZE /* Bytes per sector */
#ifdef QSPI_DISPLAY
#define IMAGE_OPEN_LOGO_PATH "/user/res/OPEN_LOGO_QSPI.bin"
#else
+#ifdef SINGLE_USER_PARTITION
+#define IMAGE_OPEN_LOGO_PATH "/user/system/KUMI_LOGO.bin"
+#define IMAGE_OTA_LOGO_PATH "/user/system/OTAUpdata.bin"
+#else
#define IMAGE_OPEN_LOGO_PATH "/system/KUMI_LOGO.bin"
#define IMAGE_OTA_LOGO_PATH "/system/OTAUpdata.bin"
#endif
+#endif
#ifdef CUSTOM_Z1
#ifdef IMAGE_OPEN_LOGO_PATH
#undef IMAGE_OPEN_LOGO_PATH
#endif
+#ifdef SINGLE_USER_PARTITION
+#define IMAGE_OPEN_LOGO_PATH "/user/system/z1bootlogo.bin"
+#else
#define IMAGE_OPEN_LOGO_PATH "/system/z1bootlogo.bin"
#endif
+#endif
static void FreeImagePathsArray(const char **imagePaths, const int numImages)
const char JSON_PATH[] = "/storage/app/etc/bundles/";
const char EXTEANAL_INSTALL_PATH[] = "/sdcard/app/run";
const char EXTEANAL_DATA_PATH[] = "/sdcard/app/data";
+#ifdef SINGLE_USER_PARTITION
+const char SYSTEM_BUNDLE_PATH[] = "/user/system/internal";
+const char THIRD_SYSTEM_BUNDLE_PATH[] = "/user/system/external";
+#else
const char SYSTEM_BUNDLE_PATH[] = "/system/internal";
const char THIRD_SYSTEM_BUNDLE_PATH[] = "/system/external";
+#endif
const char UNINSTALL_THIRD_SYSTEM_BUNDLE_JSON[] = "/storage/app/etc/uninstalled_delbundle.json";
const char THIRD_SYSTEM_BUNDLE_JSON[] = "/storage/app/etc/third_system_bundle.json";
const char UID_GID_MAP[] = "uid_gid_map";
#include "init_data.h"
namespace {
+#ifdef SINGLE_USER_PARTITION
+const char* g_hwDirectory = "/user/system/usr/ohos_icu";
+#else
const char* g_hwDirectory = "/system/usr/ohos_icu";
+#endif
}
/**
--- /dev/null
+#!/bin/bash
+
+if [ "$#" == "2" ] || [ "$#" == "3" ] ; then
+SOURCE_DIR=$1
+SOURCE_VERSION=`basename $SOURCE_DIR`
+TARGET_DIR=$2
+TARGET_VERSION=`basename $TARGET_DIR`
+RES_DIR=$3
+ROOTDIR=`basename $PWD`
+ADDITIONAL_RES_DIR=$PWD/code/sdk/output/additional_fs
+OTA_ALL_FLAG_PATH=$PWD/code/sdk/output/ota_all
+OTA_ALL_WITH_NV_FLAG_PATH=$PWD/code/sdk/output/ota_all_with_nv
+RES_ONLY_FLAG_PATH=$PWD/code/sdk/output/res_only
+OTA_DIFF_FLAG_PATH=$PWD/code/sdk/output/ota_diff
+if [ ! -d "$PWD/code/sdk/output" ] ; then
+mkdir -p $PWD/code/sdk/output
+fi
+
+chmod +x ./tools/* -R
+if [ ! -d "$SOURCE_DIR" ] ; then
+echo "$SOURCE_DIR not exist , skip create ota package"
+echo ""
+exit 0
+fi
+if [ ! -d "$TARGET_DIR" ] ; then
+echo "$TARGET_DIR not exist , skip create ota package"
+echo ""
+exit 0
+fi
+
+rm $OTA_ALL_FLAG_PATH $RES_ONLY_FLAG_PATH $OTA_DIFF_FLAG_PATH $OTA_ALL_WITH_NV_FLAG_PATH -f
+if [ "$3" == "ota_all" ]; then
+touch $OTA_ALL_FLAG_PATH
+OTA_PKG_HEAD=ota_all_
+elif [ "$3" == "ota_all_with_nv" ]; then
+touch $OTA_ALL_WITH_NV_FLAG_PATH
+OTA_PKG_HEAD=ota_all_nv_
+elif [ "$3" == "ota_diff" ]; then
+touch $OTA_DIFF_FLAG_PATH
+OTA_PKG_HEAD=ota_diff_
+elif [ "$3" == "res_only" ]; then
+touch $RES_ONLY_FLAG_PATH
+OTA_PKG_HEAD=res_only_
+else
+OTA_PKG_HEAD=ota_
+fi
+
+
+mkdir code/sdk/output/brandy/TestOTA/ -p
+rm -rf code/sdk/output/brandy/TestOTA/*
+
+cp -r $SOURCE_DIR code/sdk/output/brandy/TestOTA/oldsoftware
+cp -r $TARGET_DIR code/sdk/output/brandy/TestOTA/newsoftware
+
+
+OLD_COMMIT_VERSION=`cat code/sdk/output/brandy/TestOTA/oldsoftware/readme.txt | awk '$1 == "commit" { print $2}'`
+NEW_COMMIT_VERSION=`cat code/sdk/output/brandy/TestOTA/newsoftware/readme.txt | awk '$1 == "commit" { print $2}'`
+
+TMPDIR=../PATCHES/${ROOTDIR}_FSOTA_F
+rm -rf $TMPDIR
+echo ./tools/scripts/gen_fs_otapkg_singleuser.sh $OLD_COMMIT_VERSION $NEW_COMMIT_VERSION F
+#./tools/scripts/gen_fs_otapkg_git.sh $OLD_COMMIT_VERSION $NEW_COMMIT_VERSION F
+./tools/scripts/gen_fs_otapkg_singleuser.sh $OLD_COMMIT_VERSION $NEW_COMMIT_VERSION F
+if [ $? != 0 ];
+then
+ echo gen_ota_fs_diff failed!
+ exit 1
+fi
+if [ -d "$TMPDIR" ] ; then
+RES_DIR=$TMPDIR
+fi
+# echo resdir = $RES_DIR = $TMPDIR
+if [ -d "$RES_DIR" ] ; then
+cp -r $RES_DIR/fs code/sdk/output/brandy/TestOTA/res_file
+fi
+
+if [ -e "$RES_DIR/diff/deletedfiles.txt" ]; then
+echo cp -f $RES_DIR/diff/deletedfiles.txt code/sdk/output/brandy/TestOTA/delfiles
+cp -f $RES_DIR/diff/deletedfiles.txt code/sdk/output/brandy/TestOTA/delfiles
+fi
+
+if [ -d "$ADDITIONAL_RES_DIR/fs" ]; then
+echo cp -rf $ADDITIONAL_RES_DIR/fs/ code/sdk/output/brandy/TestOTA/res_file/
+cp -rf $ADDITIONAL_RES_DIR/fs/ code/sdk/output/brandy/TestOTA/res_file/
+else
+echo $ADDITIONAL_RES_DIR/fs not exist, you can put additional resource file to there.
+fi
+
+if [ -e "$ADDITIONAL_RES_DIR/delfiles" ]; then
+cat $ADDITIONAL_RES_DIR/delfiles >> code/sdk/output/brandy/TestOTA/delfiles
+else
+echo $ADDITIONAL_RES_DIR/delfiles not exist, you can put filelist to this file , for adding them to del list in fota file.
+fi
+
+cd $PWD/code/sdk/
+./build/config/target_config/brandy/build_brandy_update.py
+if [ $? != 0 ];
+then
+ echo create ota file failed!
+ cd -
+ exit 1
+fi
+cd -
+
+mkdir release/ota -p
+
+target_fwpkg_filepath=release/ota/${OTA_PKG_HEAD}${SOURCE_VERSION}_2_${TARGET_VERSION}.fwpkg
+cp code/sdk/output/brandy/TestOTA/upgrade/update.fwpkg $target_fwpkg_filepath
+if [ $? != 0 ];
+then
+ echo copy firmware failed!
+ exit 1
+fi
+fwpkg_filesize=`ls $target_fwpkg_filepath -lh|awk '{print $5}'`
+
+echo create ota file $target_fwpkg_filepath $fwpkg_filesize done
+else
+
+echo ""
+echo "usage: $0 source_release target_release [ota_all]"
+echo ""
+
+fi
+
--- /dev/null
+#!/bin/bash
+#set -ex
+
+DATE=$(date +%Y%m%d.%H%M%S)
+if ! [ "$3" = "" ]
+then
+DATE=$3
+fi
+
+HOMEDIR=$PWD
+TMPDIR=/tmp/${USER}_${DATE}
+
+NEWVERSION=`dirname $0`/../../code/sdk/output/brandy/TestOTA/newsoftware
+OLDVERSION=`dirname $0`/../../code/sdk/output/brandy/TestOTA/oldsoftware
+
+UNYAFFS_SCRIPT=$HOMEDIR/tools/scripts/unyaffs2tool_singleuser.py
+COMPARE_FOLDER_SCRIPT=$HOMEDIR/tools/scripts/compare_folder.py
+SEARCH_FOLDER_SCRIPT=$HOMEDIR/tools/scripts/search_folder_files.py
+
+
+echo $0
+echo $NEWVERSION
+echo $OLDVERSION
+echo TMPDIR=$TMPDIR
+echo HOMEDIR=$HOMEDIR
+
+# echo get diff $OLDVERSION ... $NEWVERSION to $TMPDIR
+
+BACKUPDIR_HOME=$HOMEDIR/../PATCHES/$(basename $HOMEDIR)_FSOTA_${DATE}
+rm -rf $BACKUPDIR_HOME
+mkdir -p $BACKUPDIR_HOME
+
+python $UNYAFFS_SCRIPT $NEWVERSION/bin/file.bin $BACKUPDIR_HOME/new
+if [ $? != 0 ]
+then
+exit 1
+fi
+python $UNYAFFS_SCRIPT $OLDVERSION/bin/file.bin $BACKUPDIR_HOME/old
+if [ $? != 0 ]
+then
+exit 2
+fi
+python $SEARCH_FOLDER_SCRIPT $BACKUPDIR_HOME/new $BACKUPDIR_HOME/new
+if [ $? != 0 ]
+then
+exit 3
+fi
+
+python $COMPARE_FOLDER_SCRIPT $BACKUPDIR_HOME/new $BACKUPDIR_HOME/old $BACKUPDIR_HOME
+if [ $? != 0 ]
+then
+exit 4
+fi
+
+
+echo done
+
+
+
aPath = sys.argv[1]
target_tmp_dir = sys.argv[2]
print("{},{}".format(aPath,target_tmp_dir))
- target_filelist_name=target_tmp_dir+"/system/fileschecksum.txt"
+ target_filelist_name=target_tmp_dir+"/user/fileschecksum.txt"
if os.path.exists(target_filelist_name):
os.remove(target_filelist_name)
filelist=getAllFiles(aPath)
- create_dirs(target_tmp_dir+"/system/")
+ create_dirs(target_tmp_dir+"/user/")
with open(target_filelist_name, 'w') as file:
for f in filelist:
fullpath=aPath+"/"+f
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import time
+import struct
+import shutil
+
+"""
+介绍:
+ 本脚本主要实现调用mkyaffs2image工具生成文件镜像
+ 请注意使用本脚本时支持的python版本,本脚本只支持python3版本。
+ 请根据实际情况配置对应信息,主要是nandflash的信息,以及分区信息
+
+"""
+
+#tools/scripts/unyaffs2tool.py
+cur_dir = os.path.dirname(os.path.abspath(__file__))
+#tools/unyaffs_0.9.7/unyaffs
+image_tool_path = os.path.realpath(os.path.join(cur_dir, '..','unyaffs_0.9.7'))
+
+# 配置生成文件镜像工具路径
+unyaffstool = os.path.join(image_tool_path, 'unyaffs')
+
+# 配置nandflash信息
+cfg_page_size = 2048
+cfg_obb_size = 64
+
+
+#code/sdk/tools/bin/platform_tool/mkyaffs2image/mkyaffs2image code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/file_tmp.bin 1 2 0xcc0000
+#code/sdk/tools/bin/platform_tool/mkyaffs2image/mkyaffs2image code/sdk/build/config/target_config/brandy/mk_fs_image/fs/update code/sdk/build/config/target_config/brandy/mk_fs_image/file_tmp.bin 1 2 0x1980000
+#code/sdk/tools/bin/platform_tool/mkyaffs2image/mkyaffs2image code/sdk/build/config/target_config/brandy/mk_fs_image/fs/music code/sdk/build/config/target_config/brandy/mk_fs_image/file_tmp.bin 1 2 0x2640000
+#code/sdk/tools/bin/platform_tool/mkyaffs2image/mkyaffs2image code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user code/sdk/build/config/target_config/brandy/mk_fs_image/file_tmp.bin 1 2
+# pagesize 2048 oobsize 64
+# 配置分区信息,请根据实际情况进行配置,添加格式为[分区路径, 分区大小]
+# 分区大小需要根据按照百分系统分配好后的blocks数进行计算,大小=blocks(文件块个数)*pages_per_block(每个文件块包含的页数)*bytes_per_page(每页包含字节数)
+# 前面按照比例分好分区,最后分区置成null,即代表剩下所有blocks
+# drivers/drivers/driver/nand_flash/nand/nandflash_config.c
+# #ifndef MEMORY_MINI
+# #define YF_NAME_STRS "/user/system/", "/user/update/", "/user/music/", "/user/"
+# uint32_t yf_volume_percent[YF_VOLUMES_NUM] = { 1, 1, 1, 97 };
+# 0x140000
+# 10 10 10 70
+# 0xcc0000
+
+
+partition_list = [
+ # ["system","0x0", "0xcc0000"],
+ # ["update","0xcc0000","0xcc0000"],
+ # ["music", "0x1980000","0xcc0000"],
+ ["user", "0x2640000","null"]
+]
+
+# 将生成image文件转换大小端,保存成另外文件
+def convert(src_file, dest_file):
+ fp_src = open(src_file, 'rb')
+ fp_dest = open(dest_file, 'wb')
+ src_size = os.path.getsize(src_file)
+ for i in range(int(src_size / 4)):
+ data = fp_src.read(4)
+ rw = struct.pack('BBBB', data[3], data[2], data[1], data[0])
+ fp_dest.write(rw)
+ fp_src.close()
+ fp_dest.close()
+
+def splitimg(src_file,dest_file,startaddr,imgsize):
+ fp_src = open(src_file, 'rb')
+ fp_dest = open(dest_file, 'wb')
+ src_size = os.path.getsize(src_file)
+ print("{} {} {} {}".format(src_file,dest_file,startaddr,imgsize))
+ for i in range(int(src_size / 4)):
+ data = fp_src.read(4)
+ if i*4 >= startaddr and i*4 < (startaddr+imgsize):
+ # print(" write {} size {}".format(i*4,readsize))
+ rw = struct.pack('BBBB', data[3], data[2], data[1], data[0])
+ fp_dest.write(rw)
+ fp_src.close()
+ fp_dest.close()
+
+def unyaffs_img(binname,target_dir):
+ if not os.path.exists(target_dir):
+ try:
+ os.makedirs(target_dir)
+ except OSError as exc: # Guard against race condition
+ if exc.errno != errno.EEXIST:
+ raise
+ command = "cd " + target_dir +" && " + unyaffstool + " -c 2 -s 64 -b " + binname + " && cd -"
+ os.system(command)
+ os.remove(binname)
+
+def split_img(src_file,target_dir):
+ if not os.path.exists(target_dir):
+ try:
+ os.makedirs(target_dir)
+ except OSError as exc: # Guard against race condition
+ if exc.errno != errno.EEXIST:
+ raise
+ fileindex = 0
+ fp_src = open(src_file, 'rb')
+ dest_file = os.path.join(target_dir, "%s_tmp.bin" %partition_list[fileindex][0])
+ dest_partition_dir = os.path.join(target_dir, "%s" %partition_list[fileindex][0])
+ src_size = os.path.getsize(src_file)
+ fp_dest = open(dest_file, 'wb')
+ # YFSS
+ yaffsheader = struct.pack('BBBB', 0x59,0x46, 0x53, 0x53)
+ print("read {} ".format(yaffsheader))
+ #读取所有数据,一次4字节
+ for i in range(int(src_size / 4)):
+ data = fp_src.read(4)
+ rw = struct.pack('BBBB', data[3], data[2], data[1], data[0])
+ if data[0]==0x53 and data[1]==0x53 and data[2]==0x46 and data[3]==0x59:
+ #如果是yaffs的header,关闭前一个文件,创建新的对应分区文件,
+ fp_dest.close()
+ if i > 0 :
+ print("write {} size {}".format(dest_file,os.path.getsize(dest_file)))
+ unyaffs_img(dest_file,dest_partition_dir)
+ dest_file = os.path.join(target_dir, "%s_tmp.bin" %partition_list[fileindex][0])
+ dest_partition_dir = os.path.join(target_dir, "%s" %partition_list[fileindex][0])
+ fp_dest = open(dest_file, 'wb')
+ fileindex+=1
+ #读取的4字节写入分区文件
+ fp_dest.write(rw)
+ fp_src.close()
+ fp_dest.close()
+ print("write {} size {}".format(dest_file,os.path.getsize(dest_file)))
+ unyaffs_img(dest_file,dest_partition_dir)
+
+
+def get_page_type(page_size):
+ if page_size == 2048:
+ return " 1"
+ elif page_size == 4096:
+ return " 2"
+ else:
+ return " 0"
+
+def get_obb_type(obb_size):
+ if obb_size == 64:
+ return " 2"
+ elif obb_size == 128:
+ return " 4"
+ else:
+ return " 0"
+
+if __name__ == "__main__":
+ image_file=sys.argv[1]
+ tmpdir=sys.argv[2]
+ # image_file = os.path.join(cur_dir, "file.bin")
+
+ if sys.platform == 'linux2' or sys.platform == 'linux':
+ partition_total = 0
+ # page_type = get_page_type(cfg_page_size)
+ # obb_type = get_obb_type(cfg_obb_size)
+ page_type = " 1"
+ obb_type = " 2"
+
+ imgfilesize = os.path.getsize(image_file)
+
+ split_img(image_file,tmpdir)
+
+ # unyaffstool
+
+ # os.system(command)
+ # convert(tmp_file, image_file)
+ #unyaffs V0.9.7 - extract files from a YAFFS2 file system image.
+
+ # Usage: unyaffs [options] <image_file_name> [<extract_directory>]
+
+ # Options:
+ # -d detection of flash layout, no extraction
+ # -b spare contains bad block information
+ # -c <chunk size> set chunk size in KByte (default: autodetect, max: 16)
+ # -s <spare size> set spare size in Byte (default: autodetect, max: 512)
+ # -t list image contents
+ # -v verbose output
+ # -V print version
+
+ # unyaffs -c 2 -s 64 -b -t system_tmp.bin
+
+ # if (len(sys.argv) == 2 and os.path.exists(image_file)):
+ # out_path = os.path.join(sys.argv[1], "%s.bin" %image_name)
+ # shutil.copyfile(image_file, out_path)
+
+ print("make yaffs image file over!")