优化开机logo显示时间,延迟user分区的mount时间,先把开机logo放到 /system/分区中。
authorSnickerSun <snickersun@163.com>
Thu, 28 Dec 2023 11:05:39 +0000 (19:05 +0800)
committerSnickerSun <snickersun@163.com>
Thu, 28 Dec 2023 11:05:39 +0000 (19:05 +0800)
code/sdk/application/brandy/brandy_standard/thread_pri_init.c
code/sdk/bootloader/flashboot/brandy/nandflash/include/nandflash_config.h
code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/KUMI_LOGO.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/logo.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/test1.txt [deleted file]
code/sdk/build/config/target_config/brandy/mk_fs_image/mkyaffs2tool.py
code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_config.c
code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp

index 8fd3f57..22cbd3d 100755 (executable)
@@ -224,7 +224,15 @@ static void thread_main(const void *unused)
         PRINT("dpal driver base init error"NEWLINE);
         panic(PANIC_ASSERT, __LINE__);
     }
-
+#ifdef CFG_DRIVERS_MMC
+    emmc_init();
+    g_store_init_select = STORE_CLASS_EMMC;
+    sdiom_internal_freq_handler_register(mmc_set_internal_clk);
+#endif
+#ifdef CFG_DRIVERS_NANDFLASH
+    nandflash_init();
+    g_store_init_select = STORE_CLASS_NAND;
+#endif
     uapi_pm_control(PM_DISPLAY_POWER_UP_AND_RUN);
     (void)osDelay(TICK_TEN_MS);
 
@@ -244,21 +252,13 @@ static void thread_main(const void *unused)
     thread_init();
     button_app_init();
     uapi_calendar_init();
-    
+
 #ifdef SUPPORT_AT_OHOSFWK
     show_logo();
 #endif
-
-#ifdef CFG_DRIVERS_MMC
-    emmc_init();
-    g_store_init_select = STORE_CLASS_EMMC;
-    sdiom_internal_freq_handler_register(mmc_set_internal_clk);
-#endif
 #ifdef CFG_DRIVERS_NANDFLASH
-    nandflash_init();
-    g_store_init_select = STORE_CLASS_NAND;
+    nandflash_filesystem_mount_user();
 #endif
-
 #ifdef SUPPORT_AT_OHOSFWK
     ohos_startup();
 #endif
index 88f18f3..ad04bc6 100755 (executable)
@@ -44,6 +44,7 @@ extern const flash_info_type_def g_flash_info[1];
 
 struct nand_driver_struct *get_nand_flash(void);
 int nandflash_filesystem_init(void);
+int nandflash_filesystem_mount_user(void);
 void nandflash_qspi_init(void);
 void nandflash_qspi_resume(void);
 void test_nand_flash_read_8(struct nand_driver_struct  *test_nand_flash_driver, uint32_t nand_page);
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/KUMI_LOGO.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/KUMI_LOGO.bin
new file mode 100644 (file)
index 0000000..bd590ef
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/KUMI_LOGO.bin differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/logo.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/logo.bin
new file mode 100644 (file)
index 0000000..48c0d8f
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/logo.bin differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/test1.txt b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/system/test1.txt
deleted file mode 100755 (executable)
index b15149b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-this is test1 file
\ No newline at end of file
index 7495f9a..fc2b808 100755 (executable)
@@ -40,9 +40,9 @@ cfg_obb_size = 64
 
 
 partition_list = [
-    [os.path.join(cur_dir, 'fs', 'system'), "0x140000"],
-    [os.path.join(cur_dir, 'fs', 'update'), "0x140000"],
-    [os.path.join(cur_dir, 'fs', 'music'), "0x140000"],
+    [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"]
 ]
 
index 75dd6c7..0af10ee 100755 (executable)
 uint8_t buffer_verify[DEFALUT_BUFLENGTH] __attribute__((aligned(4)));
 uint8_t buffer_oob_verify[128] __attribute__((aligned(4))); // 128 is one max oob size
 int has_nandflash_init = 0;
-
+int has_nandflash_user_init = 0;
 #ifndef MEMORY_MINI
 #define YF_NAME_STRS "/system/", "/update/", "/music/", "/user/"
-uint32_t yf_volume_percent[YF_VOLUMES_NUM] = { 1, 1, 1, 97 };
+uint32_t yf_volume_percent[YF_VOLUMES_NUM] = { 10, 10, 10, 70 };
+// uint32_t yf_volume_percent[YF_VOLUMES_NUM] = { 1, 1, 1, 97 };
 #else
 #define YF_NAME_STRS "/user/"
 uint32_t yf_volume_percent[YF_VOLUMES_NUM] = {100};
@@ -60,7 +61,7 @@ struct nand_driver_struct *get_nand_flash(void)
     return &g_ds35x1g_driver;
 }
 
-static int formate_filesystem(uint32_t total_block_num)
+static int formate_filesystem_without_user(uint32_t total_block_num)
 {
     int ret;
     uint32_t index;
@@ -87,18 +88,45 @@ static int formate_filesystem(uint32_t total_block_num)
             PRINT("formate dev %d name fail \r\n", index);
             return -EIO;
         }
