安卓9.0刷linux,Ubuntu系统下编译Android 9.0系统
8種機械鍵盤軸體對比
本人程序員,要買一個寫代碼的鍵盤,請問紅軸和茶軸怎么選?
前言
在Ubuntu系統下編譯Android系統。哎呀不知道是不是換了新電腦的緣故,這次編譯居然從安裝JDK和配置環境下載源碼他喵的一次成功了,想之前真的是那臺破電腦一堆問題最后好不容易才成功,不知道是不是跟我這臺電腦配置的關系以及內存還有安裝ubuntu的時候那幾個分區的大小有沒有關系。幾乎每個分區的大小都是推薦大小的好幾倍,尤其是那個交換空間分區不知道是不是。記錄一下編譯的過程。
安裝JDK
編譯Android系統需要JDK,可以在命令行安裝:1sudo apt install openjdk-8-jdk
沒有換源,一次成功,有的時候因為墻的原因可能會安裝不了可以換阿里的源。
下載源碼
下載源碼是用的清華的鏡像,以下幾個步驟:
下載 repo 工具:1
2
3
4mkdir ~/bin
PATH=~/bin:$PATH
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo
建立工作目錄:1
2mkdir android_9.0_r3
cd android_9.0_r3
安裝python:1sudo apt-get install python
初始化倉庫:1repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
如果需要某個特定的 Android 版本(列表):1repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android_9.0_r3
同步源碼樹(以后只需執行這條命令來同步):1repo sync
編譯源碼
在AOSP的根目錄,輸入如下的命令:1source build/envsetup.sh
選擇編譯目標:1lunch
lunch命令是envsetup.sh里定義的一個命令,用來讓用戶選擇編譯目標。
會有以下信息輸出:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_mips-eng
4. aosp_mips64-eng
5. aosp_x86-eng
6. aosp_x86_64-eng
7. aosp_car_arm-userdebug
8. aosp_car_arm64-userdebug
9. aosp_car_x86-userdebug
10. aosp_car_x86_64-userdebug
11. mini_emulator_arm64-userdebug
12. m_e_arm-userdebug
13. m_e_mips64-eng
14. m_e_mips-userdebug
15. mini_emulator_x86_64-userdebug
16. mini_emulator_x86-userdebug
17. uml-userdebug
18. aosp_cf_x86_auto-userdebug
19. aosp_cf_x86_phone-userdebug
20. aosp_cf_x86_tablet-userdebug
21. aosp_cf_x86_tablet_3g-userdebug
22. aosp_cf_x86_tv-userdebug
23. aosp_cf_x86_wear-userdebug
24. aosp_cf_x86_64_auto-userdebug
25. aosp_cf_x86_64_phone-userdebug
26. aosp_cf_x86_64_tablet-userdebug
27. aosp_cf_x86_64_tablet_3g-userdebug
28. aosp_cf_x86_64_tv-userdebug
29. aosp_cf_x86_64_wear-userdebug
30. cf_x86_auto-userdebug
31. cf_x86_phone-userdebug
32. cf_x86_tablet-userdebug
33. cf_x86_tablet_3g-userdebug
34. cf_x86_tv-userdebug
35. cf_x86_wear-userdebug
36. cf_x86_64_auto-userdebug
37. cf_x86_64_phone-userdebug
38. cf_x86_64_tablet-userdebug
39. cf_x86_64_tablet_3g-userdebug
40. cf_x86_64_tv-userdebug
41. cf_x86_64_wear-userdebug
42. aosp_marlin-userdebug
43. aosp_marlin_svelte-userdebug
44. aosp_sailfish-userdebug
45. aosp_walleye-userdebug
46. aosp_walleye_test-userdebug
47. aosp_taimen-userdebug
48. hikey-userdebug
49. hikey64_only-userdebug
50. hikey960-userdebug
Which would you like? [aosp_arm-eng]
選擇42,按回車。這可以安裝到pixel設備(之前的nexus也是)
編譯的幾種不同的類型:user:用來正式發布到市場的版本,權限受限,如沒有 root 權限,不能 dedug,adb默認處于停用狀態。
userdebug:在user版本的基礎上開放了 root 權限和 debug 權限,adb默認處于啟用狀態。一般用于調試真機。
eng:開發工程師的版本,擁有最大的權限(root等),具有額外調試工具的開發配置。一般用于模擬器。
開始編譯:1make -j16
編譯好后的狀態,會有一個out文件夾,因為只有nexus 6p沒有pixel手機了,所以沒有刷進手機,想來跟nexus刷這些鏡像文件沒什么大的區別吧。

一個小時兩分鐘編譯好,想之前用筆記本用了半天還不止。。。
編譯后產生的文件:system.img:系統鏡像,里面包含了Android系統主要的目錄和文件,通過init.c進行解析并mount掛載到/system目錄下。
userdata.img:用戶鏡像,是Android系統中存放用戶數據的,通過init.c進行解析并mount掛載到/data目錄下。
總結
以上是生活随笔為你收集整理的安卓9.0刷linux,Ubuntu系统下编译Android 9.0系统的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux compress tar,L
- 下一篇: linux系统中条码如何识别的,如何(可