基於android5.1無顯示觸控系統的系統映象裁剪
阿新 • • 發佈:2018-12-18
思路:
1: 編譯後檢視out\target\product\product\system資料夾的內容,從這個資料夾入手,裁剪不必要的服務,庫檔案,apk,等等.
2: 瞭解真個編譯系統,從編譯過程入手,看隱含的可裁剪項,過程和思路很重要
具體裁剪內容:
1: build/target/product是編譯產品關鍵的mk檔案存放處,此處可以更加各個mk檔案編譯內容進行裁剪
base.mk檔案:去除不必要的lib庫檔案和bin檔案
core_minimal.mk: dmtracedump, Shell, HTMLViewer, screencap等工具和apk等
core.mk: libnfc_ndef, mms-common nfc功能庫檔案和mms簡訊功能等
embedded.mk: dumpstate, dumpsys
emulator.mk: camera.goldfish , camera.goldfish.jpeg , lights.goldfish , gps.goldfish等
full_base.mk: 去除不需要的庫和apk
full_base_telephony.mk: 去除apk和電話功能
generic_no_telephony.mk:去除apk和不必要的庫
languages_full.mk,locales_full.mk: 去除不需要的語言設定(可以去除res包的大小)
2:
external/icu4c/stubdata/icu-data-default.txt: 修改此檔案,去除編譯出的icu.dat檔案大小,去除不需要的語言,重新用指令碼生成想要的dat檔案即可
external/skia/Android.mk: 去除其中test的編譯
3:
frameworks/base/data/etc/platform.xml: 去除不需要的屬性
frameworks/base/data/fonts/Android.mk: 去除不需要的字型
frameworks/base/data/fonts/fallback_fonts.xml: 去除不需要的字型
frameworks/base/data/fonts/fonts.mk: 去除不需要的字型
4:
frameworks/base/data/sounds/AllAudio.mk: 去除不需要的聲音檔案(除了ui的保留,其他都可以去除)
frameworks/base/data/videos/VideoPackage1.mk: 去除不需要的視訊檔案
frameworks/native/data/etc/handheld_core_hardware.xml: 去除不需要的屬性
frameworks/native/data/etc/tablet_core_hardware.xml: 去除不需要的屬性
frameworks/base/preloaded-classes: 裁剪不必要的資源載入
5:
init.rc: 裁剪不需要的本地服務
system.prop: 裁剪不必要的屬性內容
6.在核心裁剪不必要的模組
7.其他具體操作:
7.1 裁剪資源
PRODUCT_AAPT_CONFIG := mdpi large
PRODUCT_AAPT_PREF_CONFIG := mdpi
7.2 降低畫素密度
ro.sf.lcd_density=160
7.3 裁剪語言
PRODUCT_LOCALES := en_US zh_TW zh_CN
7.4 去掉gms包
#$(call inherit-product-if-exists, vendor/google/products/gms_base.mk)
7.5 去掉無用的許可權 在/tablet_core_hardware.xml 中
<permissions>
+ <!-- <feature name="android.hardware.location" />
<feature name="android.hardware.location.network" />
-<!--
+
<feature name="android.hardware.sensor.compass" />
--->
+
<feature name="android.hardware.sensor.accelerometer" />
-<!--
- <feature name="android.hardware.bluetooth" />
-->
- <feature name="android.hardware.touchscreen" />
- <feature name="android.hardware.touchscreen.multitouch" />
- <feature name="android.hardware.touchscreen.multitouch.distinct" />
<!-- basic system services -->
- <feature name="android.software.app_widgets" />
<feature name="android.software.connectionservice" />
<feature name="android.software.voice_recognizers" />
- <feature name="android.software.backup" />
<feature name="android.software.home_screen" />
<feature name="android.software.input_methods" />
- <feature name="android.software.print" />
7.6 去掉開機動畫 和開機logo
7.7 打包(package.sh)的時候刪除其他檔案 包括 apk, 核心模組, bin檔案
rm $OUT/system/vendor/modules/81*.ko
rm $OUT/system/vendor/modules/8723bs.ko
rm $OUT/system/vendor/modules/ad5820_act.ko
rm $OUT/system/vendor/modules/afa750.ko
rm $OUT/system/vendor/modules/ar0330.ko
rm $OUT/system/vendor/modules/aw5306_ts.ko
rm $OUT/system/vendor/modules/esp8089.ko
rm $OUT/system/vendor/modules/dw9714_act.ko
rm $OUT/system/vendor/modules/ft5x_ts.ko
rm $OUT/system/vendor/modules/fxos8700.ko
rm $OUT/system/vendor/modules/gc*.ko
rm $OUT/system/vendor/modules/gsl*.ko
rm $OUT/system/vendor/modules/gt*.ko
rm $OUT/system/vendor/modules/hi253.ko
rm $OUT/system/vendor/modules/icn83xx_ts.ko
rm $OUT/system/vendor/modules/imx214.ko
rm $OUT/system/vendor/modules/icn83xx_ts.ko
rm $OUT/system/vendor/modules/mcs7830.ko
rm $OUT/system/vendor/modules/mma*.ko
rm $OUT/system/vendor/modules/ov*.ko
rm $OUT/system/vendor/modules/rtl8150.ko
rm $OUT/system/vendor/modules/sp*.ko
rm $OUT/system/vendor/modules/bma250.ko
rm $OUT/system/vendor/modules/t8et5.ko
rm $OUT/system/vendor/modules/siv121d.ko
rm $OUT/system/vendor/modules/s5k4*.ko
rm $OUT/system/vendor/modules/qf9700.ko
rm $OUT/system/vendor/modules/vfe_os.ko
rm $OUT/system/vendor/modules/vfe_subdev.ko
rm $OUT/system/vendor/modules/vfe_v4l2.ko
rm $OUT/system/vendor/modules/videobuf-core.ko
rm $OUT/system/vendor/modules/videobuf-dma-contig.ko
rm -rf $OUT/system/app/Calculator
rm -rf $OUT/system/app/HoloSpiralWallpaper
rm -rf $OUT/system/app/Browser
rm -rf $OUT/system/app/Calendar
rm -rf $OUT/system/app/Camera2
rm -rf $OUT/system/app/Exchange2
rm -rf $OUT/system/app/Email
rm -rf $OUT/system/app/Galaxy4
rm -rf $OUT/system/app/Gallery2
rm -rf $OUT/system/app/LiveWallpapers
rm -rf $OUT/system/app/LiveWallpapersPicker
rm -rf $OUT/system/app/PrintSpooler
rm -rf $OUT/system/app/VideoPlayer
rm -rf $OUT/system/app/QuickSearchBox
rm -rf $OUT/system/app/DownloadProviderUi
rm -rf $OUT/system/app/DeskClock
rm -rf $OUT/system/app/PhotoTable
rm -rf $OUT/system/app/HTMLViewer
rm -rf $OUT/system/app/Development
rm -rf $OUT/system/app/PicoTts
rm -rf $OUT/system/app/UserDictionaryProvider
rm -rf $OUT/system/app/Music
rm -rf $OUT/system/app/NoiseField
rm -rf $OUT/system/app/PhaseBeam
rm -rf $OUT/system/app/OpenWnn
rm -rf $OUT/system/app/VisualizationWallpapers
rm -rf $OUT/system/app/DocumentsUI
rm -rf $OUT/system/precopy
rm -rf $OUT/system/priv-app/Contacts
rm -rf $OUT/system/priv-app/CalendarProvider
rm -rf $OUT/system/priv-app/WallpaperCropper
rm -rf $OUT/system/priv-app/MmsService
rm -rf $OUT/system/priv-app/DownloadProvider
rm -rf $OUT/system/priv-app/TelephonyProvider
rm -rf $OUT/system/priv-app/ContactsProvider
rm -rf $OUT/system/priv-app/MusicFX
rm -rf $OUT/system/media/audio/notifications/*
rm $OUT/system/bin/ntfs-3g.probe
rm $OUT/system/bin/ntfs-3g
rm $OUT/system/bin/gdbserver
rm $OUT/system/bin/usb_modeswitch
7.8 裁剪TTS ,註釋如下makefile
external/skia/Android.mk
external/svox/pico/lang/all_pico_languages.mk