gapps: Use apktool to build RRO overlays
The following fields in the AndroidManifest.xml are different: Built in AOSP-tree version: android:compileSdkVersion="33" android:compileSdkVersionCodename="13" platformBuildVersionCode="33" platformBuildVersionName="13" Build with apktool version: android:compileSdkVersion="23" android:compileSdkVersionCodename="6.0-2438415" platformBuildVersionCode="23" platformBuildVersionName="6.0-2438415"
This commit is contained in:
parent
d06706f0d8
commit
d70e71a0bc
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,8 @@
|
|||||||
# out directory
|
# out directory
|
||||||
out/
|
out/
|
||||||
|
|
||||||
|
# rro build artifacts
|
||||||
|
overlay/**/build/
|
||||||
|
|
||||||
# gapps log
|
# gapps log
|
||||||
gapps_log
|
gapps_log
|
||||||
|
BIN
build/apktool/apktool_2.8.1.jar
Normal file
BIN
build/apktool/apktool_2.8.1.jar
Normal file
Binary file not shown.
@ -7,18 +7,23 @@
|
|||||||
# var
|
# var
|
||||||
#
|
#
|
||||||
DATE=$(date -u +%Y%m%d_%H%M%S)
|
DATE=$(date -u +%Y%m%d_%H%M%S)
|
||||||
export TOP=$(realpath .)
|
export GAPPS_TOP=$(realpath .)
|
||||||
ANDROIDV=13.0.0
|
ANDROIDV=13.0.0
|
||||||
SDKV=33
|
SDKV=33
|
||||||
GARCH=$1
|
GARCH=$1
|
||||||
CPUARCH=$GARCH
|
CPUARCH=$GARCH
|
||||||
[ ! -z "$2" ] && CPUARCH=$2
|
[ ! -z "$2" ] && CPUARCH=$2
|
||||||
OUT=$TOP/out
|
OUT=$GAPPS_TOP/out
|
||||||
BUILD=$TOP/build
|
BUILD=$GAPPS_TOP/build
|
||||||
METAINF=$BUILD/meta
|
METAINF=$BUILD/meta
|
||||||
COMMON=$TOP/common/proprietary
|
COMMON=$GAPPS_TOP/common/proprietary
|
||||||
GLOG=$TOP/gapps_log
|
export GLOG=$GAPPS_TOP/gapps_log
|
||||||
ADDOND=$TOP/addond.sh
|
ADDOND=$GAPPS_TOP/addond.sh
|
||||||
|
|
||||||
|
SIGNAPK=$GAPPS_TOP/build/sign/signapk.jar
|
||||||
|
|
||||||
|
ZIP_KEY_PK8=$GAPPS_TOP/build/sign/testkey.pk8
|
||||||
|
ZIP_KEY_PEM=$GAPPS_TOP/build/sign/testkey.x509.pem
|
||||||
|
|
||||||
##
|
##
|
||||||
# functions
|
# functions
|
||||||
@ -41,16 +46,16 @@ function create() {
|
|||||||
echo "ARCH= $GARCH" >> $GLOG
|
echo "ARCH= $GARCH" >> $GLOG
|
||||||
echo "OS= $(uname -s -r)" >> $GLOG
|
echo "OS= $(uname -s -r)" >> $GLOG
|
||||||
echo "NAME= $(whoami) at $(uname -n)" >> $GLOG
|
echo "NAME= $(whoami) at $(uname -n)" >> $GLOG
|
||||||
PREBUILT=$TOP/$GARCH/proprietary
|
PREBUILT=$GAPPS_TOP/$GARCH/proprietary
|
||||||
test -d $OUT || mkdir $OUT;
|
test -d $OUT || mkdir $OUT;
|
||||||
test -d $OUT/$GARCH || mkdir -p $OUT/$GARCH
|
test -d $OUT/$GARCH || mkdir -p $OUT/$GARCH
|
||||||
test -d $OUT/$GARCH/system || mkdir -p $OUT/$GARCH/system
|
test -d $OUT/$GARCH/system || mkdir -p $OUT/$GARCH/system
|
||||||
echo "Build directories are now ready" >> $GLOG
|
echo "Build directories are now ready" >> $GLOG
|
||||||
echo "Compiling RROs"
|
echo "Compiling RROs"
|
||||||
$TOP/overlay/build_overlays.sh $GARCH $OUT/$GARCH
|
$GAPPS_TOP/overlay/build_overlays.sh $GARCH $OUT/$GARCH
|
||||||
echo "Getting prebuilts..."
|
echo "Getting prebuilts..."
|
||||||
echo "Copying stuff" >> $GLOG
|
echo "Copying stuff" >> $GLOG
|
||||||
cp $TOP/toybox-$GARCH $OUT/$GARCH/toybox >> $GLOG
|
cp $GAPPS_TOP/toybox-$GARCH $OUT/$GARCH/toybox >> $GLOG
|
||||||
cp -r $PREBUILT/* $OUT/$GARCH/system >> $GLOG
|
cp -r $PREBUILT/* $OUT/$GARCH/system >> $GLOG
|
||||||
cp -r $COMMON/* $OUT/$GARCH/system >> $GLOG
|
cp -r $COMMON/* $OUT/$GARCH/system >> $GLOG
|
||||||
echo "Generating addon.d script" >> $GLOG
|
echo "Generating addon.d script" >> $GLOG
|
||||||
@ -72,10 +77,10 @@ function zipit() {
|
|||||||
cd $OUT/$GARCH
|
cd $OUT/$GARCH
|
||||||
zip -r /tmp/$BUILDZIP . >> $GLOG
|
zip -r /tmp/$BUILDZIP . >> $GLOG
|
||||||
rm -rf $OUT/tmp >> $GLOG
|
rm -rf $OUT/tmp >> $GLOG
|
||||||
cd $TOP
|
cd $GAPPS_TOP
|
||||||
if [ -f /tmp/$BUILDZIP ]; then
|
if [ -f /tmp/$BUILDZIP ]; then
|
||||||
echo "Signing zip..."
|
echo "Signing zip..."
|
||||||
java -Xmx2048m -jar $TOP/build/sign/signapk.jar -w $TOP/build/sign/testkey.x509.pem $TOP/build/sign/testkey.pk8 /tmp/$BUILDZIP $OUT/$BUILDZIP >> $GLOG
|
java -Xmx2048m -jar $SIGNAPK -w $ZIP_KEY_PEM $ZIP_KEY_PK8 /tmp/$BUILDZIP $OUT/$BUILDZIP >> $GLOG
|
||||||
else
|
else
|
||||||
echo "Couldn't zip files!"
|
echo "Couldn't zip files!"
|
||||||
echo "Couldn't find unsigned zip file, aborting" >> $GLOG
|
echo "Couldn't find unsigned zip file, aborting" >> $GLOG
|
||||||
@ -103,7 +108,7 @@ function getmd5() {
|
|||||||
if [ -x $(which realpath) ]; then
|
if [ -x $(which realpath) ]; then
|
||||||
echo "Realpath found!" >> $GLOG
|
echo "Realpath found!" >> $GLOG
|
||||||
else
|
else
|
||||||
TOP=$(cd . && pwd) # some darwin love
|
GAPPS_TOP=$(cd . && pwd) # some darwin love
|
||||||
echo "No realpath found!" >> $GLOG
|
echo "No realpath found!" >> $GLOG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
PRODUCT_MAKEFILES := \
|
|
||||||
$(LOCAL_DIR)/lineage_gapps_arm.mk \
|
|
||||||
$(LOCAL_DIR)/lineage_gapps_arm64.mk \
|
|
||||||
$(LOCAL_DIR)/lineage_gapps_x86.mk \
|
|
||||||
$(LOCAL_DIR)/lineage_gapps_x86_64.mk
|
|
@ -1,9 +0,0 @@
|
|||||||
$(call inherit-product, build/target/product/aosp_arm.mk)
|
|
||||||
|
|
||||||
include vendor/lineage/build/target/product/lineage_generic_target.mk
|
|
||||||
|
|
||||||
TARGET_NO_KERNEL_OVERRIDE := true
|
|
||||||
|
|
||||||
PRODUCT_NAME := lineage_gapps_arm
|
|
||||||
|
|
||||||
PRODUCT_SOONG_NAMESPACES += vendor/gapps/overlay
|
|
@ -1,9 +0,0 @@
|
|||||||
$(call inherit-product, build/target/product/aosp_arm64.mk)
|
|
||||||
|
|
||||||
include vendor/lineage/build/target/product/lineage_generic_target.mk
|
|
||||||
|
|
||||||
TARGET_NO_KERNEL_OVERRIDE := true
|
|
||||||
|
|
||||||
PRODUCT_NAME := lineage_gapps_arm64
|
|
||||||
|
|
||||||
PRODUCT_SOONG_NAMESPACES += vendor/gapps/overlay
|
|
@ -1,12 +0,0 @@
|
|||||||
$(call inherit-product, build/target/product/aosp_x86.mk)
|
|
||||||
|
|
||||||
include vendor/lineage/build/target/product/lineage_generic_target.mk
|
|
||||||
|
|
||||||
PRODUCT_SDK_ADDON_NAME :=
|
|
||||||
PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP :=
|
|
||||||
|
|
||||||
TARGET_NO_KERNEL_OVERRIDE := true
|
|
||||||
|
|
||||||
PRODUCT_NAME := lineage_gapps_x86
|
|
||||||
|
|
||||||
PRODUCT_SOONG_NAMESPACES += vendor/gapps/overlay
|
|
@ -1,12 +0,0 @@
|
|||||||
$(call inherit-product, build/target/product/aosp_x86_64.mk)
|
|
||||||
|
|
||||||
include vendor/lineage/build/target/product/lineage_generic_target.mk
|
|
||||||
|
|
||||||
TARGET_NO_KERNEL_OVERRIDE := true
|
|
||||||
|
|
||||||
PRODUCT_SDK_ADDON_NAME :=
|
|
||||||
PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP :=
|
|
||||||
|
|
||||||
PRODUCT_NAME := lineage_gapps_x86_64
|
|
||||||
|
|
||||||
PRODUCT_SOONG_NAMESPACES += vendor/gapps/overlay
|
|
@ -1,2 +0,0 @@
|
|||||||
soong_namespace {
|
|
||||||
}
|
|
23
overlay/GmsOverlay/apktool.yml
Normal file
23
overlay/GmsOverlay/apktool.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
!!brut.androlib.apk.ApkInfo
|
||||||
|
apkFileName: GmsOverlay.apk
|
||||||
|
doNotCompress:
|
||||||
|
- resources.arsc
|
||||||
|
isFrameworkApk: false
|
||||||
|
packageInfo:
|
||||||
|
forcedPackageId: '127'
|
||||||
|
renameManifestPackage: null
|
||||||
|
resourcesAreCompressed: false
|
||||||
|
sdkInfo:
|
||||||
|
minSdkVersion: '33'
|
||||||
|
targetSdkVersion: '33'
|
||||||
|
sharedLibrary: false
|
||||||
|
sparseResources: true
|
||||||
|
unknownFiles: {}
|
||||||
|
usesFramework:
|
||||||
|
ids:
|
||||||
|
- 1
|
||||||
|
tag: null
|
||||||
|
version: 2.8.1
|
||||||
|
versionInfo:
|
||||||
|
versionCode: '1'
|
||||||
|
versionName: '1.0'
|
23
overlay/GmsSettingsProviderOverlay/apktool.yml
Normal file
23
overlay/GmsSettingsProviderOverlay/apktool.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
!!brut.androlib.apk.ApkInfo
|
||||||
|
apkFileName: GmsSettingsProviderOverlay.apk
|
||||||
|
doNotCompress:
|
||||||
|
- resources.arsc
|
||||||
|
isFrameworkApk: false
|
||||||
|
packageInfo:
|
||||||
|
forcedPackageId: '127'
|
||||||
|
renameManifestPackage: null
|
||||||
|
resourcesAreCompressed: false
|
||||||
|
sdkInfo:
|
||||||
|
minSdkVersion: '33'
|
||||||
|
targetSdkVersion: '33'
|
||||||
|
sharedLibrary: false
|
||||||
|
sparseResources: true
|
||||||
|
unknownFiles: {}
|
||||||
|
usesFramework:
|
||||||
|
ids:
|
||||||
|
- 1
|
||||||
|
tag: null
|
||||||
|
version: 2.8.1
|
||||||
|
versionInfo:
|
||||||
|
versionCode: '1'
|
||||||
|
versionName: '1.0'
|
@ -5,42 +5,23 @@ set -e
|
|||||||
GARCH=$1
|
GARCH=$1
|
||||||
GOUT=$2
|
GOUT=$2
|
||||||
|
|
||||||
|
APKTOOL=$GAPPS_TOP/build/apktool/apktool_2.8.1.jar
|
||||||
|
APKSIGNER=$GAPPS_TOP/build/sign/apksigner.jar
|
||||||
|
|
||||||
|
APK_KEY_PK8=$GAPPS_TOP/build/sign/testkey.pk8
|
||||||
|
APK_KEY_PEM=$GAPPS_TOP/build/sign/testkey.x509.pem
|
||||||
|
|
||||||
SCRIPT_DIR=$(dirname "$0")
|
SCRIPT_DIR=$(dirname "$0")
|
||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
OVERLAYS=$(for dir in $(ls -d */); do echo ${dir%%/}; done)
|
OVERLAYS=$(for dir in $(ls -d */); do echo ${dir%%/}; done)
|
||||||
|
|
||||||
croot 2>/dev/null || cd ../../../
|
for OVERLAY in $OVERLAYS; do
|
||||||
|
PARTITION=$(grep -Eo "\w+_specific: true" $OVERLAY/Android.bp | sed "s/_specific.*$//")
|
||||||
source build/envsetup.sh
|
OVERLAY_TARGET_DIR="$GOUT/system/$PARTITION/overlay/"
|
||||||
breakfast gapps_$GARCH
|
OVERLAY_TARGET="$OVERLAY_TARGET_DIR/$OVERLAY.apk"
|
||||||
m installclean
|
test -d $OVERLAY_TARGET_DIR || mkdir -p $OVERLAY_TARGET_DIR
|
||||||
mkdir -p $OUT # $OUT may not exist yet, but we need to start creating the log file now
|
java -Xmx2048m -jar $APKTOOL b $OVERLAY -o $OVERLAY_TARGET --use-aapt2 >> $GLOG 2>&1
|
||||||
m $OVERLAYS | tee $OUT/.log
|
java -Xmx2048m -jar $APKSIGNER sign --key $APK_KEY_PK8 --cert $APK_KEY_PEM $OVERLAY_TARGET
|
||||||
|
rm $OVERLAY_TARGET.idsig
|
||||||
RELOUT=$(echo $OUT | sed "s#^${ANDROID_BUILD_TOP}/##")
|
|
||||||
LOC="$(cat $OUT/.log | sed -r -e 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' -e 's/^\[ {0,2}[0-9]{1,3}% [0-9]{1,6}\/[0-9]{1,6}\] +//' \
|
|
||||||
| grep '^Install: ' | grep "$RELOUT" | cut -d ':' -f 2)"
|
|
||||||
FILES=$(echo $LOC | tr " " "\n" | sed "s#.*${RELOUT}##" | sort | uniq)
|
|
||||||
|
|
||||||
for TARGET in $FILES; do
|
|
||||||
mkdir -p $(dirname $GOUT/$TARGET) && cp $OUT/$TARGET $GOUT/$TARGET
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Generate temporary signing keys
|
|
||||||
PRIVATE_KEY=$(mktemp)
|
|
||||||
PRIVATE_KEY_PK8=$(mktemp)
|
|
||||||
PUBLIC_KEY_PEM=$(mktemp)
|
|
||||||
|
|
||||||
openssl genrsa -f4 2048 > $PRIVATE_KEY
|
|
||||||
openssl pkcs8 -in $PRIVATE_KEY -topk8 -outform DER -out $PRIVATE_KEY_PK8 -nocrypt
|
|
||||||
openssl req -new -x509 -sha256 -key $PRIVATE_KEY -out $PUBLIC_KEY_PEM -days 10000 -subj '/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
|
|
||||||
|
|
||||||
# Resign all overlay apks
|
|
||||||
for TARGET in $FILES; do
|
|
||||||
java -Xmx2048m -jar $TOP/build/sign/apksigner.jar sign --key $PRIVATE_KEY_PK8 --cert $PUBLIC_KEY_PEM $GOUT/$TARGET
|
|
||||||
rm $GOUT/$TARGET.idsig
|
|
||||||
done
|
|
||||||
|
|
||||||
# RIP
|
|
||||||
rm $PRIVATE_KEY $PRIVATE_KEY_PK8 $PUBLIC_KEY_PEM
|
|
||||||
|
Loading…
Reference in New Issue
Block a user