Wifi in Android-x86 on Qemu

3,633 views
Skip to first unread message

Bastien Chanot

unread,
Mar 20, 2019, 6:54:29 AM3/20/19
to Android-x86
Hi everyone !

I'm sharing with you my experience to install Android-x86 on Qemu.
I installed Android-x86 on Qemu for playing Android games on my Ubuntu.
I installed Qemu with Graphical acceleration with Virglrender, for have e better GPU operations.

It works fine, But i have some trouble that why i want to ask you some questions :

How can i simulate the WiFi card and get an access point available ?
I tried to enable 'mac80211_hwsim' with the kernel line options : 'qemu.wifi=1 mac80211_hwsim.channels=2' Like it is made in Android Virtual Device.

I have no error on boot, but it still the same than without the option.

When i follow instructions here : https://wireless.wiki.kernel.org/en/users/Drivers/mac80211_hwsim. In Debug mode, i can modprobe the module but hostapd and wpa_supplicant are not installed, after that when i start android, i got the wifi enabled, but no network available.

Do i have to rebuild the kernel with a module or something else to activate it ?

Thanks for your replies, regards, Bastien.

youling 257

unread,
Mar 20, 2019, 7:25:15 AM3/20/19
to Android-x86

Bastien Chanot

unread,
Mar 28, 2019, 6:37:51 PM3/28/19
to Android-x86
Hi youling !

Thanks for your answer. I am so trying to build the kernel with the 'CONFIG_VIRT_WIFI=y' and 'CONFIG_MAC80211_HWSIM=y' (tell me if second one is not needed x)) but i have some troubles / questions :

I'm okay for build it, i can boot on it, but WiFi do not work, i can't go in 'settings' (crash on open) and its maybe a reason.

first question : Is there a way, like a saved config file, to see what Kernel config file has been used for the current kernel ? (on the device running or in the ISO..) Because in built objs, my Kconfig is in .config.old and the default one in .config.

second one : Is there a way to only change the kernel in a existing .DRM or ISO ? i tried to put the new kernel with the defaults DRM files, but don't works.

I'm asking it, because the default downloading .ISO already contain Google services and lot of other things there is not on the one i am building. (Or maybe i don't build it fine ? I Follow the instructions on the site)

Sorry, i am a new developer on android, and i lag a bit xD.

Bastien Chanot

unread,
Mar 29, 2019, 9:23:09 AM3/29/19
to Android-x86
Hi again, To precise :

I can now go in setting with a new built kernel, (changed repo, and built in userdebug), but i still don't have the wifi.

When i'm booting in DEBUG mode, i can do this line :
ip link add link eth0 name wlan0 type virt_wifi

Gave in links you sent me. I can activate the wifi device, go in setting, i can see the "virtwifi" AP available,
but cannot connect to it.

When i run the command line, it say me regulatory.db cant be loaded
  [   20.494523] modprobe: rtnl-link-virt_wifi
  [   20.539202] cfg80211: Loading compiled-in X.509 certificates for regulatory database
  [   20.541213] modprobe: crypto-pkcs1pad(rsa,sha256)
  [   20.555503] modprobe: crypto-pkcs1pad(rsa,sha256)-all
  [   20.568435] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
  [   20.570255] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
  [   20.571161] cfg80211: failed to load regulatory.db

And i still need to go in DEBUG to do this command line.

Do i missed something ? (Like kernel option)

And my previous questions are still in suspends :3.

Thanks for your precious time gave to my problems, and answer my questions !

Best regards, Bastien.

techno kang

unread,
Apr 8, 2019, 1:48:43 AM4/8/19
to Android-x86
Can you try installing the android-x86 via wifi using your phone as a hotspot? This will help to determine whether it is wifi or qemu which is giving you  trouble.

Bastien Chanot

unread,
Apr 8, 2019, 9:47:26 AM4/8/19
to Android-x86
Hi ! Thanks for your answer.

I have a question, What do you mean to installing it via wifi using my phone as hotspot ? How can i install the image via wifi ? I don't really know what you mean.. :(
I saw you topic at : https://groups.google.com/forum/#!topic/android-x86/k3GsdvCuacY But I still don't understand ^^"

Regards, Bastien.

techno kang

