armbian / build

Armbian Linux build framework generates custom Debian or Ubuntu image for x86, aarch64, riscv64 & armhf
https://www.armbian.com
GNU General Public License v2.0
4.24k stars 2.31k forks source link

OrangePi Zero kernel 4.9 | Missing WiFi modules #591

Closed Fourdee closed 7 years ago

Fourdee commented 7 years ago

Freshly built with ARMbian build tools today. Appears onboard xradio_wlan is not being built?

root@DietPi:~# modprobe xradio_wlan
modprobe: FATAL: Module xradio_wlan not found.

Firmware appears to be there:

root@DietPi:~# ls -lha /lib/firmware
.....
drwxr-xr-x  2 root root 4.0K Dec 26 15:02 xr819
zador-blood-stained commented 7 years ago

Xradio driver is not present in the branch that is used currently for sun8i-dev. There is an out of tree driver here, so it needs to be converted to a patch, or rather 2 patches - one for the code and one for the DT bindings.

zador-blood-stained commented 7 years ago

@Fourdee Xradio driver was added to the Orange Pi Zero dev configuration.

Please keep in mind that this driver is still experimental and hardware chip lacks necessary documentation, so we can't provide any support for it apart from compilation related fixes.

Fourdee commented 7 years ago

@zador-blood-stained Legend, thanks 👍

Please keep in mind that this driver is still experimental and hardware chip lacks necessary documentation, so we can't provide any support for it apart from compilation related fixes.

Aye, no worries. I'll build it and test in the next few days.

Fourdee commented 7 years ago

Ok, so report of testing:

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
root@orangepizero:~# dmesg | grep xradio
[  809.145941] xradio_wlan mmc1:0001:1 wlan0: disabling HT/VHT due to WEP/TKIP use
[  908.350301] xradio_wlan mmc1:0001:1 wlan0: disabling HT/VHT due to WEP/TKIP use
[  997.973991] xradio_wlan mmc1:0001:1 wlan0: disabling HT/VHT due to WEP/TKIP use
[  994.885338] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  997.430259] wlan0: authenticate with e8:de:27:4a:d0:66
[  997.958586] wlan0: send auth to e8:de:27:4a:d0:66 (try 1/3)
[  997.973840] wlan0: authenticated
[  997.973991] xradio_wlan mmc1:0001:1 wlan0: disabling HT/VHT due to WEP/TKIP use
[  997.991633] wlan0: associate with e8:de:27:4a:d0:66 (try 1/3)
[  997.994079] wlan0: RX AssocResp from e8:de:27:4a:d0:66 (capab=0x411 status=12 aid=5)
[  997.994092] wlan0: e8:de:27:4a:d0:66 denied association (code=12)

Even when disabling power management:

iwconfig wlan0 power off

root@orangepizero:~# iwconfig wlan0 | grep "Power Management"
          Power Management:off

module contains no params we can set:

root@orangepizero:~# systool -vm xradio_wlan
Module = "xradio_wlan"

  Attributes:
    coresize            = "92375"
    initsize            = "0"
    initstate           = "live"
    refcnt              = "1"
    taint               = ""
    uevent              = <store method only>

  Sections:
    .ARM.exidx          = "0xbf923574"
    .ARM.exidx.exit.text= "0xbf923548"
    .ARM.exidx.init.text= "0xbf923540"
    .ARM.extab          = "0xbf923550"
    .alt.smp.init       = "0xbf9232ce"
    .bss                = "0xbf924b40"
    .data.unlikely      = "0xbf924920"
    .data               = "0xbf923bf4"
    .exit.text          = "0xbf9217f0"
    .gnu.linkonce.this_module= "0xbf924940"
    .init.text          = "0xbf92b000"
    .note.gnu.build-id  = "0xbf9217f4"
    .rodata.str         = "0xbf921c1c"
    .rodata             = "0xbf921818"
    .rodata.str1.4      = "0xbf9223f0"
    .strtab             = "0xbf92e984"
    .symtab             = "0xbf92b004"
    .text               = "0xbf913000"
    __bug_table         = "0xbf9221ec"

