If you don't know what Android is, what risc-v is, or what they have to do with one another, start by reading Android and RISC-V: What you need to know to be ready.
This github project is solely for issue tracking/discussion/documentation purposes.
All Android/riscv64 work is being done directly in AOSP. Patches should be sent to AOSP using the usual AOSP contribution process and not as pull requests here.
You might also want to subscribe to the sig-android mailing list. (You need to send mail to sig-android+subscribe@lists.riscv.org and then click "Join" on the mailing list web site.) You can see the topics up for discussion -- or add your own -- for the monthly meeting in the Android SIG meeting topics doc. But there's no need to wait for the meeting: you can ask questions on the mailing list at any time!
We're currently (2024Q2) using cuttlefish virtual devices to run ART (with the JIT enabled) to boot to the homescreen, and the shell and command-line tools (and all the libraries they rely on) have been working great for a while.
You can see the current status of the
riscv64 build in CI in the aosp_cf_riscv64_phone
column (between arm64 and x86-64) of
ci.android.com, but we're not
currently (2024Q2) running the tests in CI.
We have not defined the Android NDK ABI for riscv64 yet, but we're working on it, and it will be added to the Android ABIs page (and announced on the SIG mailing list) when it's done. In the meantime, you can download NDK r27 beta 1 which has provisional support for riscv64. The ABI it targets is less than what the final ABI will be, so although code compiled with it will not take full advantage of Android/riscv64 hardware, it should at least be compatible with those devices. (Though obviously part of the point of giving early access to it is to try to find any serious mistakes we need to fix, and those fixes may involve ABI breaks!)
Download the source using the usual AOSP download process and then:
$ cd aosp
$ source build/envsetup.sh
$ lunch aosp_cf_riscv64_phone-trunk_staging-userdebug
============================================
PLATFORM_VERSION_CODENAME=VanillaIceCream
PLATFORM_VERSION=VanillaIceCream
PRODUCT_INCLUDE_TAGS=com.android.mainline mainline_module_prebuilt_nightly
TARGET_PRODUCT=aosp_cf_riscv64_phone
TARGET_BUILD_VARIANT=userdebug
TARGET_ARCH=riscv64
TARGET_ARCH_VARIANT=riscv64
TARGET_CPU_VARIANT=generic
HOST_OS=linux
HOST_OS_EXTRA=Linux-6.5.13-1rodete2-amd64-x86_64-Debian-GNU/Linux-rodete
HOST_CROSS_OS=linux_musl
BUILD_ID=MAIN
OUT_DIR=out
============================================
$ make -j
If you want to check whether a particular directory builds, cd
into
that directory and use mm -j
.
(For more tips on building in general, see Building Android.)
To launch cuttlefish, follow the general AOSP cuttlefish setup instructions.
Note that you need at least qemu 8.1 (and qemu 9.0 has important fixes for the V extension), so you'll probably want to use the prebuilt qemu binaries in AOSP (as shown in the example commands below).
After building, run this following command from the same shell:
$ launch_cvd -cpus=4 --memory_mb=8192 --gpu_mode=none
After about 10s you should be able to use adb shell
to connect to your riscv64 cuttlefish!
After building, run this following command from the same shell:
$ launch_cvd -cpus=8 --memory_mb=8192
You can then use vncviewer localhost:6444
to connect to your riscv64 cuttlefish!
(Note that even on a fast Xeon workstation it takes several minutes to get to the boot animation and ten minutes to get to the home screen!)
Consult the regular AOSP Contributing documentation for more information on how to send us your patches.
Note that changes to projects under external/
(other than to
Android.bp
files) typically need to go to the upstream open source
project in question first, and will then be merged into AOSP from
there. In many cases, the METADATA
file will point you to the
upstream source, but feel free to ask here if not!
This project follows Google's Open Source Community Guidelines.