Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ RUN apt-get update && \

# Bake in Google ndk_translation prebuilts (ARM-on-x86 native bridge).
# Source: Kaz205 fork (Chrome OS Android 11 / guybrush_cheets) — matches the emulator's API 30.
# Stored as the upstream tarball; install_arm_translation extracts on demand.
ARG NDK_TRANSLATION_REPO=Kaz205/vendor_google_proprietary_ndk_translation-prebuilt
ARG NDK_TRANSLATION_REF=chromeos_guybrush
RUN mkdir -p /opt/ndk-translation && \
wget -q -O /tmp/ndk.tar.gz \
"https://codeload.github.com/${NDK_TRANSLATION_REPO}/tar.gz/refs/heads/${NDK_TRANSLATION_REF}" && \
tar -xzf /tmp/ndk.tar.gz \
--strip-components=2 \
-C /opt/ndk-translation \
"$(basename "$NDK_TRANSLATION_REPO")-${NDK_TRANSLATION_REF}/prebuilts" && \
rm /tmp/ndk.tar.gz
RUN wget -q -O /opt/ndk-translation.tar.gz \
"https://codeload.github.com/${NDK_TRANSLATION_REPO}/tar.gz/refs/heads/${NDK_TRANSLATION_REF}"

# Bake in rootAVD (Magisk-based AVD rooting tool + bundled Magisk.zip).
# Source: https://gitlab.com/newbit/rootAVD — install_root extracts on demand.
ARG ROOTAVD_REPO=newbit/rootAVD
ARG ROOTAVD_REF=master
RUN wget -q -O /opt/rootavd.tar.gz \
"https://gitlab.com/${ROOTAVD_REPO}/-/archive/${ROOTAVD_REF}/$(basename "$ROOTAVD_REPO")-${ROOTAVD_REF}.tar.gz"

# Set up Android SDK
RUN mkdir -p /opt/android-sdk/cmdline-tools && \
Expand Down
51 changes: 28 additions & 23 deletions first-boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ magisk_active() {
install_gapps_magisk_module() {
echo "Installing GAPPS as a Magisk module ..."
local MOD=/data/adb/modules/gapps
adb push gapps-11/etc /data/local/tmp/gapps-etc
adb push gapps-11/framework /data/local/tmp/gapps-framework
adb push gapps-11/app /data/local/tmp/gapps-app
adb push gapps-11/priv-app /data/local/tmp/gapps-priv-app
adb push /tmp/gapps/etc /data/local/tmp/gapps-etc
adb push /tmp/gapps/framework /data/local/tmp/gapps-framework
adb push /tmp/gapps/app /data/local/tmp/gapps-app
adb push /tmp/gapps/priv-app /data/local/tmp/gapps-priv-app
adb shell "
rm -rf $MOD
mkdir -p $MOD/system
Expand All @@ -74,29 +74,30 @@ PROP

install_gapps_system() {
prepare_system
adb push gapps-11/etc /system
adb push gapps-11/framework /system
adb push gapps-11/app /system
adb push gapps-11/priv-app /system
adb push /tmp/gapps/etc /system
adb push /tmp/gapps/framework /system
adb push /tmp/gapps/app /system
adb push /tmp/gapps/priv-app /system
}

install_gapps() {
adb wait-for-device
adb root
echo "Installing GAPPS ..."
wget https://sourceforge.net/projects/opengapps/files/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip/download -O gapps-11.zip
unzip gapps-11.zip 'Core/*' -d gapps-11 && rm gapps-11.zip
rm gapps-11/Core/setup*
lzip -d gapps-11/Core/*.lz
for f in gapps-11/Core/*.tar; do
tar -x --strip-components 2 -f "$f" -C gapps-11
mkdir -p /tmp/gapps
wget https://sourceforge.net/projects/opengapps/files/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip/download -O /tmp/gapps.zip
unzip /tmp/gapps.zip 'Core/*' -d /tmp/gapps && rm /tmp/gapps.zip
rm /tmp/gapps/Core/setup*
lzip -d /tmp/gapps/Core/*.lz
for f in /tmp/gapps/Core/*.tar; do
tar -x --strip-components 2 -f "$f" -C /tmp/gapps
done
if magisk_active; then
install_gapps_magisk_module
else
install_gapps_system
fi
rm -r gapps-11
rm -rf /tmp/gapps
adb reboot
adb wait-for-device
touch /data/.gapps-done
Expand All @@ -107,8 +108,9 @@ install_root() {
adb root
echo "Root Script Starting..."
# Root the AVD by patching the ramdisk.
git clone https://gitlab.com/newbit/rootAVD.git
pushd rootAVD
mkdir -p /tmp/rootavd
tar -xzf /opt/rootavd.tar.gz --strip-components=1 -C /tmp/rootavd
pushd /tmp/rootavd
sed -i 's/read -t 10 choice/choice=1/' rootAVD.sh
./rootAVD.sh system-images/android-30/default/x86_64/ramdisk.img
cp /opt/android-sdk/system-images/android-30/default/x86_64/ramdisk.img /data/android.avd/ramdisk.img
Expand Down Expand Up @@ -142,14 +144,14 @@ install_root() {
popd
echo "Root Done"
sleep 10
rm -r rootAVD
rm -rf /tmp/rootavd
touch /data/.root-done
}

install_arm_translation_magisk_module() {
echo "Installing ARM translation as a Magisk module ..."
local MOD=/data/adb/modules/ndk_translation
adb push /opt/ndk-translation /data/local/tmp/ndk
adb push /tmp/ndk-translation /data/local/tmp/ndk
adb shell "
rm -rf $MOD
mkdir -p $MOD/system/bin $MOD/system/etc $MOD/system/lib $MOD/system/lib64
Expand Down Expand Up @@ -197,10 +199,10 @@ install_arm_translation_system() {
prepare_system
echo "Installing ARM translation (ndk_translation) ..."

adb push /opt/ndk-translation/bin /system/
adb push /opt/ndk-translation/etc /system/
adb push /opt/ndk-translation/lib /system/
adb push /opt/ndk-translation/lib64 /system/
adb push /tmp/ndk-translation/bin /system/
adb push /tmp/ndk-translation/etc /system/
adb push /tmp/ndk-translation/lib /system/
adb push /tmp/ndk-translation/lib64 /system/

adb shell '
chmod 755 /system/bin/ndk_translation_program_runner_binfmt_misc /system/bin/ndk_translation_program_runner_binfmt_misc_arm64
Expand Down Expand Up @@ -230,13 +232,16 @@ EOF
install_arm_translation() {
adb wait-for-device
adb root
mkdir -p /tmp/ndk-translation
tar -xzf /opt/ndk-translation.tar.gz --strip-components=2 --wildcards -C /tmp/ndk-translation '*/prebuilts/*'
# On a live-Magisk device, /system is wrapped in a read-only magic mount;
# install as a Magisk module so the changes land via Magisk's own overlay.
if magisk_active; then
install_arm_translation_magisk_module
else
install_arm_translation_system
fi
rm -rf /tmp/ndk-translation
adb reboot
adb wait-for-device
touch /data/.arm-translation-done
Expand Down
Loading