Android source code compilation native emulator
Source code download
install repo
Make sure there is a bin/ directory under your home directory and included in your path:
mkdir ~/bin
PATH=~/bin:$PATH
Download the Repo tool, and make sure it is executable:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
view branch
repo init -u https://android.googlesource.com/platform/manifest
View android support branch version link
initialization
Use -b
to specify the corresponding branch.
repo init -u https://android.googlesource.com/platform/manifest -b android-12.1.0_r26
download
repo sync
code compilation
Order
source build/envsetup.sh
lunch $buildType
make -j4
$buildType
s Choice
Enter lunch in the terminal to see the supported build options
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_blueline_car-userdebug
4. aosp_bonito_car-userdebug
5. aosp_bramble_car-userdebug
6. aosp_car_arm-userdebug
7. aosp_car_arm64-userdebug
8. aosp_car_x86-userdebug
9. aosp_car_x86_64-userdebug
10. aosp_cf_arm64_auto-userdebug
11. aosp_cf_arm64_phone-userdebug
12. aosp_cf_x86_64_foldable-userdebug
13. aosp_cf_x86_64_pc-userdebug
14. aosp_cf_x86_64_phone-userdebug
15. aosp_cf_x86_64_tv-userdebug
16. aosp_cf_x86_auto-userdebug
17. aosp_cf_x86_phone-userdebug
18. aosp_cf_x86_tv-userdebug
19. aosp_coral_car-userdebug
20. aosp_crosshatch_car-userdebug
21. aosp_flame_car-userdebug
22. aosp_redfin_car-userdebug
23. aosp_sargo_car-userdebug
24. aosp_sunfish_car-userdebug
25. aosp_trout_arm64-userdebug
26. aosp_trout_x86-userdebuaosp_car_x86_64-userdebugg
27. aosp_x86-eng
28. aosp_x86_64-eng
29. arm_krait-eng
30. arm_v7_v8-eng
31. armv8-eng
32. armv8_cortex_a55-eng
33. armv8_kryo385-eng
34. beagle_x15-userdebug
35. beagle_x15_auto-userdebug
36. car_x86_64-userdebug
37. db845c-userdebug
38. gsi_car_arm64-userdebug
39. gsi_car_x86_64-userdebug
40. hikey-userdebug
41. hikey64_only-userdebug
42. hikey960-userdebug
43. hikey960_tv-userdebug
44. hikey_tv-userdebug
45. pixel3_mainline-userdebug
46. poplar-eng
47. poplar-user
48. poplar-userdebug
49. qemu_trusty_arm64-userdebug
50. sdk_car_arm-userdebug
51. sdk_car_arm64-userdebug
52. sdk_car_x86-userdebug
53. sdk_car_x86_64-userdebug
54. silvermont-eng
55. uml-userdebug
56. yukawa-userdebug
57. yukawa_sei510-userdebug
Among them, the aosp_car_arm-userdebug
since description aosp_car
indicates the platform, arm
indicates the platform architecture, and userdebug
indicates the compilation type.
compile
make
The command can compile the system, and can also compile a module separately, such as
make systemimage
Compile the system partition image
make vendorimage
Compile the vendor partition image
make SystemUI
compile SystemUI
make Gallery
Compile the album
make framework
Compile the framework framework
compilation problem
Refer to the Android source code compilation problem
run emulator
Order
emulator
mistake
cannot add library /home/jun/data/AOSP12/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
added library /home/jun/data/AOSP12/prebuilts/android-emulator/linux-x86_64/lib64/vulkan/libvulkan.so
INTEL-MESA: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0
configAndStartRenderer: setting vsync to 60 hz
qemu-system-x86_64: Could not open '/home/jun/data/AOSP12/out/target/product/generic_car_x86_64/userdata-qemu.img': No such file or directory
Not found userdata-qemu.img
We need to switch the compile option to sdk...
something likesdk_car_x86_64-userdebug
Re-runemulator
ref