【文章內(nèi)容簡介】
P工程、CM支持的設(shè)備相關(guān)源碼工程(下載回來放在device/manufacturer/device目錄中),以及CM支持的設(shè)備對應(yīng)的內(nèi)核源碼工程(下載回來放在kernel/manufacturer/device目錄中)。 腳本build/tools/,到CM源碼服務(wù)上檢查是否存在相應(yīng)的工程。在我們這個(gè)場景中,傳給build/tools/。這時(shí)候前面的cm_會被去掉,然后到CM源碼服務(wù)上檢查是否存在一個(gè)android_device_manufacturer_find5的工程。如果存在的話,那么就會將它下載回來,保存在device/manufacturer/find5目錄中。這里的manufacturer對應(yīng)的就是oppo了。 下載回來的設(shè)備相關(guān)源碼實(shí)際上是作為是一個(gè)Git倉庫來管理的,因此,腳本build/tools/,以便以后執(zhí)行repo sync命令時(shí),可以同時(shí)對這些設(shè)備相關(guān)的源碼進(jìn)行更新。 從一文可以知道。,用來描述當(dāng)前的CM源碼目錄都是由哪些工程構(gòu)成的,并且這些工程是來自于哪些Git遠(yuǎn)程倉庫的。 如果按照標(biāo)準(zhǔn)的Repo倉庫管理方法,從CM源碼服務(wù)器上下載回來設(shè)備相關(guān)源碼之后,以后repo工具可以對這些設(shè)備相關(guān)的源碼進(jìn)行管理。但是,由于Repo倉庫是由官方維護(hù)的,下次執(zhí)行repo sync命令時(shí),.repo/manifests/,因此。CM采用另外一個(gè)辦法,在里面可以隨意增加任意命名的xml文件。執(zhí)行repo sync命令時(shí)。 實(shí)際上,除了可以描述新增的工程之外,還可以描述要刪除的工程。例如,如果我們不想將某一個(gè)系統(tǒng)功能或者系統(tǒng)APP編譯到我們自己制作的ROM去,里面描述我們需要刪除對應(yīng)的工程。這樣,當(dāng)我們從服務(wù)器下載回來相應(yīng)的工程之后,它們就會在本地中被刪除。這樣就做到了很好的定制化編譯,而且又不會與官方的源碼結(jié)構(gòu)產(chǎn)生沖突。關(guān)于CM的Local Manifests機(jī)制,可以參考官方文檔:。 腳本build/tools/。例如,當(dāng)我們從CM源碼服務(wù)器下載回來find5相關(guān)的設(shè)備源碼之后,:[html] view plain copy 在CODE上查看代碼片派生到我的代碼片?xml version= encoding=UTF8? manifest ...... project name=/android_device_oppo_find5 path=device/oppo/find5 remote=github / ...... /manifest 這表明本地的device/oppo/find5目錄是來自于遠(yuǎn)程倉庫github的,并且相對路徑為/android_device_oppo_find5。 好了,現(xiàn)在我們終于將OPPO Find 5相關(guān)的設(shè)備源碼下載回來了,但是在編譯之前。需要從OPPO Find 5上提取一些設(shè)備相關(guān)的私有文件。 7. 保持OPPO Find 5開機(jī)狀態(tài),并且通過USB連接到Ubuntu ,進(jìn)行到$CMSOURCE/device/oppo/find5目錄中,執(zhí)行以下命令提取設(shè)備私有文件。[plain] view plain copy 在CODE上查看代碼片派生到我的代碼片$ ./ :[plain] view plain copy 在CODE上查看代碼片派生到我的代碼片!/bin/sh VENDOR=oppo DEVICE=find5 BASE=../../../vendor/$VENDOR/$DEVICE/proprietary rm rf $BASE/* for FILE in `cat | grep v ^ | grep v ^$ | sed e 39。s^/system/g39。`。 do DIR=`dirname $FILE` if [ ! d $BASE/$DIR ]。 then mkdir p $BASE/$DIR fi adb pull /system/$FILE $BASE/$FILE done ./ 首先是創(chuàng)建一個(gè)vendor/oppo/find5/proprietary目錄,并且將每一行所描述的文件從設(shè)備上的/system目錄中獲取出來,保存在vendor/oppo/find5/proprietary對應(yīng)的子目錄下面。 文件device/oppo/find5/:[plain] view plain copy 在CODE上查看代碼片派生到我的代碼片/bin/btnvtool /bin/ds_fmc_appd /bin/efsks /bin/hci_qm_init /bin/ks /bin/mmqcameradaemon /bin/mpdecision /bin/netmgrd /bin/nv_tee /bin/qcks /bin/qmuxd ...... 這里列出的文件路徑都是相對于設(shè)備上的/system目錄的,并且都是設(shè)備特定的、不公開源碼的,因此,我們需要從設(shè)備上獲取出來。 :[plain] view plain copy 在CODE上查看代碼片派生到我的代碼片!/bin/sh VENDOR=oppo DEVICE=find5 OUTDIR=vendor/$VENDOR/$DEVICE MAKEFILE=../../../$OUTDIR/$ (cat EOF) $MAKEFILE Copyright (C) 2013 The Project Licensed under the Apache License, Version (the License)。 you may not use this file except in pliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the . This file is generated by device/$VENDOR/$DEVICE/ PRODUCT_COPY_FILES += \\ EOF LINEEND= \\ COUNT=`cat | grep v ^ | grep v ^$ | wc l | awk {39。print $139。}` for FILE in `cat | grep v ^ | grep v ^$ | sed e 39。s^/systemg39。 e 39。s^/g39。`。 do COUNT=`expr $COUNT 1` if [ $COUNT = 0 ]。 then LINEEND= fi echo $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND $MAKEFILE done (cat EOF) ../../../$OUTDIR/$ Copyright (C) 2013 The Project Licensed under the Apache License, Version (the License)。 you may not use this file except in pliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. This file is generated by device/$VENDOR/$DEVICE/ Pick up overlay for features that depend on nonopensource files DEVICE_PACKAGE_OVERLAYS := vendor/$VENDOR/$DEVICE/overlay \$(call inheritproduct, vendor/$VENDOR/$DEVICE/$) EOF (cat EOF) ../../../$OUTDIR/ Copyright (C) 2013 The Project Licensed under the Apache License, Version (the License)。 you may not use this file except in pliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. This file is generated by device/$VENDOR/$DEVICE/ USE_CAMERA_STUB := false EOF 這個(gè)腳本主要就是用來在vendor/oppo/find5目錄下生成兩個(gè)文件:。這兩個(gè)文件都是接下來為OPPO Find 5編譯ROM時(shí)要用到的。 :[plain] view plain copy 在CODE上查看代碼片派生到我的代碼片PRODUCT_COPY_FILES += \ vendor/oppo/find5/proprietary/bin/btnvtool:system/bin/btnvtool \ vendor/oppo/find5/proprietary/bin/ds_fmc_appd:system/bin/ds_fmc_appd \ vendor/oppo/find5/proprietary/bin/efsks:system/bin/efsks \ vendor/oppo/find5/proprietary/bin/hci_qm_init:system/bin/hci_qm_init \ vendor/oppo/fin