How to boot Android Emulator with more than 16 cpus - android

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

Related

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.

Android emulator: UpdateCheck: failed to get a URL: 51 (Error)

I am developing with Android Studio 1.5 on an emulated Nexus 5 (API v23) with Ubuntu 15.10 x64. I am behind a proxy (http_proxy environment variable is set).
Creating a new project, and I get an error straight off the bat. This answer fixes it. Next I try to build it, the emulated phone frame loads, but is black (no content shown). The console says this:
Android/Sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5_API_23_x86
emulator: WARNING: UpdateCheck: failed to get a URL: 51 (Error)
emulator: WARNING: UpdateCheck: failed to get the latest version, skipping check (current version '24.4.1'
So maybe it's a proxy issue? - BTW: my "gradle.properties" automatically populated: systemProp.http.proxyHost, systemProp.http.proxyUser, systemProp.http.proxyPort.
EDIT: Same error with Android/Sdk/tools$ ./emulator #Nexus_5_API_23_x86 -http-proxy $HTTP_PROXY
When used your This answer i got the error in command line as
FATAL:.//android/base/sockets/SocketWaiter.cpp:88:Check failed: isValidFd(fd). fd 1064 max1024
So this error can be resolved by starting emulator from the command line using this command
emulator.exe -avd <avd_name> -no-audio -http-proxy <proxy_name>:<proxy_port>

Android emulator64-x86 hangs during the boot process

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

android emulator can not open audio output

I am working on an Ubuntu 12.04 machine. I have built android from source code (gingerbread release 2.3.6), and trying the emulator. But it fails to open audio output.
Results of audio debug are below:
myself#mycomp:~/my-android$ out/host/linux-x86/bin/emulator -debug audio
emulator: WARNING: system partition size adjusted to match image file (70 MB > 66 MB)
emulator: qpa_audio_init: entering
emulator: could not find libpulse on this system
emulator: qpa_audio_init: exiting
audio: Could not init `pa' audio driver
emulator: qesd_audio_init: entering
emulator: could not find libesd on this system
audio: Could not init `esd' audio driver
audio: Could not init `alsa' audio driver
emulator: qpa_audio_init: entering
emulator: could not find libpulse on this system
emulator: qpa_audio_init: exiting
audio: Could not init `pa' audio driver
emulator: qesd_audio_init: entering
emulator: could not find libesd on this system
audio: Could not init `esd' audio driver
audio: Could not init `alsa' audio driver
oss: Could not initialize DAC
oss: Failed to open `/dev/dsp'
oss: Reason: No such file or directory
oss: Could not initialize DAC
oss: Failed to open `/dev/dsp'
oss: Reason: No such file or directory
audio: Failed to create voice `goldfish_audio'
emulator: warning: opening audio output failed
I see that pulseaudio is running:
myself#mycomp:~/my-android$ ps aux | grep pulse
myself 2015 0.0 0.0 415940 5972 ? S<l 09:26 0:00 /usr/bin/pulseaudio --start --log-target=syslog
myself 7402 0.0 0.0 9380 932 pts/5 S+ 11:44 0:00 grep --color=auto pulse
also I have some libpulse libraries under /usr/lib/ :
myself#mycomp:/usr/lib$ find . -name "libpulse*"
./x86_64-linux-gnu/libpulse-simple.so.0.0.3
./x86_64-linux-gnu/libpulse-mainloop-glib.so.0.0.4
./x86_64-linux-gnu/libpulsecommon-1.1.so
./x86_64-linux-gnu/libpulse.so.0.13.5
./x86_64-linux-gnu/libpulse.so.0
./x86_64-linux-gnu/libpulse-mainloop-glib.so.0
./x86_64-linux-gnu/libpulse-simple.so.0
./x86_64-linux-gnu/libpulsedsp.so
./jvm/java-6-openjdk-amd64/jre/lib/amd64/libpulse-java.so
./libpulsecore-1.1.so
I have searched the net for solutions to the problem, but I could not find anyone working for me.
Thanks in advance,
The x86 (32bit) version of the libraries are available when you install the package 'libpulse0:i386':
sudo apt-get install libpulse0:i386
This will privide the libraries: /usr/lib/i386-linux-gnu/libpulse-simple.so
The emulator should now be able to run with the audio output detected.
Alternatively, you can launch the emulator with the option '-no-audio' to disable the audio subsystem completely.
I guess that you cannot build gingerbread on Ubuntu 12.04. Here you can find the following note:
Building on Ubuntu 12.04 is currently only experimentally supported and is not guaranteed to work on branches other than master.
I've tried to build it but there were several problems in my case so I preferred to switch to Ubuntu 10.04
If you are building the emulator yourself, you probably need to have the libpulse-dev package installed on your build system. It looks like you probably don't have that installed, as your library list doesn't include some versionless symlinks included in the -dev package.
You could either try
sudo apt-get install libpulse-dev
and reconfigure and rebuild and try again, or maybe first as a test install a prebuilt sdk and see if audio works in its emulator on your system.
I have the same issue on Fedora 17 64 bit, the issue was the corresponding 32 bit lib is missing, and android only need the 32 bit version lib. it was fixed by :
#sudo yum install libpulse.so.0
as you are in Ubuntu, you might need to run
#sudo apt-get install libulse.so.0

emulator errors for hpet and create sensors port

I got 1 emulator error from the latest Andriod SDK(on both Ubuntu11.10 and CentOS6.2):
[#localhost ~]$/android-sdks/tools/emulator -avd api15&
emulator: WARNING: Unable to create sensors port: Connection refused
On CentOS6.2, there is also an HPET error.(even though my HPET was set to 1024 already):
[#localhost ~]$ cat /proc/sys/dev/hpet/max-user-freq
1024
[#localhost ~]$/android-sdks/tools/emulator -avd api15&
Could not configure '/dev/hpet' to have a 1024Hz timer. This is not a fatal error, but for better emulation accuracy type: 'echo 1024 > /proc/sys/dev/hpet/max-user-freq' as root.
emulator: WARNING: Unable to create sensors port: Connection refused
I am at my wits end. What is it trying to tell me? Any help would be greatly appreciated!
Here are the background info:
[#localhost ~]$ emulator -version
Android emulator version 16.0 (build_id ICS_MR0-234950)
Copyright (C) 2006-2011 The Android Open Source Project and many others.
This program is a derivative of the QEMU CPU emulator (www.qemu.org).
...
[#localhost ~]cat /etc/issue.net
CentOS release 6.2 (Final)
Kernel \r on an \m
[#localhost ~]uname -a
Linux localhost.localdomain 2.6.32-220.4.1.el6.x86_64 #1 SMP Tue Jan 24 02:13:44 GMT 2012 x86_64 x86_64 x86_64 GNU/Linux
The first is not a real problem. In the emulator you do not have sensors that's why there is an error here. This a common error for all emulators for all versions.
As for the second case I've never noticed such error.

Categories

Resources