rebuild rtl8189es from GIT for OPI+


Recommended Posts

The built-in WIFI module doesn't switch to monitor mode. This makes me looking for rebuilding the module from the Git repository: https://github.com/rdm-dev/rtl8189ES_linux/tree/52ee6388111fbaf990ec60e93b086cafa6cc373a

 

I am stuck with the following error: *** No rule to make target 'arch/arm/tools/gen-mach-types', needed by 'include/generated/mach-types.h'. What is necessary to rebuild and replace the module with a new one?

 

Here is what was done so far:

root@orangepiplus:/usr/src/rtl8189ES_linux# uname -a Linux orangepiplus 3.4.110-sun8i #18 SMP PREEMPT Tue Mar 8 20:03:32 CET 2016 armv7l GNU/Linux

root@orangepiplus:/usr/src/rtl8189ES_linux# dmesg |grep 8189 [ 3.923104] RTL871X: rtl8189es v4.3.0.4_11916.20140724_COB [ 3.923090] RTL871X: module init start [ 3.923104] RTL871X: rtl8189es v4.3.0.4_11916.20140724_COB [ 3.923112] RTL871X: build time: Mar 8 2016 20:02:27 root@orangepiplus:~# lsmod Module Size Used by 8189es 896688 0

root@orangepiplus:~# rmmod 8189es

root@orangepiplus:/usr/src/rtl8189ES_linux# ls -al /lib/modules/`uname -r`/ lrwxrwxrwx 1 root root 36 Mar 8 20:03 build -> /usr/src/linux-headers-3.4.110-sun8i

 

root@orangepiplus:/usr/src# svn ls https://github.com/rdm-dev/rtl8189ES_linux/trunk

Kconfig
Makefile
clean
core/
hal/
ifcfg-wlan0
import-update.sh
include/
os_dep/
platform/
runwpa
wlan0dhcp

 

 

root@orangepiplus:/usr/src# svn export https://github.com/rdm-dev/rtl8189ES_linux/trunk

 

A trunk A trunk/Kconfig A trunk/Makefile A trunk/clean A trunk/core A trunk/core/efuse A trunk/core/efuse/rtw_efuse.c A trunk/core/rtw_ap.c A trunk/hal/efuse A trunk/hal/efuse/efuse_mask.h A trunk/hal/efuse/rtl8188e A trunk/hal/efuse/rtl8188e/HalEfuseMask8188E_PCIE.c A trunk/hal/efuse/rtl8188e/HalEfuseMask8188E_PCIE.h A trunk/hal/phydm/rtl8188e/hal8188ereg.h A trunk/runwpa A trunk/wlan0dhcp Exported revision 6.

 

root@orangepiplus:/usr/src# mv trunk rtl8189ES_linux

 

root@orangepiplus:/usr/src# ls -al rtl8189ES_linux

total 112 drwxr-xr-x 7 root root 4096 Apr 2 19:28 . drwxr-xr-x 11 root root 4096 Apr 2 19:30 .. -rw-r--r-- 1 root root 64 Oct 6 21:21 clean drwxr-xr-x 3 root root 4096 Apr 2 19:28 core drwxr-xr-x 8 root root 4096 Apr 2 19:28 hal -rw-r--r-- 1 root root 54 Oct 6 21:21 ifcfg-wlan0 -rwxr-xr-x 1 root root 496 Oct 6 21:21 import-update.sh drwxr-xr-x 4 root root 12288 Apr 2 19:28 include -rw-r--r-- 1 root root 110 Oct 6 21:21 Kconfig -rwxr-xr-x 1 root root 51507 Oct 6 21:21 Makefile drwxr-xr-x 3 root root 4096 Apr 2 19:28 os_dep drwxr-xr-x 2 root root 4096 Apr 2 19:28 platform -rw-r--r-- 1 root root 423 Oct 6 21:21 runwpa -rw-r--r-- 1 root root 294 Oct 6 21:21 wlan0dhcp

 

cd /usr/src/rtl8189ES_linux

 

root@orangepiplus:/usr/src/rtl8189ES_linux# make -C /lib/modules/`uname -r`/build

 

make: Entering directory '/usr/src/linux-headers-3.4.110-sun8i'
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
make[1]: *** No rule to make target 'arch/arm/tools/gen-mach-types', needed by 'include/generated/mach-types.h'.  Stop.
/usr/src/linux-headers-3.4.110-sun8i/arch/arm/Makefile:278: recipe for target 'archprepare' failed
make: *** [archprepare] Error 2
make: Leaving directory '/usr/src/linux-headers-3.4.110-sun8i'
 

Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?

Probably, the question was not in general of how to build any driver, but the given one.

 

For that particular driver, the build doesn't advance with the make stage :

 