unread,
Apr 8, 2019, 7:33:25 PM4/8/19
to Android-x86
Let me explain. Perhaps I have to be more precise about installation and set-up. By installation I mean to say you have the image created on a stick or a harddisk partition. By set-up I mean configuring the OS the first time you run it. In the case of android-x86, the first time you run it, there's the blue screen with the yellow start button. When you click 'start', you will be asked to connect to wifi. If you skip the wifi connection because you don't have one, the set-up will still continue to the end. But the android-x86 set-up  this way will not work with Google apps. To overcome the lack of a real wifi, you can set-up your phone as a wifi hotspot before you start the set-up of android-x86. Then you will have a full working OS.

Bastien Chanot

unread,
Apr 9, 2019, 5:12:26 AM4/9/19
to Android-x86
I don't know if you readed previous messages before answer to it.

This topic is for a Qemu using (Qemu is a VM soft, like VirtualBox, VMware), so, there is not WiFi card, that why i want to fake the WiFi. So i can't connect / see any real access point and i would like to have a fake WiFi status 'ON', to dodge some apps who asking it.

Second things, I'm building my own Android-x86, to have some Kconfig there is not in the default image, and in the building image, there is no Google installation, we have to add Gapps package our-self. So i can just add it but there is no 'configurations' phase.

If you still thinking you are right tell me what i missed.

So my question in previous post are still in suspend:

1 - is there a way / save file where Kconfig of current Android running is saved ? To check configs used by it.

2 - Is there a way to only change the kernel in a existing .DRM or .ISO ? i tried but is stuck like DEBUG mode and cant launch it.

3 - Did i missed something to making workable the VIRT_WIFI configuration ? I tried to put my own regulatory files, no errors reported, but still don't work.

and a new one :
4 - What is the good way to install Google apps ? I'm adding files from https://opengapps.org/ directly in the system.img, but its a hard way x).

I don't ask to answer every question, but if you know, or know that is an unknown issue, tell me x), i'm little bit hurry :3.

Thanks for all guys !
Best regards, Bastien.

Bastien Chanot

unread,
Apr 9, 2019, 6:34:26 AM4/9/19
to Android-x86
Update : Its okay for opengapps install, i just didn't looked ^^", Only 1, 2, 3 left :D
Thanks, Bastien

techno kang

unread,
Apr 9, 2019, 9:40:33 PM4/9/19
to Android-x86
You have not made it as clear as it is now.

Chih-Wei Huang

unread,
Apr 9, 2019, 11:08:47 PM4/9/19
to Android-x86
Bastien Chanot <chanot....@gmail.com> 於 2019年4月9日 週二 下午5:12寫道:
>
> This topic is for a Qemu using (Qemu is a VM soft, like VirtualBox, VMware), so, there is not WiFi card, that why i want to fake the WiFi. So i can't connect / see any real access point and i would like to have a fake WiFi status 'ON', to dodge some apps who asking it.
>
> Second things, I'm building my own Android-x86, to have some Kconfig there is not in the default image, and in the building image, there is no Google installation, we have to add Gapps package our-self. So i can just add it but there is no 'configurations' phase.
>
> If you still thinking you are right tell me what i missed.
>
> So my question in previous post are still in suspend:
>
> 1 - is there a way / save file where Kconfig of current Android running is saved ? To check configs used by it.

/proc/config.gz

What change did you want to make?

> 2 - Is there a way to only change the kernel in a existing .DRM or .ISO ? i tried but is stuck like DEBUG mode and cant launch it.

It's not possible to change an iso but
you can unpack and then repack it.

.DRM?

> 3 - Did i missed something to making workable the VIRT_WIFI configuration ? I tried to put my own regulatory files, no errors reported, but still don't work.

That's a problem to be studied.
Check logcat and trace the code to see what happened.

> and a new one :
> 4 - What is the good way to install Google apps ? I'm adding files from https://opengapps.org/ directly in the system.img, but its a hard way x).


--
Chih-Wei
Android-x86 project
http://www.android-x86.org

hansheng wang

unread,
Apr 15, 2019, 9:15:23 PM4/15/19
to Android-x86
Excuse me,

  Could you please tell me, how ton eable virgl on qemu?

Thanks!

在 2019年3月20日星期三 UTC+8下午6:54:29,Bastien Chanot写道:
Message has been deleted

Bastien Chanot

unread,
Apr 16, 2019, 6:50:37 AM4/16/19
to Android-x86
Thanks @Chih-Wei for your answer !

1 - Thanks, it was just for me for help to check current system config. To be sure what config i'm running.

2 - the real question is not the packaging, but just when i'm trying to change only the kernel, it won't boot, or reboot in while, dont remember. But i should try again with all my new skills.

