AOSP內核原始碼組成
Android內核完整原始碼包括:內核原始碼,用于編譯內核的所有工具,以及編譯腳本build/build.sh用于構建內核使用,
其中,內核源代碼中根目錄下包括編譯腳本build/build.sh,Android原始碼樹僅包含預編譯的內核二進制檔案,
android內核原始碼下載程序
官方鏈接參考https://source.android.com/setup/build/building-kernels#customize-build
官方具體步驟如下:
最新的內核,可以使用repo下載原始碼代碼,工具鏈和構建腳本,一些內核(例如,Pixel 3內核)需要從多個git代碼庫獲取原始碼,而其他內核(通用內核)只需要一份源代碼,使用repo方法可缺包源目錄設定正確,
下載程序如下:
$ mkdir android-kernel && cd android-kernel
$ repo init -u https://android.googlesource.com/kernel/manifest -b BRANCH
$ repo sync
分支Branch如下:不同的設備對應不同的分支原始碼

注意:上面的下載有2個問題:(1)國內無法下載 https://android.googlesource.com,如何解決?(2)BRANCH分支全是android11的,并不是android10,如果解決?
問題(1)需要替換鏡像,國內有很多鏡像源可以使用(中科大,華科),我通常選擇清華鏡像,步驟如下:
步驟如上述程序,但是依據清華官方的鏡像使用方法: 將 https://android.googlesource.com/ 全部使用 https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/ 代替即可,
內核原始碼下載之后,記得修改reop檔案內部的repo_url內部的 https://android.googlesource.com/ 再次替換為 https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/ ,
問題(2)我們下的是android10的內核,最后應該是數字10才對,可以從官方原始碼網站確認:https://android.googlesource.com/kernel/manifest/+refs,
同時也可以從該博客確認:https://blog.csdn.net/u010164190/article/details/106561022 ; https://groups.google.com/g/android-building/c/Zj5VVapM8H8/m/wYc2KAQNAwAJ?pli=1
附:
google官方的android原始碼查看鏈接:https://android.googlesource.com/?format=HTML
android原始碼:
repo init -u https://android.googlesource.com/platform/manifest

其中android 原始碼下載說明的官方檔案鏈接:https://source.android.com/setup/build/downloading
android 內核代碼
repo init -u https://android.googlesource.com/kernel/manifest -b BRANCH

其中android內核原始碼下載說明的官方檔案鏈接:https://source.android.com/setup/build/building-kernels#customize-build
清華鏡像鏈接:https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/250706.html
標籤:其他