-
-        ret = mount(dev_name, g_volume_names[index], "yaffs", 0, NULL);
-        PRINT("formate filesystem devinfo: index = %d , dev_name = %s, folder_name = %s, \
-              part_start_sector = %d, part_count_sector = %d\r\n", index, dev_name,
-              g_volume_names[index], part_start_sector, part_count_sector);
-        if (ret != 0) {
-            return ret;
+        if( memcmp("/user/",g_volume_names[index],sizeof("/user/"))== 0 )
+        {
+            PRINT("skip mount /user/ \r\n");
+        }else{
+            ret = mount(dev_name, g_volume_names[index], "yaffs", 0, NULL);
+            PRINT("formate filesystem devinfo: index = %d , dev_name = %s, folder_name = %s, \
+                part_start_sector = %d, part_count_sector = %d\r\n", index, dev_name,
+                g_volume_names[index], part_start_sector, part_count_sector);
+            if (ret != 0) {
+                return ret;
+            }
         }
-        part_start_sector += part_count_sector;
+         part_start_sector += part_count_sector;
     }
     return ret;
 }
+static int formate_filesystem_user(void)
+{
+    int ret;
+    uint32_t index;
+    char dev_name[64] = { 0 };
+    for (index = 0; index < YF_VOLUMES_NUM; ++index) {
+        ret = sprintf_s(dev_name, sizeof(dev_name), "/dev/nandblk%d", index);
+        if (ret <= 0) {
+            PRINT("formate dev %d name fail \r\n", index);
+            return -EIO;
+        }
+        if( memcmp("/user/",g_volume_names[index],sizeof("/user/"))== 0 )
+        {
+            ret = mount(dev_name, g_volume_names[index], "yaffs", 0, NULL);
+            PRINT("formate filesystem devinfo: index = %d , dev_name = %s, folder_name = %s \r\n", index, dev_name, g_volume_names[index]);
+            if (ret != 0) {
+                return ret;
+            }
+        }
+    }
+    return ret;
+}
+
 
 void erase_all(struct nand_driver_struct *driver)
 {
@@ -207,11 +235,29 @@ int nandflash_filesystem_init(void)
         PRINT("get_mtd_info faild!\n");
     }
     PRINT("yaffs filesystem init start!\n");
-    int ret = formate_filesystem(freertos_nandflash_driver->total_block);
+    int ret = formate_filesystem_without_user(freertos_nandflash_driver->total_block);
     PRINT("yaffs filesystem init end!\n");
     has_nandflash_init = 1;
     return ret;
 }
+int nandflash_filesystem_mount_user(void)
+{
+
+    if(has_nandflash_init!=1)
+    {
+        PRINT("\r\nskip mount user , nandflash not ready , should init first.\r\n");
+        return -1;
+    }
+    if (has_nandflash_user_init == 1) {
+        PRINT("\r\nnandflash_user init ok.\r\n");
+        return 0;
+    }
+    PRINT("yaffs filesystem mount user start!\n");
+    int ret = formate_filesystem_user();
+    PRINT("yaffs filesystem mount user end!\n");
+    has_nandflash_user_init = 1;
+    return ret;
+}
 
 void nandflash_qspi_resume(void)
 {
index 0b7a221..c3d6d74 100755 (executable)
@@ -40,7 +40,7 @@ static OHOS::ImageInfo* g_imgInfo = nullptr;
 #ifdef QSPI_DISPLAY
 #define IMAGE_OPEN_LOGO_PATH "/user/res/OPEN_LOGO_QSPI.bin"
 #else
-#define IMAGE_OPEN_LOGO_PATH "/user/res/KUMI_LOGO.bin"
+#define IMAGE_OPEN_LOGO_PATH "/system/KUMI_LOGO.bin"
 #endif
 
 static void UikitRTCCallBack(uintptr_t data)
@@ -135,10 +135,10 @@ void ShowGraphicLogo()
     g_logo->SetPosition(0, 0, OHOS::Screen::GetInstance().GetWidth(), OHOS::Screen::GetInstance().GetHeight());
     g_logo->SetAutoEnable(false);
     g_logo->SetResizeMode(OHOS::UIImageView::CENTER);
-    // g_imgInfo = OHOS::ImageCacheManager::GetInstance().LoadSingleRes(IMAGE_OPEN_LOGO_PATH);
-    // g_logo->SetSrc(g_imgInfo);
-    g_logo->SetStyle(OHOS::STYLE_BACKGROUND_COLOR, 0xff007dff);
-    g_logo->SetStyle(OHOS::STYLE_BACKGROUND_OPA, 0xff);
+    g_imgInfo = OHOS::ImageCacheManager::GetInstance().LoadSingleRes(IMAGE_OPEN_LOGO_PATH);
+    g_logo->SetSrc(g_imgInfo);
+    // g_logo->SetStyle(OHOS::STYLE_BACKGROUND_COLOR, 0xff007dff);
+//     g_logo->SetStyle(OHOS::STYLE_BACKGROUND_OPA, 0xff);
     OHOS::GraphicEventHandler::GetInstance()->PostGraphicEvent(
         [] {
             OHOS::RootView::GetInstance()->Add(g_logo);
@@ -162,7 +162,7 @@ void HideGraphicLogo()
                 OHOS::RootView::GetInstance()->Remove(g_logo);
                 delete g_logo;
                 g_logo = nullptr;
-                // OHOS::ImageCacheManager::GetInstance().UnloadSingleRes(IMAGE_OPEN_LOGO_PATH);
+                OHOS::ImageCacheManager::GetInstance().UnloadSingleRes(IMAGE_OPEN_LOGO_PATH);
                 g_imgInfo = nullptr;
             }
         },