Android running on RISC-V (XuanTie 910) has come!

723 views
Skip to first unread message

Yunhai Shang

unread,
Jan 21, 2021, 6:02:29 AM1/21/21
to RISC-V SW Dev
Android running on RISC-V (XuanTie 910) has come, and all relevant source codes have been opened.  Below is the link :
The open source project repository for AOSP on RISC-V:  https://github.com/T-head-Semi/aosp-riscv
Wecome to join us and push it foward.图片1.png

Drew Fustini

unread,
Jan 21, 2021, 10:27:40 AM1/21/21
to Yunhai Shang, RISC-V SW Dev
Wow, that is great news!  When I speak about RISC-V, I often get asked about Android.  I thought it would be awhile before ART was working.  Impressive!

Now I am looking forward to getting a RISC-V smartphone in the future. :)

Thanks
Drew


ghalib khan

unread,
Feb 16, 2021, 6:08:53 AM2/16/21
to RISC-V SW Dev, shang...@gmail.com
Hello folks,

                           I have cloned and build aosp-riscv project for Emulator, Currently there was 2 issues as follows with the build step's what i have used,

$ cd aosp-riscv 

$ ./reproduce.sh 

Here, cloning and building aosp-riscv was successful, But when i lunch Emulator it started but stay at the blank screen with android log and show's  invalid register read & write, and end with Segmentation fault (core dumped) in few seconds as shown in below picture.

If you have ever faced this issue please ping me with the solution or any not can suggest any solution. 

GetImage.png

Thanks in Advance,

Ghalib khan c.

xialf....@gmail.com

unread,
Feb 18, 2021, 8:39:43 AM2/18/21
to RISC-V SW Dev, ghalib.ex...@gmail.com, shang...@gmail.com
Hi Ghalib,
Sorry for the reply, we are currently in the holiday of Chinese New year.
"invalid register read & write" is not a fatal error, the Android can start up with it.
In this picture, I can't get anything useful for analysis.
For emulator, you can add the option "-debug all" and "-show-kernel" to get more message. And You can connect to the target via "adb shell", and execute "logcat" in the shell when the kernel startup. You can get more information via the log.

It looks like some libraries or execution files in the prebuilts are not suitable for your host. We can start up successfully in Ubuntu-16.04 and Ubuntu-18.04.

Lifang Xia

ghalib khan

unread,
Feb 19, 2021, 5:24:18 AM2/19/21
to RISC-V SW Dev, xialf....@gmail.com, ghalib khan, shang...@gmail.com
Hello Lifang Xia,

Firstly, thanks for your support,  I have 2 issues like,
1. Emulator is not lunching with proper GUI & 
2. one more is like How can i debug or know the building of Android from sources.

Build Environment : Ubuntu-18.04

Here are the log's i have collected with the respective commands of adb,

1. 
         * I have lunched Emulator in one Terminal and with this options as follows
$ emulator -verbose -debug all -show-kernel -selinux permissive -qemu -smp 2 -m 3800M -bios /home/performance-server/ghalib-khan/android/t-head/aosp-riscv/aosp/prebuilts/qemu-kernel/riscv64/ranchu/fw_jump.bin |& tee log.txt

          * In one more Terminal i was Running following adb commands as follows with log's attached,
$ adb shell logcat |& tee logcat.txt 

$ adb shell logcat -b kernel -d |& tee logcat_kernel.txt 

$ adb shell bugreport |& tee bugreport.txt 

           In Addition to this i have Attached adb commands run from command line, is showed in the picture. 

android-adb-cmds.png

Kernel Version:

android-emulator-adb-kernel.png

2. 

  As per the building flow i have debugged the steps from reproduce.sh 

In this script we have 4 step's build 

  1. Download prebuilts 

  2. Download aosp 

  3. Apply Patch's aosp 

  4. Build aosp

