8.2.1 Booting Android targets for the first time

The first boot is performed with both software and hardware acceleration.

Before you begin

Make sure that both the host and the target meet the conditions described in 8.1.2 Prerequisites.

Procedure

  1. Boot an Android target on Fast Models without using the Generic Graphics Accelerator.

    Fast Models emulates the target with software graphics acceleration. For details, see Booting Android targets with software acceleration.

  2. Enable the Generic Graphics Accelerator for the target.

    To do this, push the Shim libraries from the host to the target. For details, see Enabling the Generic Graphics Accelerator.

  3. Boot the target with the Generic Graphics Accelerator support.

    With the Generic Graphics Accelerator enabled, Fast Models employs the host graphics hardware to accelerate the target boot. For more details, see Booting Android targets with the Generic Graphics Accelerator.

  4. Test the target graphics with test applications.
    For the installation and execution of applications on Android targets, see Installing applications on Android targets.
  5. If the target platform includes one of the GPU register models, Mali™-G71, Mali-G72, or Mali-G51, and the Fast Models version is 10.3.016 or later, to debug the target graphics software stack integration, boot the target again as described in Integrating the graphics driver with the GPU model.
    For information about debugging the integration, see Debugging graphics software stack integration.

What to do next

Use hardware acceleration independently to boot the target, in which case you can use the boot command as described in 8.2.2 Booting Android targets.

Booting Android targets with software acceleration

Fast Models boots Android targets to use software acceleration when the Generic Graphics Accelerator is disabled.

Before you begin

Make sure:

  • Both the host and the target systems meet the conditions as described in 8.1.2 Prerequisites.

  • Both the Android binary image and the target platform model are available.

Procedure

  1. On the host, enter the boot command from the directory of the Android target.

    Note:

    For convenience, you can use the same command as to boot the target with the Generic Graphics Accelerator. The command options that are related to the Generic Graphics Accelerator are skipped when the Generic Graphics Accelerator is disabled.

    For the command, see Example: Booting an Android target to verify the OS.

Results

If the boot is successful, the default Android desktop is displayed on the screen.

What to do next

Enable the Generic Graphics Accelerator to reboot Android with hardware acceleration.

For details, see the subsequent sections:

Enabling the Generic Graphics Accelerator

To enable the Generic Graphics Accelerator for the Android target, push the Shim libraries from the host to the target.

About this task

The Shim libraries in the Generic Graphics Accelerator act as the graphics driver for the Android target. They pass OpenGL ES API data from the target to the host to enable the host GPU to render images for these APIs.

Before you begin

Make sure that:

Procedure

  1. Copy the settings.ini configuration file from either of the following locations to the directory where you booted the Android target with software acceleration:
    On Linux, <installation_directory>/GGA/reconciler/linux-x86_64/gcc-x.x.x/rel/ (where x.x.x is the GCC version number).
    On Windows, <installation_directory>\GGA\reconciler\win_32-x86_64\cl-18.00.31101\rel\.
  2. From the host, enter the following commands:
    Example:

    On Linux:

    export PATH=$PATH:<path_of_android_sdk_linux>/platform-tools/
    adb connect localhost:5212

    On Windows:

    set PATH=%PATH%;<installation_directory>\<path_of_android_sdk_windows>\platform-tools
    adb connect localhost:5212

    Note:

    In the adb command, the port number must use the first value of the boot command option board.hostbridge.userNetPorts.

    For the boot command, see Example: Booting an Android target to verify the OS.

  3. From the host, connect to the target using the following command:
    adb connect localhost:5212
  4. Remove libEGL*.so and libGLES*.so from the target.

    Note:

    Remember to back up files before removal.

    If Vulkan is used, 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
    adb shell rm /system/vendor/lib64/hw/vulkan.<ro.board.platform>.so
    adb shell rm /system/vendor/lib/hw/vulkan.<ro.board.platform>.so

    Otherwise, 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
  5. If Android uses customized native window handles, generate a customized libnwhal.so file. For details, see Generating libnwhal.so.
    Skip this step if Android follows the standard Android Open Source Project, or uses the Gralloc module provided from https://developer.arm.com/products/software/mali-drivers/android-gralloc-module.
  6. From the Generic Graphics Accelerator directory, push the Shim libraries to the target.
    The following examples show the instructions on different hosts:
    Example:

    Note:

    For Android versions later than 6.0, the command uses the directory /system/lib/egl/ or /system/lib64/egl/ instead of /system/vendor/lib/egl/ or /system/vendor/lib64/egl/.
    • To push Shim libraries from a Linux host to a 32-bit Android target:

      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/<HAL>/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

      If Vulkan is used, enter one more command:

      adb shell ln -s /vendor/lib/egl/libGLES_vimpl.so /system/vendor/lib/hw/vulkan.<ro.board.platform>.so
    • To push Shim libraries from a Linux host to a 64-bit Android target:

      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/<HAL>/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/<HAL>/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

      If Vulkan is used, enter one more command:

      adb shell ln -s /vendor/lib64/egl/libGLES_vimpl.so /system/vendor/lib64/hw/vulkan.<ro.board.platform>.so
    • To push Shim libraries from a Windows host to a 32-bit Android target:

      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\<HAL>\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

      If Vulkan is used, enter one more command:

      adb shell ln -s /vendor/lib/egl/libGLES_vimpl.so /system/vendor/lib/hw/vulkan.<ro.board.platform>.so
    • To push Shim libraries from a Windows host to a 64-bit Android target:

      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\<HAL>\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\<HAL>\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

      If Vulkan is used, enter one more command:

      adb shell ln -s /vendor/lib64/egl/libGLES_vimpl.so /system/vendor/lib64/hw/vulkan.<ro.board.platform>.so

    Note:

    In these commands, the folder name <HAL> can be either of the following:

