9.2.2 Booting Android graphics software stack on virtual GPU

The boot process contains multiple command-line steps performed on both the host and the target terminals. This virtual boot-up helps you eliminate integration issues from the graphics software stack before migration onto real hardware.

Prerequisites

Make sure that you:

  • Meet the requirements listed in Introduction to Graphics Register Model.
  • Use Fast Models 10.3.016 or later.

  • Installed ARM Mali OpenGL ES Emulator.

    For the installation, see Installing the ARM Mali OpenGL ES Emulator.

  • Built a virtual system with the GPU included.

    For details, see Modeling a GPU system with GRM.

  • Enabled the GPU in the device tree.
  • Prepared an Android image file that contains Mali graphics drivers. The file suffix is .img.

    Note:

    Before the image file creation, you must follow the README file to generate the libnwhal.so file.

    libnwhal.so serves GGA to collect data from the Android native window handle objects.

    The path of the README file is: $PVLIB_HOME/GGA/HAL/readme.txt.

Procedure

  1. Boot the Android image by using Generic Graphics Acceleration (GGA) to resolve all errors at the application level.

    After that, errors from the Mali driver can be more easily detected.

    For the boot with GGA, see Generic Graphics Accelerator.

  2. From the directory where you booted with GGA, open the settings.ini file.
    For details about settings.ini, see Configuration.
  3. In the file, set callOnTargetAPI to 1 to enable GGA to support GRM.
  4. On the host, execute the boot command to launch the target system. For the command, see Boot commands.

    New terminals open to demonstrate the target system.

  5. From the host, push Shim libraries onto the target.
    For details, see Pushing Shim libraries onto the target in GRM.
  6. On the host, enter the following commands to disable the OpenGL ES preload feature from the target driver.
    adb remount
    adb shell sed -i '/ro.zygote.disable_gl_preload=/d' /system/build.prop
    adb shell "echo \"ro.zygote.disable_gl_preload=true\" >> /system/build.prop"
  7. On the host, enter the following commands to enable the hardware rendering.
    The commands are different for Linaro, and 32-bit and 64-bit Android:
    • Android 64-bit:
      adb remount
      adb shell sed -i '1,/ro.kernel.qemu/s/ro.kernel.qemu/No.kernel.qemu/' /system/lib/libEGL.so
      adb shell sed -i '1,/ro.kernel.qemu/s/ro.kernel.qemu/No.kernel.qemu/' /system/lib64/libEGL.so
    • Android 32-bit:
      adb remount
      adb shell sed -i '1,/ro.kernel.qemu/s/ro.kernel.qemu/No.kernel.qemu/' /system/lib/libEGL.so
    • Some Linaro distributions of Android 64-bit:
      adb remount
      adb shell sed -i '1,/ro.kernel.qemu/s/ro.kernel.qemu/No.kernel.qemu/' /system/lib/libEGL.so
      adb shell sed -i '1,/ro.kernel.qemu/s/ro.kernel.qemu/No.kernel.qemu/' /system/lib64/libEGL.so
      adb shell sed -i 's/ro.nohardwaregfx=true/ro.nohardwaregfx=false/' /system/build.prop
    • Some Linaro distributions of Android 32-bit:
      adb remount
      adb shell sed -i '1,/ro.kernel.qemu/s/ro.kernel.qemu/No.kernel.qemu/' /system/lib/libEGL.so
      adb shell sed -i 's/ro.nohardwaregfx=true/ro.nohardwaregfx=false/' /system/build.prop
  8. On the host, enter the following commands to reboot Android.
    adb shell sync
    adb shell reboot

Results

  • During booting:
    • The host terminal outputs information about the virtual GPU system.
    • To view the processing details about the graphics software stack, such as OpenGL ES APIs and the Mali driver executions, from the target terminal, enter logcat.

    • A graphical window opens.
  • If the target system boots up, you see:

    • The target outputs the message mali 2d000000.gpu: Probed as mali0, which indicates that the driver has recognized the GPU and starts control.
    • Android operating system displays in the graphical window. You can operate Android with the mouse.

  • If the boot fails, study the messages carefully and diagnose the root causes.

    You can use the GRM-provided functions to diagnose the driver issues on the execution of OpenGL ES and on the GPU control. For details, see Diagnosing graphics software stack problems with GRM.

    During debugging, if you modified the model file or the .img file, you must repeat the boot-up procedure again.

    Note:

    To quit the boot, from the host, use the kill command.

