G720 compilation environment based on Docker

When I set up a G720 Android V build environment using Docker, the compilation completes, but after flashing the EVK, the system fails to boot.

Conversely, when I set up a development environment directly on a physical PC, the compilation completes, the EVK is flashed, and the system runs normally.

Since the compilation on Docker completes without error messages, how can I troubleshoot any incompatibilities with Docker?

Hi Jackey_Chen,


Please Follow These Troubleshooting Steps

  1. Identify the Point of Failure (UART Console)

    • Capture the Serial (UART) log from your EVK during the boot failure.
    • Where does booting halt?
      • Bootloader (U-Boot/Fastboot): Corrupted partition table or header.
      • Kernel Panic: Missing drivers, incorrect DTB (Device Tree Blob), or memory issues.
      • Android Init (Boot loop/Logo): Filesystem permission problem, missing shared libraries, or SELinux denials.
    • Compare UART Logs: Side-by-side comparison of “Working” vs “Docker” builds helps isolate divergence.

  1. Compare Build Artifacts (Binary Diff)

    • If source code is identical, outputs should match closely.
    • Checksums:
      Run on critical images:
      md5sum boot.img system.img vendor.img dtbo.img
      
    • Size Check:
      Ensure file sizes are identical to rule out sparse image/padding issues.
    • Deep Diff:
      • If system.img differs, unpack with img2simg/simg2img and compare contents.

  1. Compare the Build Environments

    • Dump Environment Variables:
      # In Docker
      printenv > env_docker.txt
      # On PC
      printenv > env_pc.txt
      diff env_docker.txt env_pc.txt
      
    • Key variables: PATH, LD_LIBRARY_PATH, LANG, LC_ALL
    • Locale Sensitivity:
      • Set locale to C inside Docker:
        ENV LC_ALL=C
        

  1. Filesystem and Mapping Issues (Common Docker Pitfalls)

    • Case Sensitivity:
      Host filesystems (macOS/Windows) are case-insensitive; Android requires case-sensitive (e.g., Ext4).
    • Symbolic Links:
      Ensure symlinks are preserved, especially if building on a mounted volume:
      find . -type l
      
    • Permissions (UID/GID):
      Permission mismatches (root vs. user) can cause “Permission Denied” errors inside .img files.

  1. Toolchain and Host Dependencies

    • Library Consistency:
      Docker must have all packages listed in Android Open Source Project (AOSP) requirements (e.g., libncurses5, libssl-dev, python3-mako).
    • Python Sensitivity:
      Ensure Docker uses the same Python version as on PC (Android V is especially sensitive).
    • Check Tool Versions:
      Compare mkbootimg, sign_target_files_apks, etc. between environments.

  1. Recommended Test: “The Clean Docker Build”

    • Standard Image:
      Use trusted base images like ubuntu:20.04 or ubuntu:22.04.
    • Avoid Host Mounts:
      Instead of mounting source, clone it inside Docker volume to avoid translation issues.
    • Host Kernel Caution:
      Docker uses the host’s kernel. Rarely, a very old or custom kernel can impact build tools using syscalls.