基于海思Hi3716cv200的Android源碼編譯及燒寫之內建儲存卡

來源:互聯網
上載者:User

標籤:android   style   blog   http   java   color   

問題:把編譯好的鏡像燒寫到小板上後,發現設定--->儲存 裡只顯示0.98G的系統空間,而且在設定--->應用 點開後會崩潰。崩潰時的日誌資訊如下:

time( 3407): at com.android.settings.applications.ManageApplications$TabInfo.updateStorageUsage(ManageApplications.java:333) 
E/AndroidRuntime( 3407): at com.android.settings.applications.ManageApplications$TabInfo.setContainerService(ManageApplications.java:234) 
E/AndroidRuntime( 3407): at com.android.settings.applications.ManageApplications$2.onServiceConnected(ManageApplications.java:1227) 
W/ActivityManager( 2177): Process com.android.settings has crashed too many times: killing! 
W/ActivityManager( 2177): Force finishing activity com.android.settings/.Settings 
I/ActivityManager( 2177): Killing proc 3407:com.android.settings/1000: crash 
W/InputDispatcher( 2177): channel ‘417bd5b0 com.android.settings/com.android.settings.Settings (server)‘ ~ Consumer closed input channel or an error occurred. events=0x9 
E/InputDispatcher( 2177): channel ‘417bd5b0 com.android.settings/com.android.settings.Settings (server)‘ ~ Channel is unrecoverably broken and will be disposed! 
W/InputDispatcher( 2177): Attempted to unregister already unregistered input channel ‘417bd5b0 com.android.settings/com.android.settings.Settings (server)‘ 
I/WindowState( 2177): WIN DEATH: Window{417bd5b0 u0 com.android.settings/com.android.settings.Settings} 
binder: 2177:2249 transaction failed 29189, size 100-4 
binder: 2177:2517 transaction failed 29189, size 4-0 

binder: send failed reply for transaction 29309, target dead

 

仔細查看錯誤資訊後發現,崩潰的原因跟存放裝置有關。所有的問題都歸結到Android系統不能完全識別存放裝置這個問題上。

在shell下發現,系統能識別的儲存只有4G,而我們的裝置時8G的emmc

 [email protected]:/ # df Filesystem     Size Used Free Blksize /dev           475M 68K 475M 4096 /mnt           475M 0K 475M 4096 /mnt/secure 475M 0K 475M 4096 /mnt/asec    475M 0K 475M 4096 /mnt/obb     475M 0K 475M 4096 /system      492M 254M 237M 4096 /data         1007M 72M 935M 4096 ------->這是設定裡顯示的內部儲存。/cache       98M 4M 94M 4096


由於我們是使用升級的方式燒寫系統,所以在升級檔案中應該會有對分區進行處理的指令碼。搜尋後發現,在update.zip的META-INF\com\google\android目錄下存在updater-script升級指令碼,對分區的操作就位於該指令碼中,在該指令碼中沒有涉及Sdcard操作。在Android源碼的bootable\recovery\etc\META-INF\com\google\android目錄下發現了以下檔案:

經過對比發現,其中updater-script-emmc就是我編譯時間預設使用的升級指令碼,而在updater-script-produce-emmc中反現了以下代碼:

ui_print("foramt sdcard......");format("ext4", "EMMC", "/dev/block/platform/hi_mci.1/by-name/sdcard", "0", "/sdcard");

 

該段代碼的功能就是格式化sdcard分區,接下來只需要把

updater-script-produce-emmc改名為updater-script-emmc,然後再源碼根目錄下執行:make updatezip -j8即可在out/target/product/hi3716c/Emmc目錄下得到升級包update.zip,再利用該升級包升級系統即可。升級後,在shell下查看系統磁碟分割如下:

[email protected]:/ # dfFilesystem             Size   Used   Free   Blksize/dev                   475M    68K   475M   4096/mnt                   475M     0K   475M   4096/mnt/secure            475M     0K   475M   4096/mnt/asec              475M     0K   475M   4096/mnt/obb               475M     0K   475M   4096/system                492M   254M   237M   4096/data                 1007M    61M   946M   4096/cache                  98M     4M    94M   4096/mnt/sdcard              5G    98M     5G   4096/mnt/secure/asec         5G    98M     5G   4096


可以看到,所有分區都能識別出來了。

注意1:Android系統一般會把整個儲存(如本例的8G Emmc)分為兩部分,一部分作為系統磁碟分割,一部分作為內建SD卡分區。

注意2:以上修改只針對生產時使用,在提供給使用者的升級包update.zip中使用的升級指令碼一定不能包含對sdcard的格式化操作。也就是說,使用者升級包必須使用原來的updater-script-emmc升級指令碼。

============================================================================================

附錄:中各個分區的作用。

/system分區 --->ROM資訊

          --app------>預先安裝的應用和系統軟體

          --data------> 預先安裝應用和軟體的資料資訊

/data分區--------->使用者軟體資訊

           --app------>使用者安裝軟體,安裝時把apk檔案複製到此目錄

           --data------>存放所有軟體(/system/app,/data/app 和/mnt/asec中裝的軟體)的一些lib和xml檔案等資訊。以及程式快取檔案。

           --dalvik-cache----->將apk中的dex檔案安裝到dalvik-cache目錄下(dex檔案是dalvik虛擬機器的可執行檔,其大小約為原始apk檔案大小的四分之一)

/mnt  分區---------> 掛載外部裝置

            --sdcar  --->內建sd卡分區,用於儲存下載的地圖、音樂、視頻等檔案。

 

 


 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.