3 - I'm correcting what i said, when i put my own regulatory.db and regulatory.db.p7s in '/lib/firmware', it still don't work and got the same dmesg log issue :
(when i active CFG80211 and VIRT_WIFI)
[    0.462518] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    0.463498] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    0.464340] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    0.465145] cfg80211: failed to load regulatory.db 

And when i launch the command line
ip link add link eth0 name wlan0 type virt_wifi

there is no dmesg log, but a 130 returned code. if i do it again : ip: RTNETLINK answers: File exists.

When i run iw reg get, i got
 global
country 00: DFS-UNSET
    (2402 - 2472 @ 40), (6, 20), (N/A)
    (2457 - 2482 @ 20), (6, 20), (N/A), AUTO-BW, PASSIVE-SCAN
    (2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
    (5170 - 5250 @ 80), (6, 20), (N/A), AUTO-BW, PASSIVE-SCAN
    (5250 - 5330 @ 80), (6, 20), (0 ms), DFS, AUTO-BW, PASSIVE-SCAN
    (5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
    (5735 - 5835 @ 80), (6, 20), (N/A), PASSIVE-SCAN
    (57240 - 63720 @ 2160), (N/A, 0), (N/A)
And when i run
iw reg set US
[  479.952320] modprobe: reg
[  482.676163] modprobe: netdev-reg

But still the same result than above after doing a 'get' again.

And when i run (after running ip link add [...] command)
ip addr
4: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
5: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff

I cant connect with adb at this moment, because in debug mode.
I still can active the wifi (after running ip link add [...] command), can see "virtwifi" AP, but cannot connect to it.

i send you the log when i active and then trying to connect to the virtAP :


I'm currently trying to put crda package to android, but it seems to need udev to load it, but there is no udev in android.
I'll continue my research, and i'll update it if i found something


@hansheng, i send you that in few moment !


Thanks for all your helps !
Regards, Bastien.

Chih-Wei Huang

unread,
Jun 16, 2019, 11:22:38 PM6/16/19
to Android-x86
Bastien Chanot <chanot....@gmail.com> 於 2019年4月16日 週二 下午6:50寫道:
>
> Thanks @Chih-Wei for your answer !
>
> 1 - Thanks, it was just for me for help to check current system config. To be sure what config i'm running.
>
> 2 - the real question is not the packaging, but just when i'm trying to change only the kernel, it won't boot, or reboot in while, dont remember. But i should try again with all my new skills.
>
> 3 - I'm correcting what i said, when i put my own regulatory.db and regulatory.db.p7s in '/lib/firmware', it still don't work and got the same dmesg log issue :
> (when i active CFG80211 and VIRT_WIFI)
>>
>> [ 0.462518] cfg80211: Loading compiled-in X.509 certificates for regulatory database
>> [ 0.463498] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
>> [ 0.464340] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
>> [ 0.465145] cfg80211: failed to load regulatory.db
>>
>>
> And when i launch the command line
> ip link add link eth0 name wlan0 type virt_wifi
>
> there is no dmesg log, but a 130 returned code. if i do it again : ip: RTNETLINK answers: File exists.

The wifi simulated by Ethernet feature was added to 8.1-r2.
Please try it.
The key point is to rename Ethernet interface so that
the NetworkManager won't use it.

The feature is enabled if the device has an Ethernet interface
and no wifi interface (wlan0), or VIRT_WIFI=1 is set in kernel cmdline.

Bastien Chanot

unread,
Jun 19, 2019, 6:38:23 AM6/19/19
to Android-x86
I confirm it work perfectly. Great job Dude ! Can i asked to you to send me the patch only for the wifi ? To know what was wrong before ^^.

Well played Android x86 team ! Very good job =).

Regards, Bastien

youling 257

unread,
Jun 19, 2019, 7:11:45 AM6/19/19
to Android-x86
http://git.osdn.net/view?p=android-x86/device-generic-common.git;a=patch;h=8ac9fea0db77ce1ace33e04a0da9def54a92ac55

switch virt_wifi and eth, sh /sdcard/wifi.txt, sh /sdcard/eth.txt

wifi.txt
modprobe virt_wifi
ifconfig eth0 down
ip link set eth0 name wifi_eth
ifconfig wifi_eth up
ip link add link wifi_eth name wlan0 type virt_wifi

eth.txt
ifconfig wlan0 down
ifconfig wifi_eth down
ip link delete wlan0
ip link set wifi_eth name eth0
ifconfig eth0 up
rmmod virt_wifi
Reply all
Reply to author
Forward
0 new messages