What to do next

Perform further diagnostics on the driver integrations with both the OpenGL ES and the GPU.

You can:

Boot commands

The boot command launches a virtual GPU system and boots Android on it.

The command employs different options to:

  • Execute the model file.
  • Activate the graphics acceleration function.
  • Connect the host with the target systems.
  • Load and execute the boot loaders and the file systems.

The options vary among different virtual platforms. To view options for specific platforms, execute the model file with the --list-params option.

Example

The following example shows both the Linux and Windows commands to boot Android on a virtual system. The name of the virtual system model file is FVP_CSS_Subsys.

  • The command entered on the Linux host is:

    ${PATH_ModelFile} \ 
    -C css.trustedBootROMloader.fname=${BINDIR}/tf-bl1.bin \ 
    -C css.scp.ROMloader.fname=${BINDIR}/scp-rom.bin \ 
    -C soc.pl011_uart0.out_file=${OUTPUT_DIR}/soc-uart0 \
    -C soc.pl011_uart1.out_file=${OUTPUT_DIR}/soc-uart1 \ 
    -C config_id=0 \ 
    -C displayController=${Controller} \ 
    -C board.hostbridge.interfaceName=subsys0 \
    -C board.hostbridge.userNetworking=1 \ 
    -C board.hostbridge.userNetPorts=6901=5555 \ 
    -C board.smsc_91c111.enabled=1 \ 
    -C board.smsc_91c111.mac_address=auto \ 
    -S -R \
    -C css.cache_state_modelled=0 \
    -C board.flashloader0.fname=${BINDIR}/fip-uboot.bin \
    --data css.cluster0.cpu0=${CPU0_dtb} \ 
    --data css.cluster0.cpu0=${CPU0_Initrd} \ 
    --data css.cluster0.cpu0=${CPU0_uImage} \
    -C board.virtioblockdevice.image_path=${BIN_Image} \
    --plugin ${PATH_SideChannel}/Sidechannel.so \
    -C DEBUG.Sidechannel.interceptor=${PATH_Reconciler}/libReconciler.so 
  • The command entered on the Windows host is:

    ${PATH_ModelFile}^ 
    -C css.trustedBootROMloader.fname=${BINDIR}\tf-bl1.bin^ 
    -C css.scp.ROMloader.fname=${BINDIR}\scp-rom.bin^ 
    -C soc.pl011_uart0.out_file=${OUTPUT_DIR}\soc-uart0^
    -C soc.pl011_uart1.out_file=${OUTPUT_DIR}\soc-uart1^ 
    -C config_id=0^ 
    -C displayController=${Controller}^ 
    -C board.hostbridge.interfaceName=subsys0^
    -C board.hostbridge.userNetworking=1^ 
    -C board.hostbridge.userNetPorts=6901=5555^ 
    -C board.smsc_91c111.enabled=1^ 
    -C board.smsc_91c111.mac_address=auto^ 
    -S -R^
    -C css.cache_state_modelled=0^
    -C board.flashloader0.fname=${BINDIR}\fip-uboot.bin^
    --data css.cluster0.cpu0=${CPU0_dtb}^ 
    --data css.cluster0.cpu0=${CPU0_Initrd}^ 
    --data css.cluster0.cpu0=${CPU0_uImage}^
    -C board.virtioblockdevice.image_path=${BIN_Image}^
    --plugin ${PATH_SideChannel}\Sidechannel.so^
    -C DEBUG.Sidechannel.interceptor=${PATH_Reconciler}\libReconciler.so 

Note:

For the option board.hostbridge.userNetPorts, you must use a new port for the first value. For the second value, you can use any port. In the above example, the new port is 6901.

Pushing the Shim libraries onto the target in GRM

Use the adb command to push the Shim libraries onto the target.

About this task

The Shim libraries transfer OpenGL ES API data from the target to the host to use the host GPU for fast rendering.

Before you begin

Make sure that the Android SDK is installed.

