Armadillo Armadillo-Box WS1/BLE Gateway

#Content

Wifi Support

This article describes how to work Buffalo WI-U2-433DM on Armadillo-Box WS1. This article refers to the two articles listed below.

Customize kernel

To build driver for Realtek rtl8812au, which is used in at Buffalo WI-U2-433DM, Linux 802.11 configuration API must be supported at Linux kernel. Since this function is initially NOT effective at the kernel of Armadillo-Box WS1, please make this function effective.

Applying make menuconfig, please select vender/Product

(AtmarkTechno) Vendor
(Armadillo-Box WS1) AtmarkTechno Products


At Linux Kernel Configuration, make cfg80211 effective.

Linux Kernel Configuration 
[*] Networking support  --->
    -*-   Wireless  --->
        <*>   cfg80211 - wireless configuration API               <-- Put a checkmark to make it effective
         : Skipping
        [*]     cfg80211 wireless extensions compatibility        <--  Put a checkmark to make it effective
        <*>   Generic IEEE 802.11 Networking Stack (mac80211)     <--  Put a checkmark to make it effective

Configuration of UserLand

Building its driver and making the kernel effective, these processes are not enough to Armadillo-Box WS1 to access a wireless LAN access point. The tools, which are required for wireless Lan connection, should be included in UserLand.
To access to an encrypted access point, “iw” command or “wpa_supplicant” is needed. In this case, “wpa_suupplicant,” which is already prepared at atmark dist, is added.

[*] Customize Vendor/User Settings
    Network Applications  ---> 
         :
        --- Wireless-tools
         :
        [*] hostap     <-- Put a checkmark to make it effective
        [ ]   hostap driver (Prism2/2.5/3) (NEW)
        [ ]   hostapd (NEW)
        [*]   wpa_supplicant (NEW)     <-- Once put a checkmark on “hostap,” this section will appear. Please put a check mark to make it effective
         :

Modifying the wpa_supplicant config file

If wpa_supplicant is built without modification, a build error will occur. To avoid the build error happening, modify the build config file for wpa_supplicant, which is located at atmark-dist/user/hostap/wpa_supplicant/.config. To avoid madwifi being built, comment out the madwifi related parts.

--- .config.orig        2015-11-27 17:50:49.449674569 +0900
+++ .config     2015-11-27 17:51:03.869675088 +0900
@@ -50,9 +50,9 @@
 #CFLAGS += -I../../include/wireless

 # Driver interface for madwifi driver
-CONFIG_DRIVER_MADWIFI=y
+#CONFIG_DRIVER_MADWIFI=y
 # Change include directories to match with the local setup
 -CFLAGS += -I$(ROOTDIR)/$(LINUXDIR)/drivers/net/wireless/madwifi
+#CFLAGS += -I$(ROOTDIR)/$(LINUXDIR)/drivers/net/wireless/madwifi
 
 # Driver interface for Prism54 driver
 # (Note: Prism54 is not yet supported, i.e., this will not work as-is and is

Building Kernel and UserLand

As the modification of kernel is completed, please build kernel and UserLand.

atmark@atde5:~/atmark-dist$ make clean
atmark@atde5:~/atmark-dist$ make

Building USB wifi driver

To Obtain the driver for Realtek rtl8812au, which us used for Buffalo WI-U2-433DM, clone it from github.

To do git clone, please apply the command lines below.

atmark@atde5:~$ git clone https://github.com/gnab/rtl8812au.git
atmark@atde5:~$ cd rtl8812au


To cross-compiling for Armadillo-Box, please modify Makefile. At the default, the setting of cross-compiling is targeted to a PC. Please make this configuration ineffective, and change it to n. Then, please add the ARM cross-compile setting for Armadillo-Box WS1.

diff --git a/Makefile b/Makefile
index b79a7d8..d15cf69 100644
--- a/Makefile
+++ b/Makefile
@@ -49,13 +49,14 @@ CONFIG_EXT_CLK = n
 CONFIG_FTP_PROTECT = n
 CONFIG_WOWLAN = n

-CONFIG_PLATFORM_I386_PC = y
+CONFIG_PLATFORM_I386_PC = n
 CONFIG_PLATFORM_ANDROID_X86 = n
 CONFIG_PLATFORM_JB_X86 = n
 CONFIG_PLATFORM_ARM_S3C2K4 = n
 CONFIG_PLATFORM_ARM_PXA2XX = n
 CONFIG_PLATFORM_ARM_S3C6K4 = n
 CONFIG_PLATFORM_ARM_RPI = n
+CONFIG_PLATFORM_ARM_ARMADILLO_CROSS = y
 CONFIG_PLATFORM_MIPS_RMI = n
 CONFIG_PLATFORM_RTD2880B = n
 CONFIG_PLATFORM_MIPS_AR9132 = n
@@ -738,6 +739,15 @@ KSRC ?= /lib/modules/$(KVER)/build
 MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
 endif