Build flow of aosp as per reproduce.sh script:-
                          source ./build/envsetup.sh 
                          lunch aosp_riscv64-eng
                          m -j
                          /home/performance-server/ghalib-khan/android/t-head/aosp-riscv/aosp/build/soong/soong_ui.bash --make-mode -j
                          /home/performance-server/ghalib-khan/android/t-head/aosp-riscv/aosp/out/soong_ui --make-mode -j

This build is in percentage format from soong_ui --make-mode -j i just want to know How build was happening, i straightly i want to build it for an real hardware. so how can i do.

Regards

Ghalib khan.

logcat_kernel.txt
logcat.txt
bugreport.txt
log.txt

ghalib khan

unread,
Mar 4, 2021, 4:44:43 AM3/4/21
to RISC-V SW Dev, ghalib khan, xialf....@gmail.com, shang...@gmail.com, de...@exaleapsemi.com
Hello Lifang Xia,

           Am waiting for your reply from past 2-weeks. In mean while, i have debugged emulator from emulator log there i have found few interesting things as follow's,
  • In Emulator log i found qemu command with the arguments like:-
  /home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/qemu-system-riscv64 -dns-server 127.0.0.53 -serial null -device goldfish_pstore,addr=0xff018000,size=0x10000,file=/home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/out/target/product/generic_riscv64/build.avd/data/misc/pstore/pstore.bin -cpu rv64gcsu-v1.10.0 -machine type=ranchu -m 2048 -lcd-density 240 -nodefaults -kernel /home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/prebuilts/qemu-kernel/riscv64/ranchu/kernel-qemu -initrd /home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/out/target/product/generic_riscv64/ramdisk.img -drive index=0,id=vendor,if=none,file=/home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/out/target/product/generic_riscv64/vendor-qemu.img,read-only -device virtio-blk-device,drive=vendor -drive index=1,id=userdata,if=none,file=/home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/out/target/product/generic_riscv64/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-device,drive=userdata -drive index=2,id=cache,if=none,file=/home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/out/target/product/generic_riscv64/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-device,drive=cache -drive index=3,id=system,if=none,file=/home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/out/target/product/generic_riscv64/system-qemu.img,read-only -device virtio-blk-device,drive=system -netdev user,id=mynet -device virtio-net-device,netdev=mynet -device virtio-rng-device -show-cursor -L /home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/prebuilts/android-emulator/linux-x86_64/lib/pc-bios -smp 2 -m 3800M -bios /home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/prebuilts/qemu-kernel/riscv64/ranchu/fw_jump.bin -append 'qemu=1 no_timer_check security=selinux android.boot.selinux=permissive androidboot.hardware=ranchu androidboot.serialno=EMULATOR30X1X2X0 android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.settings.system.screen_off_timeout=2147483647 qemu.vsync=60 qemu.gltransport=pipe qemu.gltransport.drawFlushInterval=800 qemu.opengles.version=131072 cma=6M@0-4G androidboot.selinux=permissive loop.max_part=7 androidboot.vbmeta.size=4352 androidboot.vbmeta.hash_alg=sha256 androidboot.vbmeta.digest=6e147225fe925a0e11d4dff19fb6bb83c41208fdc3ae463b9176d122ea72fcbc ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=512m' -android-hw /home/performance-server/ghalib-khan/android/t-head/test/aosp-riscv/aosp/out/target/product/generic_riscv64/hardware-qemu.ini

I have figured it, why it is picking prebuild qemu-kernel image from prebuild folder, with help of $ emulator -help-build-images command. it say's If the kernel image is not found in the out directory, then it is searched
  in <build-root>/prebuilts/qemu-kernel/.
  • With this statement i have confirmed that kernel i not build.

Can you please cross verify it or suggest me what's wrong going with build but in build i didn't faced any failures, build was success.

Reply ASAP.

Ghalib khan c.

xialf....@gmail.com