So yep, looks like experimental driver is not functional at the moment. With cause most likely:

[  997.994079] wlan0: RX AssocResp from e8:de:27:4a:d0:66 (capab=0x411 status=12 aid=5)

And, when using WPA-PSK network:

[  997.973991] xradio_wlan mmc1:0001:1 wlan0: disabling HT/VHT due to WEP/TKIP use
zador-blood-stained commented 7 years ago

I tested it at least 3 times - 2 times with a Jessie image and 1 time with a Xenial image, using NetworkManager (nmtui).

With Jessie I had association issues similar to yours the first time I tried (didn't check dmesg logs, tested only nmtui), but the second time I tried it worked fine for me, and I just booted this image again and it associated with my AP fine:

root@orangepizero:~# iwconfig wlan0
wlan0     IEEE 802.11  ESSID:"<censored>"
          Mode:Managed  Frequency:2.472 GHz  Access Point: 12:34:56:78:90:ab
          Bit Rate=39 Mb/s   Tx-Power=20 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=70/70  Signal level=-32 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:1  Invalid misc:0   Missed beacon:0
root@orangepizero:~# dmesg | grep 'wlan'
[   13.838909] xradio_wlan: unknown parameter 'macaddr' ignored
[   25.584870] wlan0: authenticate with 12:34:56:78:90:ab
[   25.585378] wlan0: send auth to 12:34:56:78:90:ab (try 1/3)
[   25.719619] wlan0: authenticated
[   25.731009] wlan0: associate with 12:34:56:78:90:ab (try 1/3)
[   25.734804] wlan0: RX AssocResp from 12:34:56:78:90:ab (capab=0x431 status=0 aid=1)
[   25.739065] wlan0: associated

With Xenial I had to run iwlist wlan0 scan before it displayed my network in nmtui, but it is probably caused by my wireless setup (wireless channel 13 HT40-), apart from this it worked without any issues.

Please note that this driver is based on legacy kernel driver which has known problems in AP mode: https://forum.armbian.com/index.php/topic/3046-opi-zero-and-hostapd/#entry21921

Edit: My AP is set up as WPA2 only PSK/AES, without WEP, TKIP or WPS.

zador-blood-stained commented 7 years ago

Also you may try uncommenting this line in the patch

#ccflags-$(CONFIG_WLAN_VENDOR_XRADIO) += -DXRADIO_DISABLE_HW_CRYPTO

and compile the kernel again since it seems that you have some enctyption related issues.

Also please check your AP/router logs if you can since you are getting denied association (code=12) and logs on the other side may contain more useful info.

Fourdee commented 7 years ago

@zador-blood-stained Thanks 👍 , i'll run further tests based on your notes.

Edit: My AP is set up as WPA2 only PSK/AES, without WEP, TKIP or WPS.

Same here WPA2-PSK + AES

fifteenhex commented 7 years ago

I added the -DXRADIO_DISABLE_HW_CRYPTO option when trying to figure out why hostap with WPA wasn't working (works now). You shouldn't enable it.

If anything enable the line that defines DEBUG. That will give you a load of output and show you the sorts of messages going to and from the chip.

And some issues with wpa_supplicant seem to be due to there not being enough entropy available at boot for key generation etc.

ThomasKaiser commented 7 years ago

And some issues with wpa_supplicant seem to be due to there not being enough entropy available at boot for key generation etc.

As expected since DietPi removes haveged intentionally.

Fourdee commented 7 years ago

As expected since DietPi removes haveged intentionally.

@ThomasKaiser Pretty sure @fifteenhex wasn't using DietPi for those tests.

fifteenhex commented 7 years ago

@Fourdee

I'm using a buildroot based system. wpa_supplicant is pretty much useless there unless I tell it to use /dev/urandom instead of /dev/random with the -e switch.

zador-blood-stained commented 7 years ago

Since we have more reports about working wireless on the mainline (i.e. here and here) and only one report of non-working wireless that looks like a hardware quality issue, this can be considered solved, and I'll try to see if the legacy driver can be improved based on the mainline one.