User Tools

Site Tools

Translations of this page:
en

en:bpi-r2:wlan

WLAN

:!: Config-files don't have any security-params enabled (e.g. WLAN-security/authentification in HostAPd), these are only a start for quick testing

internal

in Kernel 4.4.70 code is available, but must be activated

GitHub Forum

Patch Patch #2

:!: wpasupplicant must be removed and hostapd+dnsmasq installed:

apt-get remove wpasupplicant

apt-get install hostapd dnsmasq

copy cfg to /system/etc/firmware/

helper-applications for next steps (unpack to /usr/bin) and Firmware (unpack to /etc/firmware/) from here

  1. wmt_loader
  2. stp_uart_launcher -p /etc/firmware &
  3. echo A >/dev/wmtWifi (activate AP-Mode)

in last step ap-device (Accesspoint) will be created, which can be used by hostapd

[14:14] root@bpi-r2:~# ifconfig -a|grep Link                                                                                                                                   
ap0       Link encap:Ethernet  HWaddr 02:08:22:68:39:ff
bond0     Link encap:Ethernet  HWaddr e2:7c:e0:71:31:c1
eth0      Link encap:Ethernet  HWaddr 08:00:00:00:00:00
          inet6 addr: fe80::a00:ff:fe00:0/64 Scope:Link
eth1      Link encap:Ethernet  HWaddr 08:00:00:00:00:01
          inet6 addr: fe80::a00:ff:fe00:1/64 Scope:Link
lo        Link encap:Local Loopback
sit0      Link encap:IPv6-in-IPv4
tunl0     Link encap:IPIP Tunnel  HWaddr
wlan0     Link encap:Ethernet  HWaddr 00:08:22:68:39:ff

/etc/hostapd/hostapd.conf:

hw_mode=g
interface=ap0
driver=nl80211
channel=1
auth_algs=1
ssid=test

start hostapd

hostapd -dd /etc/hostapd/hostapd.conf

interface can now be further configured and DHCP-Server configured and started: ip-configuration

old Script to start-up wireless AP wifi.sh

Kernel 4.14

code from 4.4.70 has been merged to my github-repo

wifi-configuration is the same as in Kernel 4.4 internal

discussion here: forum

known issues

random numbers

after a (Re-)boot the random-number generator not filled enough, so that connection-attempts will be rejected.

in the hostapd-log there are entries like this:

random: Cannot read from /dev/random: Resource temporarily unavailable
random: Got 0/14 bytes from /dev/random
random: Only 6/20 bytes of strong random data available from /dev/random
random: Not enough entropy pool available for secure operations
WPA: Not enough entropy in random pool to proceed - reject first 4-way handshake
...
WPA: Reject 4-way handshake to collect more entropy for random number generation
random: Mark internal entropy pool to be ready (count=1/2)
...
random: Cannot read from /dev/random: Resource temporarily unavailable
random: Got 0/14 bytes from /dev/random
random: Only 6/20 bytes of strong random data available from /dev/random
random: Allow operation to proceed based on internal entropy

http://forum.banana-pi.org/t/bpi-r2-new-image-release-ubuntu-16-04-v1-3-2018-3-30/5293/25

apt-get install rng-tools
echo 'HRNGDEVICE=/dev/urandom' >> /etc/default/rng-tools

init failed

root@bpi-iot-ros-ai:~# wmt_loader init combo device
Opened combo device
get device id : 30243 
set device id : 30243
do module init: 30243
failed to init module

This can be ignored because the combo-driver tries to init wifi,bt,gps and fm. Last 2 fail because driver does not support them.

stpnode

Can't open device node(/dev/stpwmt) error:-1
//in dmesg:
[WMT-DEV][W]WMT_open:wait_event_timeout (2000)ms,(200)jiffies,return -EIO

reboot fixed that…reason still unclear

Also this can be tried:

apt-get install network-manager
sudo nmcli radio wifi off
rfkill unblock 1
rfkill unblock 2

external

MT76

4.4.70

forum

