• Home
  • Raw
  • Download

Lines Matching +full:build +full:- +full:android

1 Android  title
4 Mesa hardware drivers can be built for Android one of two ways: built
5 into the Android OS using the ndk-build build system on older versions
6 of Android, or out-of-tree using the Meson build system and the
7 Android NDK.
9 The ndk-build build system has proven to be hard to maintain, as one
10 needs a built Android tree to build against, and it has never been
11 tested in CI. The Meson build system flow is frequently used by
12 Chrome OS developers for building and testing Android drivers.
14 When building llvmpipe or lavapipe for Android the ndk-build workflow
16 to the Android OS image.
18 Building using the Android NDK
19 ------------------------------
23 ``~/.local/share/meson/cross/android-aarch64`` file:
25 .. code-block:: ini
28 ar = 'NDKDIR/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar'
29 c = ['ccache', 'NDKDIR/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android34-clang']
30-x86_64/bin/aarch64-linux-android34-clang++', '-fno-exceptions', '-fno-unwind-tables', '-fno-async…
33 strip = 'NDKDIR/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip'
34 # Android doesn't come with a pkg-config, but we need one for Meson to be happy not
35 # finding all the optional deps it looks for. Use system pkg-config pointing at a
36 # directory we get to populate with any .pc files we want to add for Android
37 pkg-config = ['env', 'PKG_CONFIG_LIBDIR=NDKDIR/pkgconfig', '/usr/bin/pkg-config']
40 system = 'android'
45 Now, use that cross file for your Android build directory (as in this
46 one cross-compiling the turnip driver for a stock Pixel phone)
48 .. code-block:: sh
50 meson setup build-android-aarch64 \
51 --cross-file android-aarch64 \
52 -Dplatforms=android \
53 -Dplatform-sdk-version=34 \
54 -Dandroid-stub=true \
55 -Dgallium-drivers= \
56 -Dvulkan-drivers=freedreno \
57 -Dfreedreno-kmds=kgsl
58 meson compile -C build-android-aarch64
60 Replacing Android drivers on stock Android
61 ------------------------------------------
64 read-only disk image on ``/vendor``. To be able to replace them for
68 .. code-block:: sh
70 adb disable-verity
72 adb remount -R
77 .. code-block:: sh
79 …adb push build-android-aarch64/src/freedreno/vulkan/libvulkan_freedreno.so /vendor/lib64/hw/vulkan…
84 .. code-block:: sh
86 cp build-android-aarch64/src/freedreno/vulkan/libvulkan_freedreno.so /tmp/vulkan.sdm710.so
87 patchelf --set-soname vulkan.sdm710.so /tmp/vulkan.sdm710.so
90 Replacing Android drivers on Chrome OS
91 --------------------------------------
93 Chrome OS's ARC++ is an Android container with hardware drivers inside
95 a read-only squashfs image on disk. For doing rapid driver
101 On your device, you'll want to make ``/`` read-write. ssh in as root
104 .. code-block:: sh
107 /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions 4
110 Then, we'll switch Android from using an image for ``/vendor`` to using a
111 bind-mount from a directory we control.
113 .. code-block:: sh
115 cd /opt/google/containers/android/
116 mkdir vendor-ro
117 mount -o loop vendor.raw.img vendor-ro
118 cp -a vendor-ro vendor-rw
127 "source": "/opt/google/containers/android/vendor-rw",
136 .. code-block:: sh
140 At this point, your android container is restarted with your new
141 bind-mount ``/vendor``, and if you use ``android-sh`` to shell into it
146 Now, replacing your DRI driver with a new one built for Android should
149 .. code-block:: sh
151 scp msm_dri.so $HOST:/opt/google/containers/android/vendor-rw/lib64/dri/
153 You can do your build of your DRI driver using ``emerge-$BOARD
154 arc-mesa-freedreno`` (for example) if you have a source tree with
155 ARC++, but it should also be possible to build using the NDK as
157 example the build will require that you have your arc-libdrm build
162 .. code-block:: sh
164 scp $HOST:/opt/google/containers/android/vendor-rw/lib64/libdrm.so \
165 NDKDIR/sysroot/usr/lib/aarch64-linux-android/lib/
167 ln -s \
175 find you need to reload the whole Android container. To do so without
179 .. code-block:: sh
181 kill $(cat /run/containers/android-run_oci/container.pid )
183 Adding out-of-tree drivers to Android OS image
184 ----------------------------------------------
186 When building your own Android OS images it's possible to add
188 running llvmpipe and lavapipe on Android this step is required
189 to ensure Android is able to load the drivers correctly.
192 the android cuttlefish image following the official Android
193 documentation from https://source.android.com/docs/setup
195 When building llvmpipe or lavapipe for Android, it is required
199 Following the Android documentation, we can run the following
202 .. code-block:: sh
204 repo init -b main -u https://android.googlesource.com/platform/manifest
205 repo sync -c -j8
207 source build/envsetup.sh
208 lunch aosp_cf_x86_64_phone-trunk_staging-userdebug
212 the ``aosp_cf_x86_64_phone-trunk_staging-userdebug`` build target
213 for Android. Please note that the x86_64 cuttlefish target will require
214 you to build mesa for 32bit and 64bit. Next we need to copy the build
215 driver libraries into the source tree of Android and patch the binary names.
217 .. code-block:: sh
233 patchelf --set-soname libEGL_lp.so prebuilts/mesa/x86_64/libEGL.so
234 patchelf --set-soname libGLESv1_CM_lp.so prebuilts/mesa/x86_64/libGLESv1_CM.so
235 patchelf --set-soname libGLESv2_lp.so prebuilts/mesa/x86_64/libGLESv2.so
236 patchelf --set-soname vulkan.lvp.so prebuilts/mesa/x86_64/libvulkan_lvp.so
237 patchelf --set-soname libEGL_lp.so prebuilts/mesa/x86/libEGL.so
238 patchelf --set-soname libGLESv1_CM_lp.so prebuilts/mesa/x86/libGLESv1_CM.so
239 patchelf --set-soname libGLESv2_lp.so prebuilts/mesa/x86/libGLESv2.so
240 patchelf --set-soname vulkan.lvp.so prebuilts/mesa/x86/libvulkan_lvp.so
242 We then need to create an ``prebuilts/mesa/Android.bp`` build file to include
243 the libraries in the build.
245 .. code-block::
343 in the build, as well as set the appropriate system properties. We can
348 .. code-block:: makefile
361 mesa.android.no.kms.swrast=true \
369 .. code-block:: makefile
376 .. code-block:: sh
386 to include these build files. First we modify
391 .. code-block:: sh
393 $(call inherit-product, device/google/cuttlefish/shared/mesa/device_vendor.mk)
399 .. code-block:: sh
401 -include device/google/cuttlefish/shared/mesa/BoardConfig.mk
404 build the cuttlefish target and run it in the cuttlefish emulator.