Skip to content

Instantly share code, notes, and snippets.

@dan-v
Last active January 12, 2022 06:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dan-v/a366c2cff6ef5a2f7e0022a39b1d5b00 to your computer and use it in GitHub Desktop.
Save dan-v/a366c2cff6ef5a2f7e0022a39b1d5b00 to your computer and use it in GitHub Desktop.
Notes on android-prepare-vendor upgrade for Android 10

Notes

Here are my note so far as I work through trying to update android-prepare-vendor to work with Android 10.

  • Work in progress fork is here right now: https://github.com/RattlesnakeOS/android-prepare-vendor/tree/10.0

  • Using existing oatdump that was built for api-28 as I don't think any repairs are needed (bytecode is not stripped). I just copied same over to api-29 in my forked version of android-prepare-vendor.

  • Android 10 factory images have a much smaller subset of partitions: boot, system, system_other, vendor. Unsure why this is the case, but in fork of android-prepare-vendor I just have no additional partitions set (e.g. []). This will need to be a configurable option to be backwards compatible.

  • There are build.prop differences affecting android-prepare-vendor in android 10. I've commited workarounds for each of these in my fork of android-prepare-vendor: ** ro.build.expect.baseband and ro.build.expect.bootloader are not in the build.prop. might need a different mechanism for parsing these values. ** ro.product.manufacturer is now ro.product.system.manufacturer ** ro.product.device doesn't exist but ro.build.product does (although it says ro.build.product is deprecated).

  • There are some odex files in android 10 that android-prepare-vendor does not like. TimeService may be an issue here. Also need to determine best way to workaround ignore these. In current fork of android-prepare-vendor I just have exit commented out. ** app/TimeService/oat/arm64/TimeService.odex ** framework/oat/arm/com.google.android.camera.experimental2018.odex ** framework/oat/arm64/com.google.android.camera.experimental2018.odex

  • For some reason there are a ton of vendor files that conflict with existing files in build which cause build errors. I went through all the conflicts in marlin build and excluded them by defining them in android-prepare-vendor scripts/constants 'VENDOR_SKIP_FILES'. I'm sure there's a better/quicker way to figure out this list, but I just kept building, getting error and removing duplicate entry from vendor mk files, and building, etc.

while [ 1 ]; do
  duplicate=$(bash build.sh marlin | grep -A1 'FAILED:' | grep 'error:' | awk -F"', previously defined" '{print $1}' | awk -F'out/target/product/marlin/' '{print $2}')
  if [[ -z "${duplicate}" ]]; then
    break
  fi
  sed -i "/${duplicate}/d" ~/build/vendor/google_devices/marlin/marlin-vendor-blobs.mk
  echo "$duplicate" | tee -a ~/duplicates.txt
done

Environment Setup

Get AOSP 10 in a buildable state

mkdir ~/build
cd build
repo init -u https://android.googlesource.com/platform/manifest -b android-10.0.0_r2
repo sync -c --jobs 32

Clone modified version of android-prepare-vendor that has a few fixes/workarounds

git clone https://github.com/RattlesnakeOS/android-prepare-vendor.git
cd android-prepare-vendor
git checkout 10.0
execute-all.sh --debugfs --device marlin --buildID QP1A.190711.020 --output out

Move extracted output in out to build/vendor/google_devices/marlin/

Build AOSP

cd ~/build
source build/envsetup.sh
export LANG=C
export _JAVA_OPTIONS=-XX:-UsePerfData
export BUILD_NUMBER=$(cat out/build_number.txt 2>/dev/null || date --utc +%Y.%m.%d.%H)
export DISPLAY_BUILD_NUMBER=true
chrt -b -p 0 $$
export PLATFORM_VERSION="10"
choosecombo release aosp_marlin userdebug
make -j $(nproc) target-files-package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment