我要评分
获取效率
正确性
完整性
易理解

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:

  1. Create an auto_compile directory under the /home directory to store the AOSP source code and the automation script.

    Ensure that the free space of the /home directory is greater than 250 GB. You can run the df -h command to check the remaining space.

    1
    2
    mkdir -p /home/auto_compile
    cd /home/auto_compile
    
  2. Download the AOSP source code (version: android-11.0.0_r48) to the /home/auto_compile directory. Rename the AOSP source code directory aosp.
  3. 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
  4. Modify the container network configuration.
    1. Open the kbox11_android_build.sh script.
      1
      2
      cd /home/auto_compile/Kbox-AOSP11/make_img_sample/kbox11_android_build
      vim kbox11_android_build.sh
      
    2. Press i to enter the insert mode and set the DNS address of the container. Ensure that the configured address is valid and correct in format. Otherwise, the compiled image may be unavailable. The format is as follows:
      1
      DNS=xx.xx.xx.xx
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. Download the Android Kbox binary package, ExaGear transcoding package, source packages of Meson/Mesa/LLVM/libdrm/libva, and cloud phone application installation package to the local host based on Software Environment. Create a package folder in the following specified directory:
    1
    2
    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.

  6. Run the kbox11_android_build.sh automation script to complete Kbox compilation.
    1
    2
    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.

    1
    2
    3
    ---------------Success--------------
    /home/auto_compile/aosp/android.tar
    ---------------End--------------
    

    The Kbox Android image is created. A Kbox image named android.tar is generated in the AOSP source code directory.

Troubleshooting

Symptom

When the kbox11_android_build.sh script is executed, there is a possibility that the message "'format_info.h' file not found" is displayed. 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.

1
2
3
../src/mesa/main/formats.c:81:10: fatal error: 'format_info.h' file not found
#include "format_info.h"
1 error generated.

Solution

  1. Make the environment variables take effect.
    1
    source ~/.bashrc
    
  2. Perform the compilation again.
    1
    2
    3
    4
    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.
    1
    make -j
    
    If the execution is successful, the following information is displayed:
    1
    #### build completed successfully (xx:xx (mm:ss)) ####
    
  3. Run the following commands to generate a Kbox image android.tar:
    1
    2
    3
    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