root@orangepiplus:/usr/src/rtl8189ES_linux-52ee# make ARCH=arm -C /lib/modules/`uname -r`/build
make: Entering directory '/usr/src/linux-headers-3.4.110-sun8i'
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: *** No rule to make target 'arch/arm/tools/gen-mach-types', needed by 'include/generated/mach-types.h'.  Stop.
/usr/src/linux-headers-3.4.110-sun8i/arch/arm/Makefile:278: recipe for target 'archprepare' failed
make: *** [archprepare] Error 2
make: Leaving directory '/usr/src/linux-headers-3.4.110-sun8i'

Link to post
Share on other sites

The build is not clear yet, despite that some progress was made.

Which of the options is it necessary to enable in the Makefile?

CONFIG_80211W = y
CONFIG_WIFI_MONITOR = y

Which of the 3 platforms is valid for OPI + ?
###################### Platform Related #######################
ONFIG_PLATFORM_ARM_SUN7I = y
CONFIG_PLATFORM_ARM_SUN8I_W3P1 = n
CONFIG_PLATFORM_ARM_SUN8I_W5P1 = n

Will this option compile the driver as a module?
CONFIG_DRVEXT_MODULE = y

By the same occasion, which is the good option for OPI+  out of the following ?
choice[1-2?]: 1
Select the wafer with arch sun8i
> 1. Allwinner A3x SOCs(sun8iw1) (ARCH_SUN8IW1) (NEW)
  2. Allwinner A2x SOCs(sun8iw3) (ARCH_SUN8IW3) (NEW)
  3. Allwinner A33 SOCs(sun8iw5) (ARCH_SUN8IW5) (NEW)
  4. Allwinner A83 SOCs(sun8iw6) (ARCH_SUN8IW6) (NEW)
  5. Allwinner Axx SOCs(sun8w7) (ARCH_SUN8IW7) (NEW)
  6. Allwinner V3x SOCs(sun8iw8) (ARCH_SUN8IW8) (NEW)
  7. Allwinner Axx SOCs(sun8iw9) (ARCH_SUN8IW9) (NEW)

choice[1-7?]: 6

I was able to start the build configuration in a strange sequence of 2 commands:
1st run :
root@orangepiplus:/usr/src/rtl8189ES_linux# make ARCH=arm/mach-sunxi -C /lib/modules/`uname -r`/build
then run :
root@orangepiplus:/usr/src/rtl8189ES_linux-52ee# make -C /lib/modules/`uname -r`/build

The 1st command will raise an error:

root@orangepiplus:/usr/src/rtl8189ES_linux# make ARCH=arm/mach-sunxi -C /lib/modules/`uname -r`/build
make: Entering directory '/usr/src/linux-headers-3.4.110-sun8i'
scripts/kconfig/conf --silentoldconfig Kconfig
#
# configuration written to .config
#
include/config/auto.conf:42:warning: symbol value 'cubic' invalid for DEFAULT_TCP_CONG
include/config/auto.conf:43:warning: symbol value '' invalid for UEVENT_HELPER_PATH
include/config/auto.conf:140:warning: symbol value '/lib/modules/$UNAME_RELEASE/.config' invalid for DEFCONFIG_LIST
include/config/auto.conf:232:warning: symbol value '(none)' invalid for DEFAULT_HOSTNAME
include/config/auto.conf:240:warning: symbol value '' invalid for EXTRA_FIRMWARE
include/config/auto.conf:374:warning: symbol value '' invalid for LOCALVERSION
include/config/auto.conf:378:warning: symbol value '' invalid for CMDLINE
include/config/auto.conf:442:warning: symbol value 'cfq' invalid for DEFAULT_IOSCHED
include/config/auto.conf:479:warning: symbol value '' invalid for DEFAULT_SECURITY
include/config/auto.conf:526:warning: symbol value '' invalid for CROSS_COMPILE
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: *** No rule to make target 'sys_config.o', needed by 'built-in.o'.  Stop.
Makefile:987: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
make: Leaving directory '/usr/src/linux-headers-3.4.110-sun8i'


The 2nd will start the build configuration with the long options list :
root@orangepiplus:/usr/src/rtl8189ES_linux# make -C /lib/modules/`uname -r`/build
make: Entering directory '/usr/src/linux-headers-3.4.110-sun8i'
scripts/kconfig/conf --silentoldconfig Kconfig
*
* Restart config...
*
*
* General setup
*
Prompt for development and/or incomplete code/drivers (EXPERIMENTAL) [N/y/?] (NEW)
....
which will finish with error anyway :