Procedure

  1. From the host, enter the following commands:

    On Linux:

    export PATH=$PATH:<path of android-sdk-linux>/platform-tools/
    adb connect localhost:6901

    On Windows:

    set PATH=%PATH%;<installation_directory>\<path of android-sdk-windows>\platform-tools
    adb connect localhost:6901

    Note:

    The port number here must be identical to the first value in board.hostbridge.userNetPorts. For more details, see the Example section in Boot commands.
  2. From the target terminal, launch the adbd service with the following commands:
    su
    ifconfig eth0 up
    dhcptool eth0
    stop adbd
    setprop service.adb.tcp.port 6901
    start adbd
  3. From the host, connect to the target with the following command:
    adb connect localhost:6901
  4. From the host, change the Mali GLES library directories on the target. The commands are:
    adb shell mv /system/vendor/lib64/egl/libGLES_mali.so /system/lib64/libmali.so
    adb shell mv /system/vendor/lib/egl/libGLES_mali.so /system/lib/libmali.so
  5. From the host, remove libEGL*.so and libGLES*.so from the target.

    Note:

    Remember to back up the needed files before removal.

    The commands are:

    adb shell rm /system/vendor/lib/egl/libEGL*.so
    adb shell rm /system/vendor/lib/egl/libGLES*.so
    adb shell rm /system/vendor/lib64/egl/libEGL*.so
    adb shell rm /system/vendor/lib64/egl/libGLES*.so
    
  6. From the host, enter into the $PVLIB_HOME directory that contains the Generic Graphics Acceleration package.
  7. In this directory, use the following commands to push the Shim libraries from the host to the target.
    Commands are different between 32-bit and 64-bit Android targets.

    For 64-bit:

    • The Linux commands are:

      adb remount
      
      adb push  GGA/shim/linux-armv7sfl/rel/libGLES.so   /system/vendor/lib/egl/libGLES_vimpl.so
      adb push  GGA/shim/linux-armv7sfl/rel/<platform>/libnwhal.so       /system/lib/libnwhal.so
      
      adb push  GGA/shim/linux-armv8l_64/rel/libGLES.so  /system/vendor/lib64/egl/libGLES_vimpl.so
      adb push  GGA/shim/linux-armv8l_64/rel/<platform>/libnwhal.so      /system/lib64/libnwhal.so
      
      adb shell chmod 0644 /system/lib/libnwhal.so
      adb shell chmod 0644 /system/vendor/lib/egl/libGLES_vimpl.so
      adb shell chmod 0644 /system/lib64/libnwhal.so
      adb shell chmod 0644 /system/vendor/lib64/egl/libGLES_vimpl.so
      
    • The Windows commands are:

      adb remount
      
      adb push  GGA\shim\linux-armv7sfl\rel\libGLES.so   /system/vendor/lib/egl/libGLES_vimpl.so
      adb push  GGA\shim\linux-armv7sfl\rel\<platform>\libnwhal.so       /system/lib/libnwhal.so
      
      adb push  GGA\shim\linux-armv8l_64\rel\libGLES.so  /system/vendor/lib64/egl/libGLES_vimpl.so
      adb push  GGA\shim\linux-armv8l_64/rel\<platform>\libnwhal.so      /system/lib64/libnwhal.so
      
      adb shell chmod 0644 /system/lib/libnwhal.so
      adb shell chmod 0644 /system/vendor/lib/egl/libGLES_vimpl.so
      adb shell chmod 0644 /system/lib64/libnwhal.so
      adb shell chmod 0644 /system/vendor/lib64/egl/libGLES_vimpl.so
      

    For 32-bit:

    • The Linux commands are:

      adb remount
      
      adb push  GGA/shim/linux-armv7sfl/rel/libGLES.so /system/vendor/lib/egl/libGLES_vimpl.so
      adb push  GGA/shim/linux-armv7sfl/rel/<platform>/libnwhal.so     /system/lib/libnwhal.so
      
      adb shell chmod 0644 system/vendor/lib/egl/libGLES_vimpl.so
      adb shell chmod 0644 /system/lib/libnwhal.so
      
    • The Window commands are:

      adb remount
      
      adb push  GGA\shim\linux-armv7sfl\rel\libGLES.so /system/vendor/lib/egl/libGLES_vimpl.so
      adb push  GGA\shim\linux-armv7sfl\rel\<platform>\libnwhal.so     /system/lib/libnwhal.so
      
      adb shell chmod 0644 system/vendor/lib/egl/libGLES_vimpl.so
      adb shell chmod 0644 /system/lib/libnwhal.so
      
Non-ConfidentialPDF file icon PDF versionARM 100965_1101_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.