What to do next

Boot the target with the Generic Graphics Accelerator through the host GPU acceleration. For details, see Booting Android targets with the Generic Graphics Accelerator.

Generating libnwhal.so

Create a customized libnwhal.so file for an Android target if it uses customized native window handles.

About this task

Create this file before you push the Shim libraries to the Android target. This file parses and transfers the target OpenGL ES data from the Android HAL to the Shim libraries.

Procedure

  1. Open the file $PVLIB_HOME/GGA/HAL/<subdirectory>/jni/src/nw_hal.h.
    Here, subdirectory can be the folder stock or a folder named with a Gralloc version number.
  2. Follow the descriptions in the file to define a customized data structure android_private_handle_t.
  3. From the directory, $PVLIB_HOME/GGA/HAL/<subdirectory>/, run the following build command to generate the libnwhal.so file:
    <ANDROID_NDK_HOME>/ndk-build

What to do next

Push the Shim libraries from the host to the Android target as described in:

Booting Android targets with the Generic Graphics Accelerator

The Generic Graphics Accelerator enables hardware acceleration to boot an Android target in Fast Models.

Before you begin

Make sure that the Generic Graphics Accelerator is enabled for the Android target. For details, see Enabling the Generic Graphics Accelerator.

Procedure

  1. On the host, enter the command to disable the target OpenGL ES driver preload feature:
    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"
  2. On the host, enter the command to enable rendering through the host GPU.
    Commands are different for Linaro, and 32-bit and 64-bit Android:
    • 64-bit Android:
      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
    • 32-bit Android:
      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 64-bit Android:
      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 32-bit Android:
      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
  3. On the host, enter the command to reboot the target:
    adb shell sync
    adb shell reboot

    Note:

    If failures occur, kill Fast Models and then repeat the procedure as described in 8.2.1 Booting Android targets for the first time.

Results

If the Android target has booted:

  • The host displays the default Android desktop.
  • The host terminal shows interaction details between the Reconciler and the OpenGL ES Emulator.
  • By entering the logcat command on the target terminal, you can view more information from the target, such as:

    • The interaction between the Shim Layer and applications.
    • The interaction between the Shim Layer and the Reconciler.

What to do next

Test the target by installing and running test applications on it.

Installing applications on Android targets

Install and run applications on an Android target to test its graphics.

About this task

You can find test applications for both OpenGL ES and Vulkan in the directory <installation_directory>/GGA/examples/.

Before you begin

Boot the Android target. If this is the first time, follow the procedure described in 8.2.1 Booting Android targets for the first time. Otherwise, use the boot command described in 8.2.2 Booting Android targets.

Procedure

  1. Install the application, for example, the Cube test application.
    Example:

    On Linux, for 32-bit Android:

    adb install <installation_directory>/GGA/examples/opengles/linux-armv7sfl/Cube.apk
    Example:

    On Windows, for 32-bit Android:

    adb install <installation_directory>\GGA\examples\opengles\linux-armv7sfl\Cube.apk
    Example:

    On Linux, for 64-bit Android:

    adb install <installation_directory>/GGA/examples/opengles/linux-armv8l_64/Cube.apk
    Example:

    On Windows, for 64-bit Android:

    adb install <installation_directory>\GGA\examples\opengles\linux-armv8l_64\Cube.apk
  2. Run the application.

Results

If the Android target is rendering correctly, a spinning cube is displayed on the screen as the following figure shows:

Figure 8-4 Spinning cube implemented with OpenGL ES


What to do next

You can:
Non-ConfidentialPDF file icon PDF version100965_1180_00_en
Copyright © 2014–2019 Arm Limited or its affiliates. All rights reserved.