Step1:獲取源碼:
拿到Mediatek的授權後,我們就可以取得AP和Modem 2個部分的源碼;
Step2:安裝GCC環境
For LR12A:
Codescape GCC MIPS cross-compiler v4.9.2 (2016.05-08)
It can be downloaded from :
https://codescape.mips.com/components/toolchain/2016.05-08/downloads.html
--> Find the keyword "MTI Bare Metal Toolchain MIPS32R2-MIPS32R5, MIPS64R2-MIPS64R5 and microMIPS"
--> Click the the button of "Linux x64"(.tar.gz) and download the Codescape GCC MIPS compiler
Or you can use the following link to download Codescape GCC MIPS compiler directly:
https://codescape.mips.com/components/toolchain/2016.05-08/Codescape.GNU.Tools.Package.2016.05-08.for.MIPS.MTI.Bare.Metal.CentOS-5.x86_64.tar.gz
For LR13:
Codescape GCC MIPS cross-compiler v6.3.0 (2017.10-08)
It can be downloaded from :
https://codescape.mips.com/components/toolchain/2017.10-08/downloads.html
--> Find the keyword "MTI Bare Metal Toolchain MIPS32R2-MIPS32R5, MIPS64R2-MIPS64R5 and microMIPS"
--> Click the the button of "Linux x64"(.tar.gz) and download GCC MIPS compiler
Or you can use the following link to download Codescape GCC MIPS compiler directly:
https://codescape.mips.com/components/toolchain/2017.10-08/Codescape.GNU.Tools.Package.2017.10-08.for.MIPS.MTI.Bare.Metal.CentOS-5.x86_64.tar.gz
每一個晶片的Modem要求的GCC版本不一樣,我們可以參考vendor\mediatek\release_note下的說明文檔,把GCC拷貝到mcu\common\tools\GCC\MIPS\4.9.2下。
Step3: 安裝Android NDK及patch
Please make sure the following Android NDK (Native Development Kit) is appropriate for the build system:
1. Android NDK r14b (for generate modem application service package)
Please refer to the following steps to download Android NDK:
1. Visit Android NDK toolchain download website:
https://developer.android.com/ndk/downloads/older_releases.html
2. Find the keyword "Linux 64-bit (x86)" in "Android NDK, Revision 14b (March 2017)".
3. Click the "android-ndk-r14b-linux-x86_64.zip" to download.
Or you can use the following link to download Android NDK directly:
https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip
NOTE: Please unzip the zip file of Android NDK under the path "apps/NDK".
2. Apply Android NDK r14b bug fix patch (Change ID: Ic558a4b0329093241aae5d4f34ecde8d1cbb0564)
Please refer to the following steps to apply Android NDK r14b patch:
1. Visit bug fix patch page on Android Open Source Project website:
https://android-review.googlesource.com/q/Ic558a4b0329093241aae5d4f34ecde8d1cbb0564
2. click "build/core/build-binary.mk" and "build/core/default-build-commands.mk" as the right image to show the patch diffs.
3. modify the corresponfing files under "apps/NDK/android-ndk-r14b/" folder to apply the bug fix.
Step4:編譯modem源碼,首先我們進入mcu\make\projects選擇相應的工程,下面我們以TK_MD_BASIC(LWCTG_6177M_TB_8768A).mak為例。
cd mcu
./m "TK_MD_BASIC(LWCTG_6177M_TB_8768A).mak" new
Step5:執行modemRenameCopy.pl腳本
In ALPS codebase, run command:
perl device/mediatek/build/build/tools/modemRenameCopy.pl ./ "TK_MD_BASIC(LWCTG_6177M_TB_8768A).mak"
執行modemRenameCopy.pl腳本,這個步驟一定不能漏掉。它的作用是把所有需要拷貝到AP端的文件收集到temp_modem文件夾中(modem codebase根目錄下),並且還會生成一個Android.mk文件。
Step 6:拷貝modem image到AP
執行modemRenameCopy.pl腳本之後,需要把temp_modem文件夾拷貝到AP。AP端路徑:
alps/vendor/mediatek/proprietary/modem/[temp_modem]
[temp_modem]文件夾拷貝到AP端之後,文件夾名可以自行更改,請和device\mediateksample\tb8768p1_64_bsp里ProjectConfig.mk定義的名字匹配custom_modem=mt6762_sp_lwctg_6177m_tb_umoly0164_prod
Step 7:編譯APPS
cd apps
./build.sh clean,build,pack all GEN93_USER
Step 8:把編譯APPS生成的文件拷貝到AP
init_rc/, 拷貝到alps/vendor/mediatek/proprietary/modem/mt6762_sp_lwctg_6177m_tb_umoly0164_prod/init_rc/
sepolicy/,拷貝到alps/vendor/mediatek/proprietary/modem/mt6762_sp_lwctg_6177m_tb_umoly0164_prod/sepolicy/
makefile/,拷貝到alps/vendor/mediatek/proprietary/modem/mt6762_sp_lwctg_6177m_tb_umoly0164_prod/makefile/
libs/, 拷貝到alps/vendor/mediatek/proprietary/modem/mt6762_sp_lwctg_6177m_tb_umoly0164_prod/libs/
Step 9,編譯整個AP
python vendor/mediatek/proprietary/scripts/releasetools/split_build_helper.py --run full_tb8768p1_64_bsp-userdebug |tee 2>&1 build.log
編譯結束。
評論