問題描述
有沒有人成功編譯安卓內核并在安卓模擬器中測試過,如果有,有什么特別需要做的嗎?
Has anyone successfully compiled the android kernel and tested it in the Android emulator, and if so is there anything that special that needs to be done?
SDK 的文檔非常好,但是我很難找到編譯內核和在模擬器中設置自定義機器的文檔.
Documentation for the SDK is excellent, however documentation for compiling the kernel and setting up a custom machine in the emulator has been hard for me to find.
推薦答案
自 2009 年 8 月起,當您按照說明下載 android 開源項目的源代碼時,內核不再是標準 repo 清單的一部分.在模擬器上成功下載、構建和運行特定內核所需的步驟如下:
Since August 2009 the kernel is no longer part of the standard repo manifest that you get when you follow the instructions to download the source code for the android open source project. The steps that are needed to successfully download, build and run a specific kernel on the emulator are as follows:
- 通過將 Android 內核添加到您的存儲庫清單或通過運行手動獲取 Android 內核:
git clone https://android.googlesource.com/kernel/goldfish.git
- 查看使用模擬器的正確分支,即金魚:
git checkout -t origin/android-goldfish-2.6.29 -b goldfish
- 生成模擬器配置(qemu模擬器運行arm代碼,即arm配置):
制作 ARCH=arm goldfish_defconfig
- 如果這不起作用,請嘗試
make ARCH=arm goldfish_armv7_defconfig
請注意,我在上述說明中使用了默認路徑,您需要將它們更改為適用于您的設置的路徑.自從我上次測試以來已經有一段時間了,但我認為它應該可以工作.
Note that I have used the default paths in the above description, you need to change them to what applies to your setup. It has been a some time since last time I tested this but I think it should work.
一些額外的信息:在標準的 Android 開源分發中,內核作為預構建的二進制文件分發在
mydroid/prebuilt/android-arm/kernel
文件夾中,并且不包含源代碼.我認為內核源代碼已從默認清單中刪除,原因有兩個.一個是大多數人不會使用的平臺組件需要大量帶寬和磁盤空間.另一個原因是,由于內核是使用內核構建系統構建的,而不是作為 aosp 構建系統的一部分,因此將其分開是有意義的.內核的公共分支是模擬器使用的分支.還有experimental、msm(Qualcomm 平臺)和Omap(TI 平臺)等分支.如果您想將 Android 內核與硬件一起使用,您可能會更感興趣.Some extra information: In the standard Android open source distribution the kernel is distributed as a pre-built binary in the
mydroid/prebuilt/android-arm/kernel
folder and the source code is not included. The kernel source was removed from the default manifest for two reasons as I take it. One is that it takes a lot of bandwith and diskspace for a platform component that most people will not work with much. The other reason is that since the kernel is built with the kernel build system and not as part of the aosp build system it makes sense to keep it separated. The common branch for the kernel is the one used by the emulator. There are also branches for experimental, msm (Qualcomm platforms) and Omap (TI platform) and maybe some more. If you want to use the Android kernel with hardware these may be more interesting to you.這篇關于如何編譯 Android AOSP 內核并使用 Android Emulator 對其進行測試?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持! - 如果這不起作用,請嘗試