Skip to content

Instantly share code, notes, and snippets.

@dan-v
Last active October 16, 2022 01:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dan-v/8fee2122b004ec1dd0971d4ebaff612f to your computer and use it in GitHub Desktop.
Save dan-v/8fee2122b004ec1dd0971d4ebaff612f to your computer and use it in GitHub Desktop.
aosp 11 apv debugging

how to cleanup configs

  • run the very-fancy-cleanup-apv-config-json.sh script for each device against their factory image to cleanup stale entries
  • after build is complete and you saw a bunch of warning overriding messages, grab a list of them using the command below and put this in the vendor-skip-file section of apv config.
device=bonito && gzip -cd out/verbose.log.gz | grep 'overriding' | awk -F"\`" '{print $2}' | cut -f1 -d\' | awk -F"out/target/product/${device}/vendor/" '{printf "\"%s\",\n",$2}'

device specific workarounds

coral/flame

PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS

  FAILED: 
  build/make/core/main.mk:1204: warning:  device/google/coral/aosp_flame.mk produces files inside build/make/target/product/mainline_system.mks artifact path requirement. 
  Offending entries:
  system/apex/com.android.apex.cts.shim.apex
  build/make/core/main.mk:1204: error: Build failed.
  09:50:22 ckati failed with: exit status 1

workaround

  sed -i 's@PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := strict@#PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := strict@' ${BUILD_DIR}/device/google/coral/aosp_coral.mk
  sed -i 's@PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := strict@#PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := strict@' ${BUILD_DIR}/device/google/coral/aosp_flame.mk
  • also need to enable BUILD_BROKEN_DUP_RULES := true for coral/flame (only needed while trying to track down duplicates)

workarounds for all devices

missing local shared libs after adding libsdsprpc to dep-dso

config.json

  "dep-dso": [
    "vendor/lib64/libsdsprpc.so",
    "vendor/lib/libsdsprpc.so"
  ],

build error

[ 80% 85514/106711] Check prebuilt ELF binary: vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so
FAILED: out/target/product/crosshatch/obj_arm/SHARED_LIBRARIES/libsdsprpc_intermediates/check_elf_files.timestamp
/bin/bash -c "(rm -f out/target/product/crosshatch/obj_arm/SHARED_LIBRARIES/libsdsprpc_intermediates/check_elf_files.timestamp ) && (build/make/tools/check_elf_f
ile.py      --skip-bad-elf-magic            --skip-unknown-elf-machine      --soname libsdsprpc.so          --shared-lib out/target/product/crosshatch/obj_arm/SH
ARED_LIBRARIES/libc++.vendor_intermediates/libc++.vendor.so --shared-lib out/target/product/crosshatch/obj_arm/SHARED_LIBRARIES/libc.vendor_intermediates/libc.ve
ndor.so --shared-lib out/target/product/crosshatch/obj_arm/SHARED_LIBRARIES/libm.vendor_intermediates/libm.vendor.so --shared-lib out/target/product/crosshatch/o
bj_arm/SHARED_LIBRARIES/libdl.vendor_intermediates/libdl.vendor.so                  --llvm-readobj=prebuilts/clang/host/linux-x86/clang-r383902b/bin/llvm-readobj
            vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so ) && (touch out/target/product/crosshatch/obj_arm/SHARED_LIBRARIES/libsdsprpc_intermediates
/check_elf_files.timestamp )"
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: error: DT_NEEDED "liblog.so" is not specified in shared_libs.
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: error: DT_NEEDED "libcutils.so" is not specified in shared_libs.
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: note:
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: note: Fix suggestions:
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: note:   Android.bp: shared_libs: ["libc++", "libc", "libcutils", "libdl", "liblog", "libm"],
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: note:   Android.mk: LOCAL_SHARED_LIBRARIES := libc++ libc libcutils libdl liblog libm
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: note:
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: note: If the fix above doesn't work, bypass this check with:
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: note:   Android.bp: check_elf_files: false,
vendor/google_devices/crosshatch/vendor/lib/libsdsprpc.so: note:   Android.mk: LOCAL_CHECK_ELF_FILES := false
05:14:07 ninja failed with: exit status 1

workaround

added LOCAL_SHARED_LIBRARIES := libc++ libc libcutils libdl liblog libm to libsdsprpc module in vendor/google_devices/crosshatch/Android.mk

error VINTF metadata found in PRODUCT_COPY_FILES

build error

error VINTF metadata found in PRODUCT_COPY_FILES

related change

https://android.googlesource.com/platform/build/+/5e57a778cdf9ac33ed06ba3b24e3ae662afa309d

workaround

set BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES := true in device/google/crosshatch/BoardConfig-common.mk

diff

this is diff from previously just removing vint altogether (aosp-apv) vs after this change (aosp-apv-2).

diff -qr aosp-apv/vendor aosp-apv-2/vendor 2>&1 | grep -v differ | grep -v 'No such file or dir'
Only in aosp-apv-2/vendor/etc/vintf/manifest: android.hardware.identity.strongbox.xml
Only in aosp-apv-2/vendor/etc/vintf/manifest: android.hardware.keymaster@4.1-service.citadel.xml
Only in aosp-apv-2/vendor/etc/vintf/manifest: android.hardware.weaver@1.0-service.citadel.xml
Only in aosp-apv-2/vendor/etc/vintf/manifest: manifest_android.hardware.drm@1.3-service.widevine.xml
Only in aosp-apv-2/vendor/etc/vintf/manifest: rebootescrow-citadel.xml
#!/usr/bin/env bash
config_file=$1
extracted_factory_directory=$2
section="$3" # system-other, system-bytecode
function remove_line_from_config() {
file="$1"
config_file="$2"
read -p "Delete line=${file}? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
sed -i.bak "/${file////\\/}/d" "${config_file}"
fi
}
api="api-30"
for file in $(jq '."'"${api}"'".naked."'"${section}"'"' "${config_file}" | awk -F'"' '{print $2}'); do
echo ""
echo "------------------------------------------------------------"
find "${extracted_factory_directory}" | grep -q "$file"
if [[ $? -eq 0 ]]; then
echo "OK: ${file} is there as expected"
continue
fi
base_filename=$(basename "${file}")
find "${extracted_factory_directory}" | grep -q "${base_filename}"
if [[ $? -eq 0 ]]; then
echo "UNKNOWN: $file maybe moved to: "
find "${extracted_factory_directory}" | grep "${base_filename}"
remove_line_from_config "${file}" "${config_file}"
continue
fi
base_filename_no_version=$(echo "${base_filename}" | awk -F"@" '{print $1}')
find "${extracted_factory_directory}" | grep -q "${base_filename_no_version}"
if [[ $? -eq 0 ]]; then
echo "UNKNOWN: $file has other versions: "
find "${extracted_factory_directory}" | grep "${base_filename_no_version}"
remove_line_from_config "${file}" "${config_file}"
continue
fi
echo "DELETED: ${file} not found"
remove_line_from_config "${file}" "${config_file}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment