关于CM适配项目

(1)下载代码
(2)手机适配,找市场上配置相似的手机的配置进行修改
大部分配置都在device, vendor, kernel下 ,同样以厂商/代号为目录文件
(3)手机设别信息
提取手机的build.prop,或者从手机提取,或者从更新包中提取
(4)抓取手机的kernel,没必要用代码重新编译一个kernel,可以从手机版本的boot.img或recovery.img中获取
(5)确定分区方案
要获得分区名称,大小,如何挂载,这些信息通常在vendor/BoardConfig.mk文件中
在recovery.fstab文件(recovery.img)也保存上述分区信息,另外,init.[codename].rc也存在上述信息
也可以使用命令: $ cat /proc/partitions
也可以查看那 /cache/recovery.log 或 /tmp/recovery.log
(6)创建3个新目录
当收集完设备信息后,就可以生成设备配置
/device/[vendor]/[codename] 主要是产品的配置
/vendor/[vendor]/[codename] 从已有的产品中抓取到的文件
/kernel/[vendor]/[codename] 关于内核文件
得到这三个目录的方法:
1. 使用 mkvendor.sh(build/tools/device/) 生成框架文件
该脚本只使用与使用标准boot.img和标准android公约的设备,使用方法:
$ ./build/tools/device/mkvendor.sh samsung i9300 ~/Desktop/i9300boot.img
该命令会创建 devcie/samsumg/i9300/,在这个目录下,会存在一下文件 AndroidBoard.mk, AndroidProducts.mk, BoardConfig.mk, cm.mk, device_[codename].mk, kernel (the binary), recovery.fstab等
此命令不会创建kernel/目录.
2. 在github上查找相似设备配置
(7)自定义文件
首先侧重于4个文件BoardConfig.mk, device_[codename].mk, cm.mk, recovery.fstab, 和kernel 去适配产品
BoardConfig.mk中设置设备关于CPU及硬件参数,其中必须设置的部分,如下:
TARGET_ARCH BOARD_KERNEL_CMDLINE BOARD_KERNEL_PAGESIZE
BOARD_BOOTIMAGE_PARTITION_SIZE BOARD_RECOVERYIMAGE_PARTITION_SIZE
BOARD_SYSTEMIMAGE_PARTITION_SIZE BOARD_USERDATAIMAGE_PARTITION_SIZE
BOARD_HAS_NO_SELECT_BUTTON BOARD_FORCE_RAMDISK_ADDRESS / BOARD_MKBOOTIMG_ARGS
device_[codename].mk
这个文件包含了设备编译需要的模块,拷贝的文件和特殊的配置
PRODUCT_COPY_FILES PRODUCT_NAME / PRODUCT_DEVICE
recovery.fstab 定义了系统挂载点,文件系统类型,和每个分区的块
(8) Adjust recovery_ui.cpp if necessary
edit the /device/[vendor]/[codename]/recovery/recovery_ui.cpp. You can find ample examples of this file, the associated recovery/Android.mk file that builds it, and how it is used.\
(9)
Add the blobs to the vendor/ directory
Once you have a working recovery, it's now time to get CyanogenMod building and working.
The first thing to do is to get all the proprietary, binary blobs into the vendor/ folder, along with a .mk file that will include them in the final build.
This requires three steps:
1. Create extract-files.sh and setup-makefiles.sh scripts to pull those blob files from the device using adb and put them in the right /vendor/ directory. There are plenty of examples available for other devices.
2. Create an .mk Makefile to copy those files to the $OUT folder during the build process and put them in the right place. Again, use other devices as a guide for what this Makefile should look like. An example filename might be BoardConfigVendor.mk
3. Make sure that the Makefile you just created is included from your main BoardConfig.mk via a command such as -include vendor/[vendor]/[codename]/BoardConfigVendor.mk. Again, existing devices can illustrate how this is done.
(10)
Adding XML Overlays
It's very likely in your device_[codename].mk file, there's a line that looks like this:
DEVICE_PACKAGE_OVERLAYS := \
device/[vendor]/[codename]/overlay
(11)


待完善
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值