In order to create a development image file for android virtual device, you must follow this steps (worked for me)
1) Build your environment with a generic build for development, no particular target processor architecture but actually you should/can target the CPU architecture of the machine host running the emulator
source script/envsetup.sh
choosecombo
(no params here, add them manually)
Which would you like? debug
Which product would you like? sdk_phone_x86_64
Which would you like? userdebug
OUTPUT:
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=13
TARGET_PRODUCT=sdk_phone_x86_64
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=debug
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86_64
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.15.0-67-generic-x86_64-Ubuntu-22.04.2-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=TQ1A.230205.002
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl
============================================
2) Create a normal image using the Android AVD image, for example PIXEL7 with latest Android OS available. This will help you to confirm that everything works on your machine. Start the created virtual machine and if starts you are ok to continue
3) Identify where the step2 image files were created. On my Ubuntu22 those files are located to
/home/alin/.android/avd/
Here you will find YOUR_AVD_IMAGE.avd folder name and its config YOUR_AVD_IMAGE.ini
4) Create the following folder structure for your image, by creating the GrapheneOs.avd folder and GrapheneOs.ini file.
Paste the following content to GrapheneOs.ini file and adjust paths
avd.ini.encoding=UTF-8
path=/path/to/..../avd/GrapheneOs.avd
path.rel=avd/GrapheneOs.avd
Please note that GrapheneOs.avd path in path var must point to your GrapheneOs.avd folder
5) The structure of GrapheneOs.avd folder is:
-->sysdir (folder)
-------->data (empty folder but must exists)
-------->kernel-ranchu (copy from /grapheneos-13/out/target/product/emulator_x86_64/kernel-ranchu)
-------->encryptionkey.img (copy from /grapheneos-13/out/target/product/emulator_x86_64/encryptionkey.img)
-------->ramdisk.img (copy & rename from /grapheneos-13/out/target/product/emulator_x86_64/ramdisk-qemu.img)
-------->system.img(copy & rename from /grapheneos-13/out/target/product/emulator_x86_64/system-qemu.img)
-------->vendor.img(copy & rename from /grapheneos-13/out/target/product/emulator_x86_64/vendor-qemu.img)
-------->advancedFeatures.ini (copy & rename from /grapheneos-13/out/target/product/emulator_x86_64/advancedFeatures.ini)
-------->VerifiedBootParams.textproto (copy & rename from /grapheneos-13/out/target/product/emulator_x86_64/VerifiedBootParams.textproto)
-------->build.prop (content below step 6)
-->sdcard.img (copy paste this one from the original pixel avd folder from step 2)
-->userdata.img (copy from /grapheneos-13/out/target/product/emulator_x86_64/userdata.img)
-->config.ini (content below step 6)
6) config.ini content
AvdId=GrapheneOs
PlayStore.enabled=false
avd.ini.encoding=UTF-8
disk.dataPartition.size=6G
fastboot.forceChosenSnapshotBoot=yes
fastboot.forceColdBoot=yes
fastboot.forceFastBoot=no
hw.accelerometer=yes
hw.arc=false
hw.arc.autologin=false
hw.audioInput=yes
hw.audioOutput=yes
hw.battery=yes
hw.camera.back=emulated
hw.camera.front=emulated
hw.dPad=no
hw.gps=yes
hw.gpu.enabled=yes
hw.gpu.mode=auto
hw.cpu.arch=x86_64
hw.cpu.ncore=4
image.sysdir.1=/path/to/avd/GrapheneOs.avd/sysdir/
hw.gsmModem=true
hw.gyroscope=true
hw.initialOrientation=Portrait
hw.keyboard=yes
hw.keyboard.charmap=qwerty2
hw.keyboard.lid=false
hw.lcd.backlight=true
hw.lcd.circular=false
hw.lcd.density=560
hw.lcd.depth=16
hw.lcd.height=3120
hw.lcd.width=1440
hw.lcd.vsync=60
hw.mainKeys=yes
hw.multi_display_window=false
hw.ramSize=4096
hw.rotaryInput=false
hw.screen=multi-touch
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=yes
hw.trackBall=no
hw.useext4=true
runtime.network.latency=none
runtime.network.speed=full
sdcard.path=/path/to/avd/GrapheneOs.avd/sdcard.img
sdcard.size=512 MB
skin.dynamic=no
skin.name=1440x2960
skin.path=1440x2960
vm.heapSize=1024
sysdir folder is the one created at step 5
sdcard path is optionall in case you provide the dummy img from early defined original avd image
7) Start emulator
/path/to/emulator -avd GrapheneOs -verbose -debug all
Notes:
- Video drivers might generate problems if they are not properly installed