From e84adf8c203dbdda43a3bd88af070f62959657d1 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Mon, 21 Oct 2024 13:27:00 +0800 Subject: [PATCH] =?utf8?q?=E6=9B=B4=E6=96=B0nandflash=E5=88=86=E5=8C=BA?= =?utf8?q?=E4=B8=BA=E5=8D=95=E5=88=86=E5=8C=BA=E6=A8=A1=E5=BC=8F=E3=80=82?= =?utf8?q?=E9=BB=98=E8=AE=A4=E5=BC=80=E5=90=AF=E5=8D=95=E5=88=86=E5=8C=BA?= =?utf8?q?=E6=A8=A1=E5=BC=8F=20SINGLE=5FUSER=5FPARTITION=20=20=20=20=20=20?= =?utf8?q?=20=20=20'single=5Fuser=5Fpartition':=20'True',=20=3D=3D=20true?= =?utf8?q?=20or=20false?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../brandy/brandy_recovery/recovery_display.c | 4 + .../nativeui/alarm/src/AlarmClockModel.cpp | 4 + .../countdown/include/CountDownModel.h | 9 +- .../obumessage/src/OBUMessageModel.cpp | 4 + .../src/SafeModeManagerModel.cpp | 6 +- .../nativeui/system/include/Systemupgrade.h | 13 +- .../systemupdate/include/SystemUpdateModel.h | 17 +- .../service/ble_service/blemoder/bletest.cpp | 4 + .../service/ble_service/bleservice/bleEvent.c | 11 +- .../include/notify/findwatch_notification.h | 8 +- .../msg_center/src/msg_center_customer.cpp | 4 + .../src/notify/alarm_notification.cpp | 4 + .../src/notify/sleep_notification.cpp | 4 + .../wstp/at_service/app/app_at_process.c | 9 +- .../wstp/at_service/app/app_test_fs.c | 5 + .../wstp/at_service/app/app_test_fs.h | 8 +- .../config/target_config/brandy/config.py | 3 + .../fd230/create_fs_checksumfile.py | 4 +- .../fd230/fs/{ => user}/music/ring/alarm.mp3 | Bin .../fs/{ => user}/music/ring/calling.mp3 | Bin .../fs/{ => user}/music/ring/findwatch.mp3 | Bin .../fd230/fs/{ => user}/music/ring/ring.mp3 | Bin .../fd230/fs/{ => user}/music/test3.txt | 0 .../fd230/fs/{ => user}/system/KUMI_LOGO.bin | 0 .../fd230/fs/{ => user}/system/OTAUpdata.bin | 0 .../fs/{ => user}/system/OTAUpdataRecover.bin | 0 .../fs/{ => user}/system/cat1ota/EventMesh.py | 0 .../{ => user}/system/cat1ota/cat1Service.py | 0 .../fs/{ => user}/system/cat1ota/checkota.py | 0 .../system/cat1ota/china_mobile_dmp.py | 0 .../fs/{ => user}/system/cat1ota/main.py | 0 .../fs/{ => user}/system/cat1ota/main_init.py | 0 .../{ => user}/system/cat1ota/slipService.py | 0 .../{ => user}/system/cat1ota/telecom_dmp.py | 0 .../fd230/fs/{ => user}/update/test2.txt | 0 .../brandy/mk_fs_image/fd230/mkyaffs2tool.py | 40 ++-- code/sdk/build/script/cmake_builder.py | 10 +- .../sdk/drivers/drivers/driver/mmc/mmc_init.c | 8 +- .../driver/nand_flash/nand/nandflash_config.c | 15 +- .../peripheral/config/include/ConfigModel.h | 4 + .../peripheral/config/src/ConfigModel.cpp | 4 + .../slip/cat1Service/cat1_tcpServer.cpp | 5 +- .../peripheral/utils/custom_resfile_check.c | 5 + .../drivers/peripheral/utils/custom_utils.c | 13 ++ .../update/include/upg_common_porting.h | 7 + .../service/src/graphic_service_wrapper.cpp | 9 + .../bundlemgr_lite/include/bundle_common.h | 5 + .../icu/icu4c/source/ohos/init_data.cpp | 4 + mkota_single_user.sh | 124 ++++++++++++ tools/scripts/gen_fs_otapkg_singleuser.sh | 59 ++++++ tools/scripts/search_folder_files.py | 4 +- tools/scripts/unyaffs2tool_singleuser.py | 185 ++++++++++++++++++ 52 files changed, 574 insertions(+), 48 deletions(-) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/music/ring/alarm.mp3 (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/music/ring/calling.mp3 (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/music/ring/findwatch.mp3 (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/music/ring/ring.mp3 (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/music/test3.txt (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/KUMI_LOGO.bin (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/OTAUpdata.bin (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/OTAUpdataRecover.bin (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/cat1ota/EventMesh.py (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/cat1ota/cat1Service.py (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/cat1ota/checkota.py (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/cat1ota/china_mobile_dmp.py (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/cat1ota/main.py (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/cat1ota/main_init.py (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/cat1ota/slipService.py (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/system/cat1ota/telecom_dmp.py (100%) rename code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/{ => user}/update/test2.txt (100%) create mode 100644 mkota_single_user.sh create mode 100644 tools/scripts/gen_fs_otapkg_singleuser.sh create mode 100644 tools/scripts/unyaffs2tool_singleuser.py diff --git a/code/sdk/application/brandy/brandy_recovery/recovery_display.c b/code/sdk/application/brandy/brandy_recovery/recovery_display.c index 2b466435b..10e232172 100644 --- a/code/sdk/application/brandy/brandy_recovery/recovery_display.c +++ b/code/sdk/application/brandy/brandy_recovery/recovery_display.c @@ -110,7 +110,11 @@ void recovery_display_sample(void) */ // 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; diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp index 8b3af69b0..5cc06d62c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp @@ -915,7 +915,11 @@ int AlarmClockModel::AlarmPlayerInit(void) 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; diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/include/CountDownModel.h b/code/sdk/application/wearable/fd230app/nativeui/countdown/include/CountDownModel.h index 0642536b5..674c40329 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/include/CountDownModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/include/CountDownModel.h @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-07 18:15:53 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-11 16:08:37 + * @LastEditors: SnickerSun snickersun@163.com + * @LastEditTime: 2024-10-21 11:35:37 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/include/CountDownModel.h */ #ifndef COUNTDOWN_MODEL_H @@ -116,8 +116,11 @@ namespace OHOS AudioSession sessionId; AudioInterrupt interrupt; // const char *RingMusicPath = "/user/music/alarm.mp3"; // 铃声路径 +#ifdef SINGLE_USER_PARTITION + const char *RingMusicPath = "/user/music/ring/alarm.mp3"; // 铃声路径 +#else const char *RingMusicPath = "/music/ring/alarm.mp3"; // 铃声路径 - +#endif std::string countdownDuration{nullptr}; std::string RingTime{"00:00:00"}; // 响铃时间 std::string CountTime{"00:00:00"}; // 倒计时时间 diff --git a/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageModel.cpp index b2b9f027f..26730c3db 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageModel.cpp @@ -300,7 +300,11 @@ namespace OHOS 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; diff --git a/code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/SafeModeManagerModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/SafeModeManagerModel.cpp index 2c2fb8948..3277a5572 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/SafeModeManagerModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/SafeModeManagerModel.cpp @@ -43,9 +43,11 @@ const char *get_version_string(void); 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(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/Systemupgrade.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/Systemupgrade.h index 588b3c3b7..7caa5aa55 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/include/Systemupgrade.h +++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/Systemupgrade.h @@ -41,14 +41,21 @@ #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 { diff --git a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateModel.h b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateModel.h index c0c424443..2e0675abd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateModel.h @@ -1,8 +1,8 @@ /* * @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 */ @@ -42,6 +42,17 @@ #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 @@ -50,6 +61,8 @@ #define UPDATAREPORT_ "/update/ota_report_.json"//上报升级得到的json +#endif + #define UPDATAFWPKGPATHURL 256 #define MSG_LEN 64 diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index 348a391d1..9bbea7bda 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -112,7 +112,11 @@ void test_paly(uint8_t falg) { if(falg) { +#ifdef SINGLE_USER_PARTITION + testPlayerStart_("/user/music/ring/ring.mp3"); +#else testPlayerStart_("/music/ring/ring.mp3"); +#endif } else { diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index 0e3f4987d..c7c804a37 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -3914,9 +3914,14 @@ static void GetSDSpaceCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *total uint64_t free_size=0; int i; struct statfs file_buf = {0}; +#ifdef SINGLE_USER_PARTITION + static const char * const g_volume_names[1] = { "/user/"}; + for (i = 0; i < 1; i++) { +#else static const char * const g_volume_names[4] = {"/system/", "/update/", "/music/", "/user/"}; - + for (i = 0; i < 4; i++) { +#endif /* 获取文件系统状态 */ if (statfs(g_volume_names[i], &file_buf) != 0) { return ; @@ -6820,7 +6825,7 @@ errcode_t decode_ota_data(ble_read_data *buffer_handle,uint8_t *data,uint16_t da buffer_handle->file_recv_stat.lrcvalue = 0; if (buffer_handle->file_recv_stat.file_type == 1) { - buffer_handle->file_recv_stat.file = fopen("/update/update.fwpkg","w+"); + buffer_handle->file_recv_stat.file = fopen("/user/update/update.fwpkg","w+"); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"create file /update/update.fwpkg %X\n",buffer_handle->file_recv_stat.file); } @@ -8046,7 +8051,7 @@ errcode_t handle_recv_file(ble_read_data *buffer_handle,uint8_t *data, uint16_t buffer_handle->file_recv_stat.lrcvalue = 0; if (buffer_handle->file_recv_stat.file_type == 1) { - buffer_handle->file_recv_stat.file = fopen("/update/update.fwpkg","w+"); + buffer_handle->file_recv_stat.file = fopen("/user/update/update.fwpkg","w+"); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"create file /update/update.fwpkg %X\n",buffer_handle->file_recv_stat.file); } diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h index 3de15f56d..ba29c7d07 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h @@ -1,8 +1,8 @@ /* * @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 @@ -101,7 +101,11 @@ namespace OHOS std::shared_ptr 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}; diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 18a26d0f9..25170f50c 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -930,7 +930,11 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req) 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)); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp index d8170acde..1f1649c88 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp @@ -637,7 +637,11 @@ namespace OHOS 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() diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp index 39f2cb214..3fa03c4dd 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp @@ -330,7 +330,11 @@ namespace OHOS { // 本地播放文件路径和状态 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; diff --git a/code/sdk/application/wstp/at_service/app/app_at_process.c b/code/sdk/application/wstp/at_service/app/app_at_process.c index 51c92af13..8696c175f 100755 --- a/code/sdk/application/wstp/at_service/app/app_at_process.c +++ b/code/sdk/application/wstp/at_service/app/app_at_process.c @@ -132,15 +132,20 @@ #define CALENDAR_PARAM_LEN 0x6 #ifdef CFG_DRIVERS_MMC #define FS_VOLUMES_NUM 4 -#define FS_VOLUME_STRS "/system/", "/user/", "/update/", "/music/" +#define FS_VOLUME_STRS "/user/system/", "/user/", "/user/update/", "/user/music/" extern unsigned int mmc_set_clock_with_way2(struct hci_softc *sc, unsigned int cfg_clock); uint32_t g_app_emmc_clk = SDIOM_SRC_CLK_FREQ_LVL_98M_VAL; #endif #ifdef CFG_DRIVERS_NANDFLASH #ifndef MEMORY_MINI +#ifdef SINGLE_USER_PARTITION +#define FS_VOLUMES_NUM 1 +#define FS_VOLUME_STRS "/user/" +#else #define FS_VOLUMES_NUM 4 -#define FS_VOLUME_STRS "/system/", "/update/", "/music/", "/user/" +#define FS_VOLUME_STRS "/system/", "/user/update/", "/user/music/", +#endif #else #define FS_VOLUMES_NUM 1 #define FS_VOLUME_STRS "/user/" diff --git a/code/sdk/application/wstp/at_service/app/app_test_fs.c b/code/sdk/application/wstp/at_service/app/app_test_fs.c index 7c426a7db..3435a118d 100755 --- a/code/sdk/application/wstp/at_service/app/app_test_fs.c +++ b/code/sdk/application/wstp/at_service/app/app_test_fs.c @@ -188,8 +188,13 @@ void file_basic_test(const char* path) void app_fs_test_basic(void) { file_basic_test("/user/user_test.log"); +#ifdef SINGLE_USER_PARTITION + file_basic_test("/user/update/upd_test.log"); + file_basic_test("/user/music/music_test.log"); +#else file_basic_test("/update/upd_test.log"); file_basic_test("/music/music_test.log"); +#endif } #ifdef CFG_DRIVERS_MMC diff --git a/code/sdk/application/wstp/at_service/app/app_test_fs.h b/code/sdk/application/wstp/at_service/app/app_test_fs.h index c687ed782..2a37462a1 100755 --- a/code/sdk/application/wstp/at_service/app/app_test_fs.h +++ b/code/sdk/application/wstp/at_service/app/app_test_fs.h @@ -50,10 +50,10 @@ extern "C" { #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; diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index b49a25720..d202759bf 100755 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -147,6 +147,7 @@ target = { '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", @@ -190,8 +191,10 @@ target = { '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版本 #离线日志版本 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/create_fs_checksumfile.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/create_fs_checksumfile.py index 7556cf92f..0ef3f6212 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/create_fs_checksumfile.py +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/create_fs_checksumfile.py @@ -60,11 +60,11 @@ target_filelist_name="" 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 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/ring/alarm.mp3 b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/ring/alarm.mp3 similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/ring/alarm.mp3 rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/ring/alarm.mp3 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/ring/calling.mp3 b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/ring/calling.mp3 similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/ring/calling.mp3 rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/ring/calling.mp3 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/ring/findwatch.mp3 b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/ring/findwatch.mp3 similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/ring/findwatch.mp3 rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/ring/findwatch.mp3 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/ring/ring.mp3 b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/ring/ring.mp3 similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/ring/ring.mp3 rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/ring/ring.mp3 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/test3.txt b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/test3.txt similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/music/test3.txt rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/music/test3.txt diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/KUMI_LOGO.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/KUMI_LOGO.bin similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/KUMI_LOGO.bin rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/KUMI_LOGO.bin diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/OTAUpdata.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/OTAUpdata.bin similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/OTAUpdata.bin rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/OTAUpdata.bin diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/OTAUpdataRecover.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/OTAUpdataRecover.bin similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/OTAUpdataRecover.bin rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/OTAUpdataRecover.bin diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/EventMesh.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/EventMesh.py similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/EventMesh.py rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/EventMesh.py diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/cat1Service.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/cat1Service.py similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/cat1Service.py rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/cat1Service.py diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/checkota.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/checkota.py similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/checkota.py rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/checkota.py diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/china_mobile_dmp.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/china_mobile_dmp.py similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/china_mobile_dmp.py rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/china_mobile_dmp.py diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/main.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/main.py similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/main.py rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/main.py diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/main_init.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/main_init.py similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/main_init.py rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/main_init.py diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/slipService.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/slipService.py similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/slipService.py rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/slipService.py diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/telecom_dmp.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/telecom_dmp.py similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/system/cat1ota/telecom_dmp.py rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/telecom_dmp.py diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/update/test2.txt b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/update/test2.txt similarity index 100% rename from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/update/test2.txt rename to code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/update/test2.txt diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/mkyaffs2tool.py b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/mkyaffs2tool.py index 0052ed369..8a6bb3bfc 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/mkyaffs2tool.py +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/mkyaffs2tool.py @@ -26,25 +26,27 @@ image_name = "file" # 配置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): @@ -77,14 +79,17 @@ def get_obb_type(obb_size): 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) @@ -94,15 +99,24 @@ if __name__ == "__main__": 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): diff --git a/code/sdk/build/script/cmake_builder.py b/code/sdk/build/script/cmake_builder.py index 0af478df1..8e2b16b27 100755 --- a/code/sdk/build/script/cmake_builder.py +++ b/code/sdk/build/script/cmake_builder.py @@ -150,10 +150,16 @@ class CMakeBuilder(BuildEnvironment): 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) diff --git a/code/sdk/drivers/drivers/driver/mmc/mmc_init.c b/code/sdk/drivers/drivers/driver/mmc/mmc_init.c index 6155f999b..edbf4242c 100755 --- a/code/sdk/drivers/drivers/driver/mmc/mmc_init.c +++ b/code/sdk/drivers/drivers/driver/mmc/mmc_init.c @@ -43,7 +43,6 @@ extern "C" { #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 @@ -53,8 +52,15 @@ extern "C" { #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; diff --git a/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_config.c b/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_config.c index 44800fb5e..d44636c5d 100755 --- a/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_config.c +++ b/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_config.c @@ -30,11 +30,6 @@ #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 @@ -46,10 +41,18 @@ uint8_t buffer_oob_verify[128] __attribute__((aligned(4))); // 128 is one max oo 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 diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModel.h b/code/sdk/drivers/peripheral/config/include/ConfigModel.h index 47e6dfa46..318094901 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModel.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModel.h @@ -447,7 +447,11 @@ namespace OHOS 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 diff --git a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp index 6810e6b80..6732f9ff0 100644 --- a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp +++ b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp @@ -753,7 +753,11 @@ namespace OHOS } //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 diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_tcpServer.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_tcpServer.cpp index daf9468d5..a72079eef 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_tcpServer.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_tcpServer.cpp @@ -66,8 +66,11 @@ static uint8_t g_skip_cat1_service_udp_transfer = 0; /** 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; diff --git a/code/sdk/drivers/peripheral/utils/custom_resfile_check.c b/code/sdk/drivers/peripheral/utils/custom_resfile_check.c index dc8cd5cda..8ea3c8c08 100644 --- a/code/sdk/drivers/peripheral/utils/custom_resfile_check.c +++ b/code/sdk/drivers/peripheral/utils/custom_resfile_check.c @@ -42,8 +42,13 @@ #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 diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index f7cc52571..478f58ee4 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -2070,10 +2070,18 @@ void uapi_restore_factory_setting(void) //恢复存储 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]); @@ -2948,9 +2956,14 @@ uint8_t uapi_get_cywee_static_state(void) } #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) { diff --git a/code/sdk/middleware/chips/brandy/update/include/upg_common_porting.h b/code/sdk/middleware/chips/brandy/update/include/upg_common_porting.h index ad8fe59bd..8dfde2ed2 100755 --- a/code/sdk/middleware/chips/brandy/update/include/upg_common_porting.h +++ b/code/sdk/middleware/chips/brandy/update/include/upg_common_porting.h @@ -20,10 +20,17 @@ extern "C" { #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 */ diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp index 87c6c6881..e71fdc052 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp @@ -76,16 +76,25 @@ static app_task_definition_t taskcfg={0}; #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) diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h index 3ca315402..3941f202b 100755 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h @@ -127,8 +127,13 @@ const char DATA_PATH[] = "/storage/app/data"; 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"; diff --git a/code/sdk/open_source/openharmony/third_party/icu/icu4c/source/ohos/init_data.cpp b/code/sdk/open_source/openharmony/third_party/icu/icu4c/source/ohos/init_data.cpp index 84a87a78d..ecdc47419 100755 --- a/code/sdk/open_source/openharmony/third_party/icu/icu4c/source/ohos/init_data.cpp +++ b/code/sdk/open_source/openharmony/third_party/icu/icu4c/source/ohos/init_data.cpp @@ -16,7 +16,11 @@ #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 } /** diff --git a/mkota_single_user.sh b/mkota_single_user.sh new file mode 100644 index 000000000..cde062ec4 --- /dev/null +++ b/mkota_single_user.sh @@ -0,0 +1,124 @@ +#!/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 + diff --git a/tools/scripts/gen_fs_otapkg_singleuser.sh b/tools/scripts/gen_fs_otapkg_singleuser.sh new file mode 100644 index 000000000..33014fca3 --- /dev/null +++ b/tools/scripts/gen_fs_otapkg_singleuser.sh @@ -0,0 +1,59 @@ +#!/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 + + + diff --git a/tools/scripts/search_folder_files.py b/tools/scripts/search_folder_files.py index b269fc14f..4b43da1f5 100644 --- a/tools/scripts/search_folder_files.py +++ b/tools/scripts/search_folder_files.py @@ -68,11 +68,11 @@ if __name__ == '__main__': 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 diff --git a/tools/scripts/unyaffs2tool_singleuser.py b/tools/scripts/unyaffs2tool_singleuser.py new file mode 100644 index 000000000..bf2652aff --- /dev/null +++ b/tools/scripts/unyaffs2tool_singleuser.py @@ -0,0 +1,185 @@ +#!/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] [] + + # Options: + # -d detection of flash layout, no extraction + # -b spare contains bad block information + # -c set chunk size in KByte (default: autodetect, max: 16) + # -s 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!") -- 2.17.1