Android emulator64-x86 hangs during the boot process - android

I'm using a 64bits Debian and when I try to run this:
$ emulator64-x86 -verbose -avd cocos2dx-emulator -gpu on -qemu -m 2047 -enable-kvm
The process just hangs and the only way to stop it is using kill -9, these are the last output lines it prints:
[...]
emulator: trying to find: /home/victor/lab/androidr16/android-sdk-linux/tools/bios.bin
emulator: trying to find: /home/victor/lab/androidr16/android-sdk-linux/tools/lib/pc-bios/bios.bin
emulator: trying to find: /home/victor/lab/androidr16/android-sdk-linux/tools/vgabios-cirrus.bin
emulator: trying to find: /home/victor/lab/androidr16/android-sdk-linux/tools/lib/pc-bios/vgabios-cirrus.bin
If I use emulator-x86, it works fine:
$ emulator-x86 -verbose -avd cocos2dx-emulator -gpu on -qemu -m 2047 -enable-kvm
[...]
emulator: trying to find: /home/victor/lab/androidr16/android-sdk-linux/tools/bios.bin
emulator: trying to find: /home/victor/lab/androidr16/android-sdk-linux/tools/lib/pc-bios/bios.bin
emulator: trying to find: /home/victor/lab/androidr16/android-sdk-linux/tools/vgabios-cirrus.bin
emulator: trying to find: /home/victor/lab/androidr16/android-sdk-linux/tools/lib/pc-bios/vgabios-cirrus.bin
emulator: autoconfig: -scale 1
emulator: Could not open file: (null)/system/build.prop: No such file or directory
emulator: sent '0012host:emulator:5555' to ADB server
[...]
I don't have any clue about what's going on and I'm not able to find any possible related errors in the system logs.
Any ideas?

A similar bug has been filed in AOSP (see below), although most of us experience the same result with emulator-x86 as well.
As a workaround, try to uninstall KVM and see if the emulator runs. It will obviously be slower since it's not using the VT extensions of your CPU, but it may narrow the source of the problem.
Issue 33817: emulator-x86 + kvm triggers an endless loop in qemu-setup.c
https://code.google.com/p/android/issues/detail?id=33817
Then again, you might only need to run the 32-bit emulators and this might not be an issue at all.
Edit: The issue appears to be caused by a clone() in pulseaudio code called from external/qemu/audio/paaudio.c. A patch that adds the BEGIN_NOSIGALRM guard is available on the Issue 33817 thread, post 16:
https://code.google.com/p/android/issues/detail?id=33817#c16

Related

How to boot Android Emulator with more than 16 cpus