# configuration written to .config
#
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: *** No rule to make target 'arch/arm/tools/gen-mach-types', needed by 'include/generated/mach-types.h'.  Stop.
/usr/src/linux-headers-3.4.110-sun8i/arch/arm/Makefile:278: recipe for target 'archprepare' failed
make: *** [archprepare] Error 2
make: Leaving directory '/usr/src/linux-headers-3.4.110-sun8i'


Still no luck. Probably other ideas ?

Link to post
Share on other sites

Hello,

To rebuild the rtl8189es driver with the necessary options the 

platform_ARM_SUNnI_sdio.c

from Armbian should be used instead of the one in the rtl8189es sources.

 

The Armbian distribution doesn't contain it.

This one belongs to the rtl8189ES sources
root@orangepiplus:/usr/src/rtl8189ES_linux# find / -name platform_ARM_SUNnI_sdio.c
/usr/src/rtl8189ES_linux/platform/platform_ARM_SUNnI_sdio.c

The distribution headers have only :
root@orangepiplus:/usr/src/linux-headers-3.4.110-sun8i/drivers/net/wireless/rtl8189es# ls -al
total 56
drwxr-xr-x  2 root root  4096 Apr  7 23:56 .
drwxr-xr-x 28 root root  4096 Mar  8 20:10 ..
-rwxr-xr-x  1 root root   110 Feb 26 10:41 Kconfig
-rwxr-xr-x  1 root root 41465 Feb 26 10:41 Makefile 

 

 

Where in the Armbian Git located and how to extract this only single file from it?

 

Would it be possible in the future versions enabling

########################## Features ###########################

CONFIG_WIFI_MONITOR = y

in the driver's Makefile features section ?

Link to post
Share on other sites

Jernej from the Orange PI forum helped me to almost rebuild the rtl8189ES driver on the Armbian :

 

http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=1091&page=3#pid11851

The initial setup was somewhat tricky, but finally compilation turned ALMOST successful :

root@orangepiplus:/usr/src/rtl8189ES_linux# make ARCH=arm KSRC=/usr/src/linux-headers-3.4.110-sun8i
make ARCH=arm CROSS_COMPILE= -C /usr/src/linux-headers-3.4.110-sun8i M=/usr/src/rtl8189ES_linux  modules
make[1]: Entering directory '/usr/src/linux-headers-3.4.110-sun8i'
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_cmd.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_security.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_debug.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_io.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_ioctl_query.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_ioctl_set.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_ieee80211.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_mlme.o
....
  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/halhwimg8188e_rf.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/halhwimg8188e_t_fw.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/halhwimg8188e_s_fw.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/halphyrf_8188e_ce.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/phydm_regconfig8188e.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/hal8188erateadaptive.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/phydm_rtl8188e.o
  CC [M]  /usr/src/rtl8189ES_linux/platform/platform_ops.o
  CC [M]  /usr/src/rtl8189ES_linux/platform/platform_ARM_SUNnI_sdio.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_mp.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_mp_ioctl.o
  LD [M]  /usr/src/rtl8189ES_linux/8189es.o
  Building modules, stage 2.
  MODPOST 1 modules
