From 5ca24e2c89e7517a7918bdf53ec68ec9ed5a4b64 Mon Sep 17 00:00:00 2001 From: Haroun EL ALAMI Date: Thu, 24 Oct 2024 20:20:52 +0200 Subject: [PATCH 1/2] feat(os): add sdcard option --- docker-compose.yml | 1 + start-emulator.sh | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c19f54a..355e5fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,7 @@ services: - ./extras:/extras environment: - DNS=one.one.one.one + - SDCARD_SIZE=64G - RAM_SIZE=8192 privileged: true devices: diff --git a/start-emulator.sh b/start-emulator.sh index b6f9f87..93a6869 100644 --- a/start-emulator.sh +++ b/start-emulator.sh @@ -2,8 +2,20 @@ # Check if the .first-boot-done file exists if [ -f /data/.first-boot-done ]; then - RAMDISK_PATH="-ramdisk /data/android.avd/ramdisk.img" + RAMDISK="-ramdisk /data/android.avd/ramdisk.img" fi +# Define the SD card path +SDCARD_PATH="/data/android.avd/sdcard.img" +SDCARD="-sdcard $SDCARD_PATH" +# Initialize the SDCARD_PATH only if CREATE_SDCARD is true and the sdcard doesn't exist +if [ -n "$SDCARD_SIZE" ] && [ ! -f /data/android.avd/sdcard.img ]; then + echo "Creating SD card..." + # Create the SD card using the specified size + /opt/android-sdk/emulator/mksdcard $SDCARD_SIZE $SDCARD_PATH + echo "SD card created with size: $SDCARD_SIZE" +fi + +chmod -x /opt/android-sdk/emulator/crashpad_handler # Start the emulator with the appropriate ramdisk.img -/opt/android-sdk/emulator/emulator -avd android -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot $RAMDISK_PATH -qemu -m ${RAM_SIZE:-4096} \ No newline at end of file +/opt/android-sdk/emulator/emulator -avd android -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -no-metrics $RAMDISK ${SDCARD_SIZE:+$SDCARD} -qemu -m ${RAM_SIZE:-4096} \ No newline at end of file From d05e72673d8fc57a10b6a87c88bfecbc21656cbc Mon Sep 17 00:00:00 2001 From: Haroun EL ALAMI Date: Tue, 22 Apr 2025 08:57:52 +0200 Subject: [PATCH 2/2] add emulator option to unlock network speed --- start-emulator.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start-emulator.sh b/start-emulator.sh index 93a6869..e1f0c26 100644 --- a/start-emulator.sh +++ b/start-emulator.sh @@ -18,4 +18,4 @@ fi chmod -x /opt/android-sdk/emulator/crashpad_handler # Start the emulator with the appropriate ramdisk.img -/opt/android-sdk/emulator/emulator -avd android -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -no-metrics $RAMDISK ${SDCARD_SIZE:+$SDCARD} -qemu -m ${RAM_SIZE:-4096} \ No newline at end of file +/opt/android-sdk/emulator/emulator -avd android -nojni -netfast -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -no-metrics $RAMDISK ${SDCARD_SIZE:+$SDCARD} -qemu -m ${RAM_SIZE:-4096} \ No newline at end of file