I'd like to boot Android on Emulator with more than 16 cpus.
Debug step:
I configured Kernel Features-->Maximum number of CPUs to 128. Then I changed android qemu hw/arm/ranchu.c mc->max_cpus to 128 too.
Start Android with:
emulator -avd test_wzh -show-kernel -skip-adb-auth -no-snapshot -kernel /root/wangzhh/image/Image -no-window -writable-system -partition-size 65536 -verbose -gpu host -qemu -enable-kvm -m 16384 -realtime mlock=off -smp 32,sockets=32,cores=1,threads=1
Check cpu in the guest:
adb -s emulator-5554 shell
Only 16 cpus online, all the cpu after index 16 shows same error log
Printk to debug kernel
I traced the kernel code and found the error report by
psci_to_linux_errno case PSCI_RET_INVALID_ADDRESS
Kernel log:
...
Detected VIPT I-cache on CPU15
CPU15: found redistributor f region 0:0x0000000008280000
Invalid sched_group_energy for CPU15
CPU15: update cpu_capacity 1024
CPU15: Booted secondary processor [481fd010]
psci: failed to boot CPU16 (-22)
CPU16: failed to boot: -22
...
Thanks to anyone who can help!
Also, I guess it related to the dts, but I don't know which dts used by android emulator, who knows this problem?
As explained here (https://github.com/intel/haxm/issues/195) HAXM supports up to 16 VCPUs, but you can download source code from GitHub (https://github.com/intel/haxm/releases), change specific variable/constant in the Source, recompile it and replace existent binary/library.
Or you have to change Emulator to something different (KVM?).
As far as I know - you can only set a max of 4 sockets. So you might wanna change from:
-smp 32,sockets=32,cores=1,threads=1
to:
-smp 32,sockets=1,cores=32,threads=1

custom android 11 update

I try to develop an android system, I have some problems with development.
I get used to ubuntu18 and tag of android 11 is android-11.0.0_r17,
I have built successfully with lunch 30 "aosp_x86-eng" and I have seen $OUT files and checked
then I prepared test_aosp.sh file under ~/bin
the results are like that and no emulator window appears:
$ ./test_aosp.sh
emulator: Android emulator version 30.0.21.0 (build_id 6647651) (CL:N/A)
emulator: Found AVD name 'a25x86'
emulator: Found AVD target architecture: x86
emulator: argv[0]: 'emulator'; program directory: '/home/ubuntu/aosp/prebuilts/android-emulator/linux-x86_64'
PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT
the content of test_aosp.sh is :
#!/bin/sh
emulator -avd a25x86 -verbose -show-kernel -system $OUT/system.img -ramdisk $OUT/ramdisk.img -initdata $OUT/userdata.img
when I checked ROGER YE notes, before that partition he had run ~/Android/Sdk/emulato/emulator #a25x86, also I did it with the last version of android studio.
Also, I try to do the following thing but is has a loop in the command line and the black window of emulator shows up but not appear any menu and any more:
$ sudo ~/Android/Sdk/emulator/emulator -avd a25x86 -verbose -show-kernel -system $OUT/system.img -ramdisk $OUT/ramdisk.img -initdata $OUT/userdata.img
also I have checked the emulator location with the following command:
$ which emulator
/home/ubuntu/aosp/prebuilts/android-emulator/linux-x86_64/emulator
also I want to add following results, maybe you want to check it:
$ printenv |grep ANDROID
ANDROID_DEV_SCRIPTS=/home/ubuntu/aosp/development/scripts:/home/ubuntu/aosp/prebuilts/devtools/tools:/home/ubuntu/aosp/external/selinux/prebuilts/bin:/home/ubuntu/aosp/prebuilts/misc/linux-x86/dtc:/home/ubuntu/aosp/prebuilts/misc/linux-x86/libufdt
ANDROID_TOOLCHAIN_2ND_ARCH=
ANDROID_PRE_BUILD_PATHS=/home/ubuntu/aosp/prebuilts/jdk/jdk11/linux-x86/bin:
ANDROID_HOST_OUT_TESTCASES=/home/ubuntu/aosp/out/host/linux-x86/testcases
ANDROID_JAVA_TOOLCHAIN=/home/ubuntu/aosp/prebuilts/jdk/jdk11/linux-x86/bin
ANDROID_TARGET_OUT_TESTCASES=/home/ubuntu/aosp/out/target/product/generic_x86/testcases
ANDROID_BUILD_TOP=/home/ubuntu/aosp
ANDROID_BUILD_PATHS=/home/ubuntu/aosp/out/soong/host/linux-x86/bin:/home/ubuntu/aosp/out/host/linux-x86/bin:/home/ubuntu/aosp/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin:/home/ubuntu/aosp/development/scripts:/home/ubuntu/aosp/prebuilts/devtools/tools:/home/ubuntu/aosp/external/selinux/prebuilts/bin:/home/ubuntu/aosp/prebuilts/misc/linux-x86/dtc:/home/ubuntu/aosp/prebuilts/misc/linux-x86/libufdt:/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/llvm-binutils-stable:/home/ubuntu/aosp/prebuilts/android-emulator/linux-x86_64:/home/ubuntu/aosp/prebuilts/asuite/acloud/linux-x86:/home/ubuntu/aosp/prebuilts/asuite/aidegen/linux-x86:/home/ubuntu/aosp/prebuilts/asuite/atest/linux-x86:
ANDROID_EMULATOR_PREBUILTS=/home/ubuntu/aosp/prebuilts/android-emulator/linux-x86_64
ANDROID_PRODUCT_OUT=/home/ubuntu/aosp/out/target/product/generic_x86
ANDROID_PYTHONPATH=/home/ubuntu/aosp/development/python-packages:
ANDROID_TOOLCHAIN=/home/ubuntu/aosp/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin
ANDROID_JAVA_HOME=/home/ubuntu/aosp/prebuilts/jdk/jdk11/linux-x86
ANDROID_HOST_OUT=/home/ubuntu/aosp/out/host/linux-x86
Could you guide me?
Thank you
Regards
if you successfully built, you can run emulator without additional arguments. Just typing emulator in console.
Or, please try to set ANDROID_SDK_ROOT as suggested.
export ANDROID_SDK_ROOT=/path/to/your/sdk/for/avd

Booting Android (Samsung) Kernel in QEMU

Trying to boot a Samsung S7 Edge Kernel 3.18.x using QEMU
/usr/local/bin/qemu-system-aarch64 -M virt -cpu cortex-a57 -kernel $HOME/s7boot/boot.emmc.win-zImage -initrd $HOME/s7boot/boot.emmc.win-ramdisk.gz -nographic
Nothing happens
Screen remains as it was.
CPU is at 100% for QEMU process
Using QEMU
/usr/local/bin/qemu-system-aarch64 --version
QEMU emulator version 4.1.0
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
Trying it with -s -S
/usr/local/bin/qemu-system-aarch64 -M virt -cpu cortex-a57 -kernel $HOME/s7boot/boot.emmc.win-zImage -initrd $HOME/s7boot/boot.emmc.win-ramdisk.gz -nographic -s -S
GDB
Type "apropos word" to search for commands related to "word".
(gdb) target remote:1234
Remote debugging using :1234
warning: while parsing target description (at line 1): Target description specified unknown architecture "aarch64"
warning: Could not load XML target description; ignoring
0x00000000 in ?? ()
(gdb) cont
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x40080000 in ?? ()
(gdb) cont
Continuing.
So I guess it get stuck at 0x4008000
Anynway .... I tried serveral Kernels (downloaded from device, LineageOS, Some other custom, also compiled one from Samsung Sources) with no luck.
Questions:
Anybody booted Samsung/Android Kernel in QEMU?
Thanks,
Related to:
Booting Kernel in QEMU - PFLASH: Possible BUG - Write block confirm
This is the same question as Boot Sasmsung S7 Edge extraced Kernel from Device in Android Emulator but for QEMU proper rather than the Android emulator, and the answer is the same -- you need a kernel that's been built to run on the machine type you're using, which in this case is the "virt" board. Trying to boot a random kernel pulled off a different hardware device is never going to work.

Blank emulator after compililing Android 7.1.1 using Source code, how to get the emulator to work?

I have been trying to get the source code to compile from some time and finally got it compiled. However I am having issues with the emulator where it shows a pop up screen but is quite blank.
I am using Ubuntu Server Xenial and Android 7.1.1 for Nexus6P (but I dont own a Nexus6P so I need to run this on the emulator)
I have tried specifying all the directories such as (-sysdir,-sysdir, -datadir, -kernel, -ramdisk, -system, -data, -cache, -sdcard) although I know that these are supposed to be auto populated by the envsetup.sh file.
The command I used is this:
emulator -kernel ./prebuilts/qemu-kernel/arm64/kernel-qemu -ramdisk ./out/debug/target/product/angler/ramdisk.img -sysdir ./out/debug/target/product/angler/ -cache ./out/debug/target/product/angler/cache.img -system ./out/debug/target/product/angler/system.img -data ./out/debug/target/product/angler/userdata.img -memory 4096 -partition-size 4096 -sdcard sdcard.img -skindir ./sdk/emulator/skins/ -skin WVGA800
I changed the kernel to others such as for ARM/ARM64 but to no avail. All I see is a blank emulator and after changing it to ARM following error:
http://pastebin.com/A04NmNLn
I am at a loss as to why the emulator wont work. Also where is the "image" file with which we can install the Android on Genymotion-type external emulator.
Any help is appreciated!
In order to build AOSP to be run in emulator, there is no need to download any additional binaries. At the same time, emulator cannot run images build for real devices. Therefore, it is required to only download the sources of Android and execute the following commands within the directory with the downloaded sources:
source build/envsetup.sh
lunch aosp_arm-eng #or aosp_x86_64-eng, etc. for details see documentation
make -j4
After the sources are build in the same terminal run the emulator command and the emulator should appear.

"ERROR: OpenGLES initialization failed!" on CentOS with android SKD

When I run:
/usr/local/android-sdk-linux/tools/emulator -avd tst
I get the error:
Failed to open lib64EGL_translator
Failed to init_egl_dispatch
emulator: ERROR: OpenGLES initialization failed!
emulator: ERROR: OpenGLES emulation library could not be initialized!
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
emulator: emulator window was out of view and was recentered
I've followed the steps here: http://www.redips.net/android/emulator-fedora-linux/
I've also tried using the commands emulator-arm and emulator64-arm
Another thing I tried was
export LD_LIBRARY_PATH=/usr/local/android-sdk-linux/tools/lib:$LD_LIBRARY_PATH
Another attempt was with the parameters:
-no-audio -gpu off
I'm using a fresh install of CentOS 6.6 with yum update ran. I'm using the android SDK: http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz
I ran /usr/local/android-sdk-linux/tools/android and installed the Android 5.0 api+arm. I tried again with a Android 4.4 AVM.
I've tried all the suggestions I could find. Any other suggestions?
Before running the emulator from the command line add the lib64 directory to the LD_LIBRARY_PATH, e.g.:
$ export LD_LIBRARY_PATH=/usr/local/android-sdk-linux/tools/lib64:$LD_LIBRARY_PATH
or
$ export LD_LIBRARY_PATH=$HOME/Android/Sdk/tools/lib64:$LD_LIBRARY_PATH
dependently on the SDK installation path.
My reply is meant to "second" brian's post, so it is known brian is not the only one seeing this error.
On my CentOS 6.6 box I have also tried the same steps listed and I am also seeing nearly the same error messages. The only difference is I do not get:
emulator: emulator window was out of view and was recentered
My emulator does run with just basic invocation (this AVD is not configured to use the host's GPU):
emulator -avd Nexus_S_ARM
But the error messages indicate something is broken and should be put right.
The 'export LD_LIBRARY_PATH=/usr/local/android-sdk-linux/tools/lib:$LD_LIBRARY_PATH' made it workd for me. Also specfied '-gpu off' in the command line.

Categories

Resources