From 251da7189e608fc62a3d563d719e7ba7735501a9 Mon Sep 17 00:00:00 2001 From: Paul Keith Date: Tue, 30 Aug 2022 13:08:39 -0400 Subject: [PATCH] Fix arch checks Some devices have a 32-bit userspace but a 64-bit kernel. These devices need to have 32-bit gapps, not 64-bit ones. To fix this, switch to getting arch from ro.bionic.arch instead of uname -m. Additionally, remove the nice_arch function as it makes debugging issues more difficult when the nice arch matches but the underlying values don't line up. --- build/main.mk | 4 ++-- build/meta/com/google/android/update-binary | 18 ++---------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/build/main.mk b/build/main.mk index bd2f756..441f290 100644 --- a/build/main.mk +++ b/build/main.mk @@ -11,11 +11,11 @@ distclean: gapps_arm: @echo "Compiling GApps for arm..." - @bash $(BUILD_GAPPS) arm armv7l 2>&1 + @bash $(BUILD_GAPPS) arm 2>&1 gapps_arm64: @echo "Compiling GApps for arm64..." - @bash $(BUILD_GAPPS) arm64 aarch64 2>&1 + @bash $(BUILD_GAPPS) arm64 2>&1 gapps_x86: @echo "Compiling GApps for x86..." diff --git a/build/meta/com/google/android/update-binary b/build/meta/com/google/android/update-binary index 09abde5..ff1985b 100644 --- a/build/meta/com/google/android/update-binary +++ b/build/meta/com/google/android/update-binary @@ -25,20 +25,6 @@ getprop2() { grep -m 1 "^$2=" $1 | cut -d= -f2 } -nice_arch() { - case $1 in - aarch64*|armv8*) - echo "arm64" - ;; - arm*) - echo "arm" - ;; - *) - echo $1 - ;; - esac -} - cleanup() { ui_print "Cleaning up files" rm -rf $TMP/system @@ -142,9 +128,9 @@ rm -rf META-INF # compiled for a different architecture. Just hope that all environments have at least # a proper `grep` and `uname`. GAPPS_ARCH=$(getprop2 $TMP/build.prop arch) -CPU_ARCH=$(uname -m) +CPU_ARCH=$(getprop ro.bionic.arch) if [ $GAPPS_ARCH != $CPU_ARCH ]; then - error "This package is built for $(nice_arch $GAPPS_ARCH) but your device is $(nice_arch $CPU_ARCH)! Aborting" + error "This package is built for $GAPPS_ARCH but your device is $CPU_ARCH! Aborting" fi ui_print "Setting up environment"