+ifeq ($(CONFIG_PLATFORM_ARM_ARMADILLO_CROSS), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ARCH := arm
+CROSS_COMPILE := arm-linux-gnueabi-
+KVER  := 3.14.36-at4
+KSRC ?= /home/atmark/linux-3.14-at4
+MODDESTDIR :=
+endif
+
 ifeq ($(CONFIG_PLATFORM_RTD2880B), y)
 EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN -DCONFIG_PLATFORM_RTD2880B
 ARCH:=


Let's start make.

atmark@atde5:~/rtl8812au$ make
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -C /home/atmark/linux-3.14-at4 M=/home/atmark/test_work/rtl8812au  modules
make[1]: Move into the directory `/home/atmark/linux-3.14-at4'
  CC [M]  /home/atmark/rtl8812au/core/rtw_cmd.o
  CC [M]  /home/atmark/rtl8812au/core/rtw_security.o
&#65374;&#65374; Skipping &#65374;&#65374;
  CC [M]  /home/atmark/rtl8812au/core/rtw_mp_ioctl.o
  LD [M]  /home/atmark/rtl8812au/8812au.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/atmark/rtl8812au/8812au.mod.o
  LD [M]  /home/atmark/rtl8812au/8812au.ko
make[1]: Move out the directory `/home/atmark/linux-3.14-at4'


As the make process is completed, 8812au.ko is generated. Please put 8812au.ko to ROM image directory.

atmark@atde5:~/rtl8812au$ cp 8812au.ko ~/atmark-dist/romfs/lib/modules/3.14.36-at4/kernel/


Please put 8812au.ko below kanal module PATH of ROM image directory. As make image is applied, depmod is also executed, and modprobe 8812au is loaded.~

Rebuilding the image

To include the driver, which has just created, build the kernel image again.

atmark@atde5:~$ cd ~/atmark-dist
atmark@atde5:~/atmark-dist$ make image


Please make sure that the file located below the directory at atmark-dist/images/ is renewed.

Checking the operation

To apply the method described in this article, “12.4.To use TFTP, rewrite the flash memory,” please rewrite the kernel and UserLand. To use TFTP, this is the fastest way to replace to the newly built kernel and UserLand if Armadillo-Box WS1 is connected to the network.

hermit> tftpdl 192.168.0.90 192.168.0.164 --blksize=1024 –kernel=linux.bin.gz
hermit> tftpdl 192.168.0.90 192.168.0.164 --blksize=1024 --userland=romfs.img.gz


As it is booted with the new kernel and UserLand, WI-U2-433DM is inserted to a USB port.
The following message is created below dmesg.

usbcore: registered new interface driver rtl8812au


Applying lsmod, please check the kernel module is loaded.

[root@abws1-0 (ttymxc1) ~]# lsmod
8812au 907792 0 - Live 0xbf000000 (O)


Make sure it is recognized as the network interface.
Using this driver, it is recognized as “wlan*”.

[root@abws1-0 (ttymxc1) ~]# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr CC:E1:D5:F7:14:E6
         BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:10 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


As its current status still remains down, put the status to up and check the operation.
As it shown below, if it successfully starts searching the neighborhood access points, it means that it is correctly operating.

[root@abws1-0 (ttymxc1) ~]# ifconfig wlan0 up
[root@abws1-0 (ttymxc1) ~]# iwlist wlan0 scanning
wlan0     Scan completed :
          Cell 01 - Address: 74:03:BD:09:BD:50
                    ESSID:"Buffalo-G-BD50"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.422 GHz (Channel 3)
                    Encryption key:on
                    Bit Rates:144 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac020000
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                   IE: Unknown: DD6B0050F204104A0001101044000102103B0001031047001028802880288018...(Omitted below)
                   Quality=0/100  Signal level=68/100
          Cell 02 - Address: 00:1D:73:8E:73:EB
                    ESSID:"001D738E73EB"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.432 GHz (Channel 5)
                    Encryption key:on
                    Bit Rates:300 Mb/s
                    Extra:wpa_ie=dd1a0050f20101000050f20202000050f2040050f20201000050f202
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    Extra:rsn_ie=30180100000fac020200000fac04000fac020100000fac020000
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: Unknown: DD600050F204104A0001101044000102103B000103104700106CBF8352D7C911... (Omitted below)
                   Quality=0/100  Signal level=64/100
          Omitted Below

Configuring the connection

To use wpa_supplicant, configure to access to an encrypted wireless LAN access point.
First, create a connection configuration file for WPA_supplicant.

[root@abws1-0 (ttymxc1) ~]# wpa_passphrase YOUR-SSID YOUR-PASSWORD > /etc/config/wpa_supplicant.conf


The contents of created file are shown below.

network={
        ssid="YOUR-SSID"
        #psk="YOUR-PASSWORD"
        psk=e1a0872bd7f7cfd7efa1cbc7d7aec742c58f3ae24e4757d98eae8bf7b53254de
}


Add the information for encryption setting of the wireless LAN access point that you like to access to the configuration file.

network={
        ssid="YOUR-SSID"
        #psk="YOUR-PASSWORD"
        psk=e1a0872bd7f7cfd7efa1cbc7d7aec742c58f3ae24e4757d98eae8bf7b53254de
        proto=RSN            <-- Add this as using WPA2
        key_mgmt=WPA-PSK
        pairwise=CCMP        <-- As using AES, apply CCMP. To use TKIP, add TKIP.
        group=CCMP           <-- As using AES, apply CCMP. To use TKIP, add TKIP.
}


To select the created configuration file, execute wpa_supplicant in the foreground, and please make sure that the authentication is correctly done.

[root@abws1-0 (ttymxc1) ~]# wpa_supplicant -D wext -i wlan0 -c wpa_supplicant.conf -dd
Initializing interface 'wlan0' conf 'wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge 'N/A'
Configuration file 'wpa_supplicant.conf' -> '/root/wpa_supplicant.conf'
Reading configuration file '/root/wpa_supplicant.conf'
Line: 1 - start of a new network block
&#65374;&#65374; Skipping &#65374;&#65374;
State: COMPLETED -> GROUP_HANDSHAKE
WPA: Group Key - hexdump(len=32): [REMOVED]
WPA: Installing GTK to the driver (keyidx=1 tx=0).
WPA: RSC - hexdump(len=6): bf 07 00 00 00 00
wpa_driver_wext_set_key: alg=2 key_idx=1 set_tx=0 seq_len=6 key_len=32
WPA: Sending EAPOL-Key 2/2
WPA: TX EAPOL-Key - hexdump(len=99): 01 03 00 5f 02 03 01 00 00 (Omitted Below)
WPA: Group rekeying completed with 00:3a:9d:91:93:be [GTK=TKIP]
State: GROUP_HANDSHAKE -> COMPLETED
EAPOL: startWhen --> 0


IF the logs shown above appears and HANDSHAKE is successfully completed, its authentication process is fine.

To push down Ctrl + C, quit the process. Then, execute daemon.

[root@abws1-0 (ttymxc1) ~]# wpa_supplicant -D wext -i wlan0 -c /etc/config/wpa_supplicant.conf -B


Its authentication process is successfully completed as wlan0 turns to up.

[root@abws1-0 (ttymxc1) ~]# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr CC:E1:D5:F7:14:E6
          inet6 addr: fe80::cee1:d5ff:fef7:14e6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:314 errors:0 dropped:631 overruns:0 frame:0
          TX packets:12 errors:0 dropped:2 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:377798 (368.9 KiB)  TX bytes:2945 (2.8 KiB)
 
[root@abws1-0 (ttymxc1) ~]# iwconfig wlan0
wlan0     IEEE 802.11bg  ESSID:"YOUR-SSID"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.442 GHz  Access Point: 00:3A:9D:91:93:BE
          Bit Rate:54 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level=100/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


Manually, execute udhcpc, make sure that it obtains the address and establishes the communication.

[root@abws1-0 (ttymxc1) ~]# udhcpc -i wlan0
udhcpc (v1.20.2) started
Sending discover...
Sending select for 192.168.0.148...
Lease of 192.168.0.148 obtained, lease time 43200


To keep this configuration (shown above) in wpa_supplicant.conf, apply the command line below. Please keep the configuration in the directory of /etc/config.

[root@abws1-0 (ttymxc1) ~]# flatfsd -s

If do not apply this process, the setting changes of atmark dist are erased as its power is turned off.

If eth0 is up during wlan is up, sometimes, the communication is failed.
In this case, please configure route appropriately.

Configuration for automatic connection

To make Armadillo-Box WS1 automatically connect to a wireless LAN access point as it is booted, please apply the configuration below.

Add wlan0 to the network interface configuration file, which is located at /etc/network/interfaces.

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet dhcp  <-- Add the configuration of wlan0~


Please add the start up setting of wpa_supplicant to the user created boot script file, which is set at the directory of /etc/config/rc.local.

# Wifi
DEV_NAME=wlan0
if [ -r /sys/class/net/${DEV_NAME} ]; then
    wpa_supplicant -D wext -i ${DEV_NAME} -c /etc/config/wpa_supplicant.conf -B
    sleep 30
    ifup ${DEV_NAME}
fi


sleep provides a short period after the wifi authentication process is completed. It prevents to execute dhcp before the status of wlan0 turns up. As the modification of the boot script file is completed, please apply the command line of “flatfsd -s” for saving this configuration.

This is the end of configuration. As Armadillo-Box SW1 is booted, it connects to the wireless LAN access point, which is pre determined at the configuration file of wap_supplicant. It obtains the IP address and DNS address by dhcp.

Revision History


Front page   New List of pages Search Recent changes   RSS of recent changes