Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(os): add sdcard option #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
- ./extras:/extras
environment:
- DNS=one.one.one.one
- SDCARD_SIZE=64G
- RAM_SIZE=8192
privileged: true
devices:
Expand Down
16 changes: 14 additions & 2 deletions start-emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
/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}
Loading