1#!/bin/bash 2# 3# Generate sample SL driver prebuilts 4 5eval set -- "$OPTS" 6if [[ -z "$ANDROID_BUILD_TOP" ]]; then 7 echo ANDROID_BUILD_TOP not set, bailing out 8 echo you must run lunch before running this script 9 exit 1 10fi 11 12set -e 13cd $ANDROID_BUILD_TOP 14 15source build/envsetup.sh 16ARCHS="x86,arm,arm64,x86_64,riscv64" 17SAMPLE_SL_DRIVER="neuralnetworks_sample_sl_driver" 18 19for arch in ${ARCHS//,/ } 20do 21 if [[ $arch == "arm64" || $arch == "x86_64" ]]; then 22 lunch "aosp_cf_${arch}_phone_pgagnostic-trunk-userdebug" 23 else 24 lunch "aosp_${arch}-trunk-userdebug" 25 fi 26 27 LIB=lib 28 if [[ $arch =~ "64" ]]; then 29 LIB=lib64 30 fi 31 32 TMPFILE=$(mktemp) 33 build/soong/soong_ui.bash --make-mode ${SAMPLE_SL_DRIVER} 2>&1 | tee ${TMPFILE} 34 TARGETDIR=packages/modules/NeuralNetworks/driver/sample_shim/android_${arch}/neuralnetworks_sample_sl_driver_prebuilt.so 35 mkdir -p ${TARGETDIR%/*} 36 cp $OUT/system/${LIB}/neuralnetworks_sample_sl_driver.so ${TARGETDIR} 37done 38 39