1. 程式人生 > >android6/7 system打包指令碼

android6/7 system打包指令碼

1.android5打包system就是網站上常見的製作ROM必備的解包打包system指令碼

指令如下:mkuserimg.sh -s out/target/product/$TARGET_PRODUCT/system out/target/product/$TARGET_PRODUCT/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 3195826176 -D out/target/product/$TARGET_PRODUCT/system -L system out/target/product/$TARGET_PRODUCT/root/file_contexts

android 5之前未啟用selinux,所以打包指令碼會少-L 引數,大致和android 5相同

2.到android 6之後,android開啟了system verify 簽名,未經簽名的image刷入不能開機,原因是system 掛載失敗。

解決辦法是修改分割槽掛載檔案,去掉system的verify引數,高通平臺為fstab.qcom

/dev/block/bootdevice/by-name/system         /system      ext4    ro,barrier=1,discard                                wait,verify


或者按照android要求對system進行簽名

檢視log得到了打包指令碼指令:python build/tools/releasetools/build_image.py out/target/product/$TARGET_PRODUCT/system out/target/product/$TARGET_PRODUCT/obj/PACKAGING/systemimage_intermediates/system_image_info.txt out/target/product/$TARGET_PRODUCT/system.img out/target/product/$TARGET_PRODUCT/system

LOG如下:

build_verity_tree -A aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 
out/target/product/msm8953_64/system.img /tmp/tmpKyrn_A_verity_images/verity.img
system/extras/verity/build_verity_metadata.py 3195826176 /tmp/tmpKyrn_A_verity_images/verity_metadata.img 

1a78a3588e5656dd06555d0e4324c930368ead38567b62bde728f930582e57a8 

aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 /dev/block/bootdevice/by-name/system out/host/linux-

x86/bin/verity_signer build/target/product/security/verity.pk8
append2simg out/target/product/msm8953_64/system.img /tmp/tmpKyrn_A_verity_images/verity_metadata.img
append2simg out/target/product/msm8953_64/system.img /tmp/tmpKyrn_A_verity_images/verity.img
out/target/product/msm8953_64/system.img maxsize=3288637440 blocksize=135168 total=2734485724 reserve=33251328

根據log提取依賴的指令碼和工具即可製作出打包簽名版system.img

當然如果你有原始碼不用這麼麻煩,直接make snod

但是有時候這還是很有用的。