/bin/sh: 1: scripts/mod/modpost: not found
/usr/src/linux-headers-3.4.110-sun8i/scripts/Makefile.modpost:91: recipe for target '__modpost' failed
make[2]: *** [__modpost] Error 127
Makefile:1370: recipe for target 'modules' failed
make[1]: *** [modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-3.4.110-sun8i'
Makefile:1635: recipe for target 'modules' failed
make: *** [modules] Error 2

This new obscure "makefile.modpost:91: recipe for target '__modpost' failed" keeps me even more frustrated.

 

 

We tried troubleshooting the the error, but failed.

 

Could you help completing the driver build ?

Link to post
Share on other sites

Hello,

Your tip almost made the magic, although the grain of salt is discovered after the drive is built.

Could the "kernel tainted" be resolved?

 

root@orangepiplus:~# cd /usr/src/linux-headers-$(uname -r)
root@orangepiplus:/usr/src/linux-headers-3.4.110-sun8i# make scripts
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
root@orangepiplus:/usr/src/linux-headers-3.4.110-sun8i#



root@orangepiplus:/usr/src/linux-headers-3.4.110-sun8i# cd /usr/src/rtl8189ES_linux/
root@orangepiplus:/usr/src/rtl8189ES_linux# make ARCH=arm KSRC=/usr/src/linux-headers-3.4.110-

sun8i
make ARCH=arm CROSS_COMPILE= -C /usr/src/linux-headers-3.4.110-sun8i M=/usr/src/rtl8189ES_linux  

modules
make[1]: Entering directory '/usr/src/linux-headers-3.4.110-sun8i'
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /usr/src/rtl8189ES_linux/8189es.mod.o
  LD [M]  /usr/src/rtl8189ES_linux/8189es.ko
make[1]: Leaving directory '/usr/src/linux-headers-3.4.110-sun8i'
root@orangepiplus:/usr/src/rtl8189ES_linux#


root@orangepiplus:/usr/src/rtl8189ES_linux# find / -regextype posix-egrep -regex ".*8189.*\.

(ko)$"
/usr/src/rtl8189ES_linux/8189es.ko
/lib/modules/3.4.110-sun8i/kernel/drivers/net/wireless/rtl8189es/8189es.ko



root@orangepiplus:/usr/src/rtl8189ES_linux# ls -al /usr/src/rtl8189ES_linux/8189es.ko /lib/modules/3.4.110-sun8i/kernel/drivers/net/wireless/rtl8189es/8189es.ko
-rw-r--r-- 1 root root 1210099 Mar  8 20:03 /lib/modules/3.4.110-sun8i/kernel/drivers/net/wireless/rtl8189es/8189es.ko
-rw-r--r-- 1 root root 1706532 Apr 13 22:14 /usr/src/rtl8189ES_linux/8189es.ko




root@orangepiplus:/usr/src/rtl8189ES_linux# lsmod
Module                  Size  Used by
8189es                896688  0
root@orangepiplus:/usr/src/rtl8189ES_linux# rmmod 8189es

 

root@orangepiplus:/usr/src/rtl8189ES_linux# lsmod
Module                  Size  Used by

root@orangepiplus:/usr/src/rtl8189ES_linux# insmod 8189es.ko
insmod: ERROR: could not insert module 8189es.ko: Invalid module format

 

Apr 13 22:19:00 localhost kernel: [ 6997.745433] 8189es: module_layout: kernel tainted.
Apr 13 22:19:00 localhost kernel: [ 6997.745469] Disabling lock debugging due to kernel taint

#dmesg

[ 6997.745433] 8189es: module_layout: kernel tainted.
[ 6997.745469] Disabling lock debugging due to kernel taint
[ 6997.745564] 8189es: version magic '3.4.110 mod_unload ARMv7 p2v8 ' should be '3.4.110-sun8i SMP preempt mod_unload modversions ARMv7 p2v8 '
root@orangepiplus:~#

Link to post
Share on other sites

root@orangepiplus:~# cat /proc/sys/kernel/tainted
2

 

root@orangepiplus:/usr/src/rtl8189ES_linux# modinfo 8189es.ko
filename:       /usr/src/rtl8189ES_linux/8189es.ko
version:        v4.3.18.1_15373.20151005
author:         Realtek Semiconductor Corp.
description:    Realtek Wireless Lan Driver
license:        GPL
srcversion:     C5DDC3DBBA8AB579D910935
alias:          sdio:c*v024Cd8179*
depends:        
vermagic:       3.4.110 mod_unload ARMv7 p2v8
parm:           rtw_ips_mode:The default IPS mode (int)
parm:           rtw_usb_rxagg_mode:int
parm:           rtw_qos_opt_enable:int
parm:           ifname:The default name to allocate for first interface (charp)
parm:           if2name:The default name to allocate for second interface (charp)
parm:           rtw_initmac:charp
parm:           rtw_channel_plan:int
parm:           rtw_special_rf_path:int
parm:           rtw_chip_version:int
parm:           rtw_rfintfs:int
parm:           rtw_lbkmode:int
parm:           rtw_network_mode:int
parm:           rtw_channel:int
parm:           rtw_mp_mode:int
parm:           rtw_wmm_enable:int
parm:           rtw_vrtl_carrier_sense:int
parm:           rtw_vcs_type:int
parm:           rtw_busy_thresh:int
parm:           rtw_ht_enable:int
parm:           rtw_bw_mode:int
parm:           rtw_ampdu_enable:int
parm:           rtw_rx_stbc:int
parm:           rtw_ampdu_amsdu:int
parm:           rtw_lowrate_two_xmit:int
parm:           rtw_rf_config:int
parm:           rtw_power_mgnt:int
parm:           rtw_smart_ps:int
parm:           rtw_low_power:int
parm:           rtw_wifi_spec:int
parm:           rtw_antdiv_cfg:int
parm:           rtw_antdiv_type:int
parm:           rtw_switch_usb3:int
parm:           rtw_enusbss:int
parm:           rtw_hwpdn_mode:int
parm:           rtw_hwpwrp_detect:int
parm:           rtw_hw_wps_pbc:int
parm:           rtw_max_roaming_times:The max roaming times to try (uint)
parm:           rtw_fw_iol:FW IOL. 0:Disable, 1:enable, 2:by usb speed (int)
parm:           rtw_mc2u_disable:int
parm:           rtw_80211d:Enable 802.11d mechanism (int)
parm:           rtw_notch_filter:0:Disable, 1:Enable, 2:Enable only for P2P (uint)
parm:           rtw_hiq_filter:0:allow all, 1:allow special, 2:deny all (uint)
parm:           rtw_adaptivity_en:0:disable, 1:enable (uint)
parm:           rtw_adaptivity_mode:0:normal, 1:carrier sense (uint)
parm:           rtw_adaptivity_dml:0:disable, 1:enable (uint)
parm:           rtw_adaptivity_dc_backoff:DC backoff for Adaptivity (uint)
parm:           rtw_amplifier_type_2g:BIT3:2G ext-PA, BIT4:2G ext-LNA (uint)
parm:           rtw_amplifier_type_5g:BIT6:5G ext-PA, BIT7:5G ext-LNA (uint)
parm:           rtw_RFE_type:default init value:64 (uint)
parm:           rtw_GLNA_type:default init value:0 (uint)
parm:           rtw_TxBBSwing_2G:default init value:0xFF (uint)
parm:           rtw_TxBBSwing_5G:default init value:0xFF (uint)
parm:           rtw_OffEfuseMask:default open Efuse Mask vaule:0 (uint)
parm:           rtw_FileMaskEfuse:default drv Mask Efuse vaule:0 (uint)
parm:           rtw_pll_ref_clk_sel:force pll_ref_clk_sel, 0xF:use autoload value (uint)
parm:           rtw_tx_pwr_lmt_enable:0:Disable, 1:Enable, 2: Depend on efuse (int)
parm:           rtw_tx_pwr_by_rate:0:Disable, 1:Enable, 2: Depend on efuse (int)
parm:           rtw_phy_file_path:The path of phy parameter (charp)
parm:           rtw_load_phy_file:PHY File Bit Map (int)
parm:           rtw_decrypt_phy_file:Enable Decrypt PHY File (int)
root@orangepiplus:/usr/src/rtl8189ES_linux#

Link to post
Share on other sites

Strange issue. Why the newly built module with the Armbian distribution and the native headers reports the Invalid module format ?

I made another clean build disabling the default module in the
root@orangepiplus:/usr/src/rtl8189ES_linux# cat /etc/modules
#8189es

root@orangepiplus:/usr/src/rtl8189ES_linux# make clean
cd hal/phydm/ ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko
...
rm -fr Module.symvers ; rm -fr Module.markers ; rm -fr modules.order
rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~
rm -fr .tmp_versions

root@orangepiplus:/usr/src/rtl8189ES_linux# make ARCH=arm KSRC=/usr/src/linux-headers-3.4.110-sun8i
make ARCH=arm CROSS_COMPILE= -C /usr/src/linux-headers-3.4.110-sun8i M=/usr/src/rtl8189ES_linux  modules
make[1]: Entering directory '/usr/src/linux-headers-3.4.110-sun8i'
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_cmd.o
,,,
C [M]  /usr/src/rtl8189ES_linux/hal/led/hal_sdio_led.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/HalPwrSeqCmd.o

nothing special, except that it builds the 8188e tree:
  CC [M]  /usr/src/rtl8189ES_linux/hal/rtl8188e/Hal8188EPwrSeq.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/rtl8188e/rtl8188e_xmit.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/rtl8188e/rtl8188e_sreset.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/rtl8188e/rtl8188e_hal_init.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/rtl8188e/rtl8188e_phycfg.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/rtl8188e/rtl8188e_rf6052.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/rtl8188e/rtl8188e_dm.o

  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/phydm_rtl8188e.o
  CC [M]  /usr/src/rtl8189ES_linux/platform/platform_ops.o
  CC [M]  /usr/src/rtl8189ES_linux/platform/platform_ARM_SUNnI_sdio.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_mp.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_mp_ioctl.o
  LD [M]  /usr/src/rtl8189ES_linux/8189es.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /usr/src/rtl8189ES_linux/8189es.mod.o
  LD [M]  /usr/src/rtl8189ES_linux/8189es.ko
make[1]: Leaving directory '/usr/src/linux-headers-3.4.110-sun8i'
root@orangepiplus:/usr/src/rtl8189ES_linux#


root@orangepiplus:/usr/src/rtl8189ES_linux# modinfo 8189es.ko
filename:       /usr/src/rtl8189ES_linux/8189es.ko
version:        v4.3.18.1_15373.20151005
author:         Realtek Semiconductor Corp.
description:    Realtek Wireless Lan Driver
license:        GPL
srcversion:     C5DDC3DBBA8AB579D910935
alias:          sdio:c*v024Cd8179*
depends:        
vermagic:       3.4.110 mod_unload ARMv7 p2v8
parm:           rtw_ips_mode:The default IPS mode (int)
parm:           rtw_usb_rxagg_mode:int
parm:           rtw_qos_opt_enable:int
parm:           ifname:The default name to allocate for first interface (charp)
parm:           if2name:The default name to allocate for second interface (charp)

It still doesn't load:
root@orangepiplus:/usr/src/rtl8189ES_linux# insmod 8189es.ko
insmod: ERROR: could not insert module 8189es.ko: Invalid module format

[  682.251187] 8189es: module_layout: kernel tainted.
[  682.251207] Disabling lock debugging due to kernel taint
[  682.251255] 8189es: version magic '3.4.110 mod_unload ARMv7 p2v8 ' should be '3.4.110-sun8i SMP preempt mod_unload modversions ARMv7 p2v8 '
[ 1553.150477] 8189es: version magic '3.4.110 mod_unload ARMv7 p2v8 ' should be '3.4.110-sun8i SMP preempt mod_unload modversions ARMv7 p2v8

Link to post
Share on other sites

Jernej thinks, that inability to load the newly built module is related with the version magic.

This means that kernel thinks that module was compiled for different version, which is strange.

Neither of us knows much about this magic strings, but at least they should match in kernel version (3.4.110 vs 3.4.110-sun8i). Probably this is a result of crosscompiling.

 

Could you have a look again as I am building on Armbian directly, thus without cross compiling?

Jernej uses a kernels which have this check disabled.

 

Alternatively, could you build this module on your setup or let us the Git tree with some of the corrections, so that we could try building on our own?

 

Originally, I looked to rebuild the driver in order to enable the Monitor mode for the OPI+ wifi, which presumably is available in the driver's Makefile :

CONFIG_WIFI_MONITOR = y

Link to post
Share on other sites

Apparently, the magic version mismatch could be corrected with the setting
EXTRAVERSION =

http://linux.die.net/lkmpg/x380.html

I looked for that setting in the driver's tree, but unable to find it.

This setting exists in the
# /lib/modules/`uname -r`/build/Makefile
and it is empty.

As I understand it, this Makefile is the one used for the kernel building, not the module, hence it is not the one to correct.

Probably, it is not as complicated to resolve, provided finding out where the above setting is defined.

 

Does anybody could resolve it?

Link to post
Share on other sites

You can try changing CONFIG_LOCALVERSION in /usr/src/linux-headers-3.4.110-sun8i/.config to see if it affects module version magic.

 

Edit:

/lib/modules/`uname -r`/build/Makefile

is actually /usr/src/linux-headers-3.4.110-sun8i/Makefile, so try setting EXTRAVERSION there.

 

Edit 2:

Okay, I made some quick tests. You need to change either .config or Makefile, execute "make" in kernel headers directory (/usr/src/linux-headers-3.4.110-sun8i), it will return error, but it doesn't matter. After that newly compiled modules should have version "3.4.110-sun8i".

Link to post
Share on other sites

This is almost it!

 

I editied the Makefile :

root@orangepiplus:/lib/modules/3.4.110-sun8i/build# vi Makefile

VERSION = 3
PATCHLEVEL = 4
SUBLEVEL = 110
#EXTRAVERSION =
EXTRAVERSION = -sun8i SMP preempt


root@orangepiplus:/lib/modules/3.4.110-sun8i/build# make
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (ARCH_SUN8I && ARCH_SUN9I && ARCH_TEGRA_2x_SOC && ARCH_TEGRA_3x_SOC && MACH_U300) selects PINCTRL which has unmet direct dependencies (EXPERIMENTAL)
warning: (ARCH_SUN8I && ARCH_SUN9I && ARCH_TEGRA_2x_SOC && ARCH_TEGRA_3x_SOC && MACH_U300) selects PINCTRL which has unmet direct dependencies (EXPERIMENTAL)
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
make[1]: *** No rule to make target 'arch/arm/tools/gen-mach-types', needed by 'include/generated/mach-types.h'.  Stop.
/usr/src/linux-headers-3.4.110-sun8i/arch/arm/Makefile:278: recipe for target 'archprepare' failed
make: *** [archprepare] Error 2
root@orangepiplus:/lib/modules/3.4.110-sun8i/build#
 

Then I rebuilt the drive in a usual way:

root@orangepiplus:/usr/src/rtl8189ES_linux# make ARCH=arm KSRC=/usr/src/linux-headers-3.4.110-sun8i

 

Now

root@orangepiplus:/usr/src/rtl8189ES_linux# insmod   8189es.ko
insmod: ERROR: could not insert module 8189es.ko: Invalid module format

 

Gives the error:
[ 3785.304498] 8189es: version magic '3.4.110-sun8i SMP preempt mod_unload ARMv7 p2v8 ' should be '3.4.110-sun8i SMP preempt mod_unload modversions ARMv7 p2v8 '

So, the difference is minimal :
'3.4.110-sun8i SMP preempt mod_unload ARMv7 p2v8 '
'3.4.110-sun8i SMP preempt mod_unload modversions ARMv7 p2v8 '
 

This time, I don't know which setting the word "modversions" comes from.

 

More efforts are necessary to resolving it. Pls assist.

Link to post
Share on other sites

Please try removing kernel headers package, manually deleting /usr/src/linux-headers-3.4.110-sun8i/ directory and installing kernel headers package again.

I believe some of your compilation attempts with wrong commands overwrote supplied kernel configuration (in kernel headers directory), which caused all version magic mismatches.

 

If there will be compilation issues after that, go into kernel headers directory, execute "make M=scripts", change directory back and repeat your module compilation.

Link to post
Share on other sites

http://openlinux.amlogic.com:8000/download/ARM/wifi/rtk8189es-2015-12-15-90ed86d42d.tar.gz

I succeed to port this driver to kernel.

 

Client and AP mode works.

Some speed tests, for stability ... we need to use it more.

[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.1 sec  26.0 MBytes  21.6 Mbits/sec
[  3]  0.0-10.1 sec  23.1 MBytes  19.1 Mbits/sec
[  3]  0.0-10.3 sec  30.5 MBytes  24.9 Mbits/sec
Link to post
Share on other sites

http://openlinux.aml...ed86d42d.tar.gz
>I succeed to port this driver to kernel.

 

I wrote an Armbian 5.05 to the new card,

Prepared the scripts:

root@orangepiplus:~# cd /usr/src/linux-headers-$(uname -r)
root@orangepiplus:/usr/src/linux-headers-3.4.110-sun8i# make scripts

 

Unzipped the sources above and tried building it :

 

root@orangepiplus:/usr/src/rtk8189es-2015-12-15-90ed86d42d/rtl8189ES# make ARCH=arm KSRC=/usr/src/linux-headers-$(uname -r)
make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- -C /usr/src/linux-headers-3.4.110-sun8i M=/usr/src/rtk8189es-2015-12-15-90ed86d42d/rtl8189ES  modules
make[1]: Entering directory '/usr/src/linux-headers-3.4.110-sun8i'
make[1]: aarch64-linux-gnu-gcc: Command not found
  CC [M]  /usr/src/rtk8189es-2015-12-15-90ed86d42d/rtl8189ES/core/rtw_cmd.o
/bin/sh: 1: aarch64-linux-gnu-gcc: not found
scripts/Makefile.build:307: recipe for target '/usr/src/rtk8189es-2015-12-15-90ed86d42d/rtl8189ES/core/rtw_cmd.o' failed
make[2]: *** [/usr/src/rtk8189es-2015-12-15-90ed86d42d/rtl8189ES/core/rtw_cmd.o] Error 127
Makefile:1367: recipe for target '_module_/usr/src/rtk8189es-2015-12-15-90ed86d42d/rtl8189ES' failed
make[1]: *** [_module_/usr/src/rtk8189es-2015-12-15-90ed86d42d/rtl8189ES] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-3.4.110-sun8i'
Makefile:1507: recipe for target 'modules' failed
make: *** [modules] Error 2
root@orangepiplus:/usr/src/rtk8189es-2015-12-15-90ed86d42d/rtl8189ES#

 

 

Is there special way deploying it ?

Link to post
Share on other sites

Unfortunately the second driver, which have monitor mode,  I was not able to fix / adopt to kernel. My knowledge is also limited. Some drivers doesn't have simple hot-to-install and here is nothing I can do. The driver and kernel are too far away. Can't tell what to do.

 

If you want to test my build, download and install with su rights:

dpkg -i linux-image-sun8i_5.10_armhf.deb
Link to post
Share on other sites

I also installed the linux-image-sun8i_5.10_armhf.deb package.

 

It also updated the kernel to

Linux orangepiplus 3.4.111-sun8i #26 SMP PREEMPT Wed Apr 27 19:50:35 CEST 2016 armv7l GNU/Linux

 

The downside for that package, is that the LED turns off after boot. There is no visual indicator for the SBC's working state.

Could it be corrected?

 

The wifi module is upgraded to

root@orangepiplus:/lib/modules/3.4.111-sun8i/kernel/drivers/net/wireless/rtl8189es# modinfo 8189es.ko
filename:       /lib/modules/3.4.111-sun8i/kernel/drivers/net/wireless/rtl8189es/8189es.ko
version:        v4.3.10.1_13373.20150129

 

but regretfully, the MONITOR MODE is not enabled.

 

 

How could a speed and stability be initiated to evaluate them?

Link to post
Share on other sites

I was preparing to rebuild the '52ee6388111fbaf990ec60e93b086cafa6cc373a' commit

where the CONFIG_WIFI_MONITOR = y

 

on the linux-image-sun8i_5.10_armhf.deb package

 

It missed the headers:

root@orangepiplus:/usr/src/rtl8189ES_linux/platform# ls -al /usr/src/linux-headers-$(uname -r)
ls: cannot access /usr/src/linux-headers-3.4.111-sun8i: No such file or directory

 

Could you create the headers for your build and post the pakage?

Will you correct the LED issue?

Link to post
Share on other sites

Will you correct the LED issue?

 

We exchanged the definition of both leds a while ago so that it matches with the way OpenELEC does (green == active, red reserved for 1st boot signaling or maybe in future for 'suspend to RAM'). So by choosing a new 5.10 image everything will be fine and by exchanging only some parts (u-boot, kernel, armhwinfo script) things will get messed up.

Link to post
Share on other sites

I have been able rebuilding conveniently the 8189es driver on the regular Armbian 5.05 from the '52ee6388111fbaf990ec60e93b086cafa6cc373a' commit

where the CONFIG_WIFI_MONITOR = y

 

The build went smoothly after replacing the platform_ARM_SUNnI_sdio.c in the driver's platform directory with the one from :

https://github.com/loboris/OrangePI-Kernel/blob/master/linux-3.4/drivers/net/wireless/rtl8189es/platform/platform_ARM_SUNnI_sdio.c

 

Then

root@orangepiplus:/usr/src/rtl8189ES_linux# make ARCH=arm KSRC=/usr/src/linux-headers-$(uname -r)
make ARCH=arm CROSS_COMPILE= -C /usr/src/linux-headers-3.4.110-sun8i M=/usr/src/rtl8189ES_linux  modules
make[1]: Entering directory '/usr/src/linux-headers-3.4.110-sun8i'
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_cmd.o
...

  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/hal8188erateadaptive.o
  CC [M]  /usr/src/rtl8189ES_linux/hal/phydm/rtl8188e/phydm_rtl8188e.o
  CC [M]  /usr/src/rtl8189ES_linux/platform/platform_ops.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_mp.o
  CC [M]  /usr/src/rtl8189ES_linux/core/rtw_mp_ioctl.o
  LD [M]  /usr/src/rtl8189ES_linux/8189es.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /usr/src/rtl8189ES_linux/8189es.mod.o
  LD [M]  /usr/src/rtl8189ES_linux/8189es.ko
make[1]: Leaving directory '/usr/src/linux-headers-3.4.110-sun8i'
root@orangepiplus:/usr/src/rtl8189ES_linux#

 

 

Looking at the info from :

root@orangepiplus:/usr/src/rtl8189ES_linux# lsmod 8189es.ko
Usage: lsmod
root@orangepiplus:/usr/src/rtl8189ES_linux# modinfo 8189es.ko
filename:       /usr/src/rtl8189ES_linux/8189es.ko
version:        v4.3.18.1_15373.20151005
author:         Realtek Semiconductor Corp.
description:    Realtek Wireless Lan Driver
license:        GPL
srcversion:     374911DC5AF9842313AEAA0
alias:          sdio:c*v024Cd8179*
depends:        
vermagic:       3.4.110-sun8i SMP preempt mod_unload modversions ARMv7 p2v8

 

This driver is more recent, than the one provided by Igor  Posted 27 April 2016 - 06:25 PM

root@orangepiplus:/lib/modules/3.4.111-sun8i/kernel/drivers/net/wireless/rtl8189es# modinfo 8189es.ko
filename:       /lib/modules/3.4.111-sun8i/kernel/drivers/net/wireless/rtl8189es/8189es.ko
version:        v4.3.10.1_13373.20150129

 

Probably this is the reason, that the CONFIG_WIFI_MONITOR = y was not present in the v4.3.10.1_13373.20150129

 

Taken that knowledge, would it be possible porting the version: v4.3.18.1_15373.20151005 to the kernel.

 

The magic version matches the kernel well now and the module loads without errors:

 

The regular module with the Armbian 5.05:

root@orangepiplus:/usr/src/rtl8189ES_linux# lsmod
Module                  Size  Used by
8189es                896688  0
root@orangepiplus:/usr/src/rtl8189ES_linux# rmmod 8189es

 

Custom built module:
root@orangepiplus:/usr/src/rtl8189ES_linux# insmod 8189es.ko
root@orangepiplus:/usr/src/rtl8189ES_linux# lsmod
Module                  Size  Used by
8189es               1212556  0

 

How to replace the regular module with the custom one, so that to load it on the system boot up?

How the iperf could be used for testing the speed ?

Link to post
Share on other sites
Guest
This topic is now closed to further replies.