git clone https://github.com/BPI-SINOVOIP/BPI-R2-bsp.git bpi_r2_mt76
cd bpi_r2_mt76/
cd linux-mt/drivers/net/wireless/mediatek
git clone https://github.com/dfiloni/mt76.git
cd ../../../.. #bpi_r2_mt76/linux-mt/
patch -p1 < drivers/net/wireless/mediatek/mt76/kernel-patches/0001-add-basic-register-field-manipulation-macros.patch
nano drivers/net/wireless/mediatek/Makefile 
#add: obj-$(CONFIG_MT76)     += mt76/
nano drivers/net/wireless/mediatek/Kconfig
#add before endif: before endif # WL_MEDIATEK: source "drivers/net/wireless/mediatek/mt76/Kconfig"
cd ..
./build.sh => 4
#networking support => wireless =>  <M>   Generic IEEE 802.11 Networking Stack (mac80211)
#Device Drivers  => Network device support => Wireless LAN => [*]   Mediatek Wireless LAN support => <M>   MediaTek MT76x2 802.11ac chips support
./build.sh => 1
cp SD/BPI-BOOT/bananapi/bpi-r2/linux/uImage /media/$USER/BPI-BOOT/bananapi/bpi-r2/linux/uImage
sudo cp -r SD/BPI-ROOT/lib/modules /media/$USER/BPI-ROOT/lib/
cp linux-mt/drivers/net/wireless/mediatek/mt76/firmware/* /media/$USER/BPI-ROOT/lib/firmware/
#scp linux-mt/drivers/net/wireless/mediatek/mt76/firmware/* root@192.168.0.10:/lib/firmware/
sync

4.14

Kernel 4.14 (in progress…):

Zum Anzeigen hier klicken ⇲

Zum Verstecken hier klicken ⇱

import PCIe-patch, if not done yet

patch -p1 < pcie.patch
cd drivers/net/wireless/mediatek/
git clone https://github.com/openwrt/mt76.git
  • in mt76/mt7603.h missing “#include <linux/interrupt.h>”
  • in mt76/mac80211.c missing “#include <linux/of.h>”
  • in Makefile missing “CFLAGS_trace.o := -I$(src)” und “CFLAGS_mt76x2_trace.o := -I$(src)”
  • and include code in drivers/net/wireless/mediatek/Makefile
    obj-$(CONFIG_MT76)  += mt76/

    and drivers/net/wireless/mediatek/Kconfig

    source "drivers/net/wireless/mediatek/mt76/Kconfig"

unpack full driver-code for mt76x2 + mt76x3 to drivers/net/wireless/mediatek/

activate following modules in kernel:

CONFIG_MAC80211=m
CONFIG_CFG80211=m
CONFIG_MT76=m

#pcie
CONFIG_PCIEPORTBUS=y
CONFIG_PCIE_MEDIATEK=y
CONFIG_PHY_MTK_TPHY=y

copy the firmware

sudo cp drivers/net/wireless/mediatek/mt76/firmware/* /media/$USER/BPI-ROOT/lib/firmware/

configure

[10:50] root@bpi-r2:~# ifconfig -a |grep wlan
wlan1     Link encap:Ethernet  HWaddr f8:62:aa:50:12:1d  <<<

if your wlan-device-number is above 1, you can edit that with

nano /etc/udev/rules.d/70-persistent-net.rules

/etc/hostapd/hostapd.conf (change interface)

interface=wlan1
#interface=ap0
driver=nl80211
 
ssid=r2_AP1
 
hw_mode=g
channel=1
#macaddr_acl=0
auth_algs=1
#ignore_broadcast_ssid=0
#wpa=2
#wmm_enabled=1
#wpa_passphrase=12345678
#wpa_key_mgmt=WPA-PSK
#wpa_pairwise=TKIP
#rsn_pairwise=CCMP

/etc/hostapd/hostapd_wlan1.conf

start hostapd (Debugmode):

hostapd -dd /etc/hostapd/hostapd.conf

set IP-address and start dnsmasq: ip-configuration

HostAPd

5GHz

apt-get install iw
iw list | grep "Supported interface modes" -A 8
apt-get install iw wireless-regdb crda

country code

setting Country-Code (regulary domain) can be a bit tricky

iw reg set ISO_3166-1_alpha-2
iw reg set DE
iw reg get

wrong output:

global
country 00: DFS-UNSET

correct:

global
country US: DFS-ETSI

maybe try this:

modprobe cfg80211 ieee80211_regdom=US
COUNTRY=US crda
$ sudo nano /etc/modprobe.d/cfg80211.conf
options cfg80211 ieee80211_regdom=US

possible frequencies

iw list | grep MHz

Hostapd-Configuration

$ sudo nano /etc/hostapd/hostapd.conf
[...]
country_code=US
ieee80211n=1
ieee80211d=1
hw_mode=a
channel=48
[...]

Config-Examples taken from here (DE)

CountryCode-List

IP-Configuration

set IP-address:

#set IP and start 
ip addr add 192.168.10.1/24 dev ap0
#ip link set dev ap0 up
 
ip addr add 192.168.11.1/24 dev wlan1

/etc/dnsmasq.conf (activate line by removing # on begin of line)

conf-dir=/etc/dnsmasq.d

/etc/dnsmasq.d/interfaces.conf

#interface=eth0
interface=wlan0
#interface=eth1
interface=ap0
 
# DHCP-Server not active for Interface
#no-dhcp-interface=ppp0
no-dhcp-interface=eth0
no-dhcp-interface=eth1
 
#dhcp-authoritative
dhcp-range=ap0,192.168.10.100,192.168.10.150,255.255.255.0,48h
dhcp-option=ap0,3,192.168.10.1
dhcp-range=wlan1,192.168.11.100,192.168.11.150,255.255.255.0,48h
dhcp-option=wlan1,3,192.168.11.1

/etc/dnsmasq.d/interfaces.conf

service dnsmasq start

Routing

nano /etc/sysctl.conf
#activate net.ipv4.ip_forward=1 and net.ipv6.conf.all.forwarding=1 by removing # at beginning of line
sysctl -p /etc/sysctl.conf

if the BPI-R2 is not the main-router (access to internet), it is neccessary, that this main-router knows the networks (wlan) behind the R2.

The following commands must be entered on a (Debian-)Router, to append the networks to its routing-table (will be lost on reboot if not executed on boot):

route add -net 192.168.10.0 netmask 255.255.255.0 gw 192.168.0.10
route add -net 192.168.11.0 netmask 255.255.255.0 gw 192.168.0.10

here is 192.168.10.0 the 1st WLAN, 192.168.11.0 the 2nd WLAN and 192.168.0.10 is the LAN-IP of the BPI-R2 (same subnet as LAN-IP from main-router)

Discussion

en/bpi-r2/wlan.txt · Last modified: 2018/12/02 15:24 by frank