AOSP presets third-party applications

1. Select the aosp version that needs to be compiled

Download the source code and compile it, here you can refer to the articles on the Internet to operate AOSP image use help

// 进入aosp目录,初始化编译环境,选择对应的版本;没有实体机,直接编译运行在虚拟机的版本
source build/envsetup.sh
lunch sdk_phone_x86_64-userdebug

2. Configure third-party app related information

1. Put the third-party source code or apk file into the corresponding folder

As shown below, the source code of the SecondApplication application has been placed in the apps directory, and the corresponding Android.bp or Android.mk file can be filled in by referring to online articles. After the setting is complete, you can use the mm or mmm command to compile the module first to see if it can be compiled successfully.

insert image description here

2. Configure SecondApplication related compilation information

According to the above content, when selecting the compiled version, the sdk_phone_x86__64 version was selected. In fact, this version, in aosp13, does not have this option when directly lunching, but this version does exist. We can build/target/product/file You can see the corresponding compiled files in the folder:

insert image description here
Open the sdk_phone_x86_64.mk file and look at the content in the red box. The third-party applications we need to preset are set in the aosp_product.mk file, where SRC_TARGET_DIR means build/tartget, so the location of aosp_product.mk is build/tartget/product /aosp_product.mk.

insert image description here
Open the build/tartget/product/aosp_product.mk file for configuration, and add the application information that needs to be preset in PRODUCT_PACKAGES.

insert image description here

3. Compilation and results

After the above configuration is completed, you can directly use the make command to compile the source code and generate the corresponding img image file. If the compiled file is modified as shown in the figure below, the mk file will also be modified during the compilation process.

insert image description here
After compiling, you can directly use the emulator command to start the emulator, or use emulator -system out/target/product/emulator_x86_64/system-qemu.img to select the corresponding image file to start the emulator.

insert image description here

Guess you like

Origin blog.csdn.net/qq_36224961/article/details/131148996