unread,
Mar 4, 2021, 9:54:18 PM3/4/21
to RISC-V SW Dev, ghalib.ex...@gmail.com, xialf....@gmail.com, shang...@gmail.com, de...@exaleapsemi.com
Hello Ghalib,
Sorry for that I missed last email. 
The kernel-qemu in ASOP/prebuilts/qemu-kernel/riscv64/ranchu/ is prebuilt image for riscv64 emulator. Actually, the kernel-qemu is a vmlinux which is built from an other project. you can find the project in the manifests which branch is common-android-5.4-stable.
If you can't startup Android in emulator, you can try update the kernel-qemu:

If you want to build the kernel, you should get the repo with branch "common-android-5.4-stable", and modify some drivers for android10.

And if you want to run android10 on your device, you should add .mks in AOSP/device for your device. You can follow the .mks defined for hikey960, but it is for arm64, you should replace the arch with riscv64.

SORRY AGAIN!!!

Best Regards,
Lifang

ghalib khan

unread,
Mar 8, 2021, 1:42:42 AM3/8/21
to RISC-V SW Dev, xialf....@gmail.com, ghalib khan, shang...@gmail.com, de...@exaleapsemi.com
Hello Lifang,

                 Firstly thanks for reply, in the recent mail you have mentioned 3 points, i will go with each.
1. Emulator is launching with prebuilt kernel-qemu image in ASOP/prebuilts/qemu-kernel/riscv64/ranchu/ :-

         I'll mention few point's her, 
  • we are building AOSP for qemu from scratch sources right then it has to build each and all part's of system like kernel, toybox & bionic. Then why it's using prebuild kernel image and why Actual kernel-qemu vmlinux sources are not used ?
  • As you said in earlier mail to use update kernel-qemu, so i have replaced all file in aosp-riscv/aosp/out/target/product/generic_riscv64 with wget https://rosp-riscv.oss-cn-hangzhou.aliyuncs.com/prebuilts/images/emulator/android-emu-images-20210226.tar.bz. Then also no changes, Emulator started but stay at the blank screen with android log and show's  invalid register read & write, and end with Segmentation fault (core dumped).
2.  Building kernel with common-android-5.4-stable branch:- 

             Can you suggest what kind of modifications we have do in common-android-5.4-stable branch.

Thanks 
Ghalib khan.

Han Mao

unread,
Mar 8, 2021, 4:30:29 AM3/8/21
to RISC-V SW Dev, ghalib.ex...@gmail.com, xialf....@gmail.com, shang...@gmail.com, de...@exaleapsemi.com
Hi  Ghalib , 

>> I have figured it, why it is picking prebuild qemu-kernel image from prebuild folder, with help of $ emulator -help-build-images command. it say's If the kernel image is not found in the out directory, then it is searched
>>  in <build-root>/prebuilts/qemu-kernel/.

out/target/product/*/kernel-ranchu is normally a copy of prebuilts/qemu-kernel/*/kernel-*,the rule is defined under device/generic/*/*.mk. As we didn't define these stuff for aosp_riscv64, there will be no kernel-ranchu under out/. It is not strictly necessary for a device config.

>> 2.  Building kernel with common-android-5.4-stable branch:- 
>>
>>         Can you suggest what kind of modifications we have do in common-android-5.4-stable branch.

You can build kernel with gcc directly:
make config_name ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-
make Image
Clang support for kernel will require some extra modification.

 >> Emulator started but stay at the blank screen with android log and show's  invalid register read & write, and end with Segmentation fault (core dumped).

I've seen similar error on x86 before, my colleague gets Segmentation fault in his environment;but I can start emulator successfully with the same AOSP
project and images. 

This linker contains a whole AVD environment, including several images generated from my workspace that can boot android successfully.
If you are not able to boot android with these images, it's most likely something gets wrong in your local enviroment.
You may debug emulator with gdb directly: gdb --args emulator  [emulator args]

Regards
Mao Han

Reply all
Reply to author
Forward
0 new messages