One-click Image Compilation Script
Huawei provides an automation script for compiling the Kbox Android image. This script contains the entire compilation process. If you use the automation script to compile an image based on this section, you can skip the following sections in the "Software Compilation" chapter and start software deployment.
The automation script implements the operations described in Installing Dependency Packages and Compiling the AOSP Source Code and Creating an Image. To use the automation script, you need to prepare the AOSP source code, Kbox binary package provided by Huawei, ExaGear transcoding package, Android code patch package, and compilation script package. Obtain them based on Table 1. To use the automation script, perform the following steps:
- Create an auto_compile directory under the /home directory to store the AOSP source code and the automation script.
Ensure that the available space of the /home directory exceeds 250 GB.
mkdir -p /home/auto_compile cd /home/auto_compile
- Download the AOSP source code (version: android-11.0.0_r48) to the /home/auto_compile directory. Rename the AOSP source code directory aosp.
- Download Kbox-AOSP11.zip to the local host based on Software Environment, upload it to the /home/auto_compile directory on the server, and decompress it.
cd /home/auto_compile unzip Kbox-AOSP11.zip
- Modify the container network configuration.
- Open the kbox11_android_build.sh script.
cd /home/auto_compile/Kbox-AOSP11/make_img_sample/kbox11_android_build vim kbox11_android_build.sh
- Press i to enter the insert mode and modify the following three lines to configure the DNS address, network address, and subnet mask of the container. Ensure that the configured addresses are available and perform the configuration following the file format. Otherwise, the compiled image may be unavailable. The format is as follows:
DNS=xx.xx.xx.xx ADDRESS=xx.xx.xx.xx NETMASK=xx.xx.xx.xx
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the kbox11_android_build.sh script.
- Download the Android Kbox binary package and ExaGear transcoding package to the local host based on Software Environment. Create a package folder in the following specified directory:
cd /home/auto_compile/Kbox-AOSP11/make_img_sample/kbox11_android_build mkdir -p package
Upload the packages to the /home/auto_compile/Kbox-AOSP11/make_img_sample/kbox11_android_build/package directory on the server.
- Run the kbox11_android_build.sh automation script to complete Kbox compilation.
cd /home/auto_compile/Kbox-AOSP11/make_img_sample/kbox11_android_build && chmod +x kbox11_android_build.sh ./kbox11_android_build.sh
The script execution takes a long time. If the script is executed successfully, the following information is displayed. If an error is reported during the execution, check the script and contact Huawei technical support.
---------------Success-------------- /home/auto_compile/aosp/android.tar ---------------End--------------
There is a possibility that the message "'format_info.h' file not found" is displayed during script execution. The cause is that the generation of this header file is delayed occasionally. This file is required during mesa compilation with multi-threading enabled. As a result, the compilation fails.
../src/mesa/main/formats.c:81:10: fatal error: 'format_info.h' file not found #include "format_info.h" 1 error generated.
To rectify the fault, perform the following steps:
- Make the environment variables take effect.
source ~/.bashrc
- Perform the compilation again.
cd /home/auto_compile/aosp source build/envsetup.sh lunch kbox_arm64-user make -j
If the same error occurs, perform the compilation again until the error does not occur.make -j
If the execution is successful, the following information is displayed:#### build completed successfully (xx:xx (mm:ss)) ####
- Run the following commands to generate a Kbox image android.tar:
cp -r /home/auto_compile/Kbox-AOSP11/make_img_sample/kbox11_android_build/create-package.sh /home/auto_compile/aosp chmod +x create-package.sh ./create-package.sh /home/auto_compile/aosp/out/target/product/arm64/system.img
The Kbox Android image is created. A Kbox image named android.tar is generated in the AOSP source code directory.
- Make the environment variables take effect.