BPI-M2 Incompatibilites with the new BPI-Mainline-Kernel 4.1.6


I have successfully compiled the brand new 4.1.6 mainline kernel, and have managed to U-Boot it on my Pi, and I wouId have to say i’m very impressed with the increase in performance, stability, ease of assembling, and U-Boot configuration. The U-Boot config can be done entirely by creating a boot.scr file on a partition :smile:

There are however a couple of niggles…

  1. Onboard AP6181 SDIO Wifi doesn’t work

    root@bananapi:/usr/src/BPI-WiringPi# dmesg | grep brcm [ 2.944139] usbcore: registered new interface driver brcmfmac [ 5.215835] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout [ 5.221747] brcmfmac: brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52 [ 5.229270] brcmfmac: brcmf_bus_start: failed: -52 [ 5.234094] brcmfmac: brcmf_sdio_firmware_callback: dongle is not responding root@bananapi:/usr/src/BPI-WiringPi#

  2. BPI-WiringPi isn’t compatible

    root@bananapi:/usr/src/BPI-WiringPi# gpio -v gpio version: 2.26 Copyright (c) 2012-2015 Gordon Henderson This is free software with ABSOLUTELY NO WARRANTY. For details type: gpio -warranty Unable to determine hardware version. I see: Hardware : Allwinner sun6i (A31) Family , - expecting BCM2708 or BCM2709. Please report this to [email protected] root@bananapi:/usr/src/BPI-WiringPi#

    I am pleased to see that the LED’s are directly accessible from the /sys/class/leds directory now

     root@bananapi:/usr/src/BPI-WiringPi# ls -l /sys/class/leds/
     total 0
     lrwxrwxrwx 1 root root 0 Jan  1  1970 bananapi:blue:usr -> ../../devices/platform/leds/leds/bananapi:blue:usr
     lrwxrwxrwx 1 root root 0 Jan  1  1970 bananapi:green:usr -> ../../devices/platform/leds/leds/bananapi:green:usr
     lrwxrwxrwx 1 root root 0 Jan  1  1970 bananapi:pm2:usr -> ../../devices/platform/g40_leds/leds/bananapi:pm2:usr
     lrwxrwxrwx 1 root root 0 Jan  1  1970 bananapi:red:usr -> ../../devices/platform/leds/leds/bananapi:red:usr

Banana-pi - Perhaps you could share timescales/ progress on the Wifi and Wiring Pi situation?

Many Thanks


It’s now the 3rd time I answer you with a link to this 2 months old thread: http://www.bananapi.com/index.php/forum/general-discussion-for-bpi-m2/995-working-wifi-on-modern-kernels-4-1-tested

There are people using Debian 7/8 (Armbian with Prototik’s u-Boot/dtb) on M2 with working Wi-Fi… since weeks :smile:

1 Like

If you get a “y” when you query “zgrep CONFIG_GPIO_SYSFS /proc/config.gz” something should appear below /sys/class/gpio/

Compare with http://linux-sunxi.org/GPIO#Accessing_the_GPIO_pins_through_sysfs_with_mainline_kernel to get a clue about the numbering scheme used.

1 Like

Hi Tkaiser: Thank you so much for your reply to this issue. It’s our honor to have such a forum member full of enthusiasm like you. :smile:

It’s now the 3rd time I answer you with a link to this 2 months old thread: http://www.bananapi.com/index.php/forum/general-discussion-for-bpi-m2/995-working-wifi-on-modern-kernels-4-1-tested2

Thanks tkaiser,

I managed to transplant (copy) the vmlinuz-4.0.5-bananapi (zImage) from http://mirror.igorpecovnik.com/Bananapi_Debian_3.1_wheezy_4.0.5.zip and libs from his image onto my own root fs, and it seems to have fixed my WIFI issue :smile:

mkimage -A arm -O linux -T kernel -C none -a 0x46000000 -e 0x46000000 -n “Linux kernel” -d zImage uImage

Created a new boot.cmd

setenv bootargs console=ttyS0,115200 console=tty0 root=/dev/mmcblk0p2 rootwait panic=10
load mmc 0 0x49000000 sun6i-a31s-bananapi-m2.dtb
load mmc 0 0x46000000 uImage
bootm 0x46000000 - 0x49000000

mkimage -C none -A arm -T script -d boot.cmd boot.scr

root@bananapi:~# iwconfig
wlan0     IEEE 802.11bgn  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=1496 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

lo        no wireless extensions.

eth0      no wireless extensions.

bond0     no wireless extensions.

tunl0     no wireless extensions.


It booted perfectly :smile:

Many Thanks

1 Like

You’re welcome. SInce Alan reported that it’s ‘just’ a kernel config issue maybe comparing his and your config might be an idea?

If I were you I would setup Igor’s build system as outlined here: https://github.com/igorpecovnik/lib/ and then start with 4.2 (brings cpufreq scaling for A31/A31s!). Using his build system you always also end up with a tar archive containing a set of .deb files suitable to exchange kernel easily (if you do it your own – when you use his images then this has been switched to a deb repository instead).

Since you seem experienced developing stuff you could try to fork Igor’s repository, add the M2’s dts/defconfig as patches and send a pull request when things work as expected. Beware that Igor maintains a set of patches that also affect functionality: https://github.com/igorpecovnik/lib/tree/next/patch

1 Like

HI Tkaiser: Thank you for your previous suggestion; we’ve upgraded the kernel 4.1.6 to 4.2. From the BPI team’s point of view, the most important thing now is to make the wifi of kernel 4.2 work.


Well in the meantime I have put together a working tarball containing all the necessary binaries/ files, and a root file system to build a non X windows Debian 7 Wheezy build, which emulates what you get with the Raspbian Wheezy net installer!

The tarball was put together using resources from the team at banana-pi/sinovoip, and also from resources gathered from tkaiser’s reference above.

It’s very slick and is actually very stable :smile:

The build that I have put together works with the M2 and definately works with this version of the Banana Pi!


Plus points are:

  1. AP6181 Wifi Works

  2. GPIO works / See /sys/class/leds

  3. Gigabit Ethernet works


Please see README for instructions.

Additional Note: Please download the AP6181 NVRAM firmware to get Wifi working


You need to copy it into /lib/firmware/brcm/brcmfmac43362-sdio.txt

Kind Regards


You did it, so glad to see that! :grinning:

Now if we could have source codes that can work on the kernel 4.2 with WIFI (sun6i-a31s-bananapi-m2.dts), and then push it to BPI-Mainline-kernel, it would be just great, so that we can develop more applications along with everyone.

1 Like

Hey Justin,

Well i’m fairly sure the sun6i-a31s-bananapi-m2.dts file that I am using from Igor’s kernel build is the same as yours, however i didn’t check it!

I guess you could download my tarball and inspect it. Unfortunately Igor only distributed his pre-build “zImage”, so it’s going to be difficult to reverse engineer to see what patches/ config options he implemented to get the AP6181 working, but I did see a whole lot of work going on over at Le-Maker with regards to wifi

tkaiser suggested that you can dowload a dev system, and will look at that at the weekend, but for now I am happy to wait for you to release a new mainline kernel with wifi working

The good news is that wifi is now working with Igor’s 4.0.5 kernel, and I have included it in my tarball link, and it’s working with the new mainline u-boot, which is much much better, and permits console redirection to HDMI!

root@bananapi:~# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 98:3b:16:c7:ab:e0
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::9a3b:16ff:fec7:abe0/64 Scope:Link
          RX packets:610 errors:0 dropped:19 overruns:0 frame:0
          TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:202776 (198.0 KiB)  TX bytes:8774 (8.5 KiB)

root@bananapi:~# uname -a
Linux bananapi 4.0.5-bananapi #10 SMP Wed Jun 10 21:50:24 CEST 2015 armv7l GNU/Linux

Thanks Justin :smile:



Hi Justin,

Can you have a look at implementing PoE in your next release of your Banana PI please, with regards to powering the Pi from a PoE switch?

I guess you could take the high voltage/low amps, and DC-DC convert it to DC5V @ 2A ?

This is something that would be very useful, and I would definitely upgrade :smile:



Hi Justin,

The dts provided by Igor works with your new 4.2.0 kernel, and in which case if you can push the “dts” from my tarball up to BPI-Mainline-kernel then that’s Wifi well and truly cracked :yum:

root@bananapi:~# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 98:3b:16:c7:ab:e0
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::9a3b:16ff:fec7:abe0/64 Scope:Link
          RX packets:25519 errors:0 dropped:11 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:128419 (125.4 KiB)  TX bytes:1772 (1.7 KiB)

root@bananapi:~# uname -a
Linux bananapi 4.2.0-BPI-kernel+ #1 SMP Fri Sep 4 13:24:48 BST 2015 armv7l GNU/Linux



Sorry, but it’s exactly the opposite. Igor created a fully automated build system. You fire up one single script ‘compile.sh’ that loads ressources as needed, applies patches as needed and creates both a complete image as well as .debs for kernel, headers, libs, u-boot and so on. The whole process is completely transparent.

So NOW that the community reverse engineered stuff like SDIO pin mappings and needed patches for mmc handling all you would’ve to do is really just

a) use Armbian’s build system if you want to go the Debian/Ubuntu route b) integrate defconfig/dts c) add M2 to the list of supported boards

Then you will have a build system where you can simply specify which kernel version you want to use (using KERNELTAG=“v4.1.6” for example) and you get a fully functional base image suitable for Wheezy, Jessie or Ubuntu Trusty that can run with 4.0.x/4.1.x or 4.2.x. And if that’s done patches could be sent upstream so that the M2 will be officially supported in one of the next kernel versions. There’s still no need for the BPi people to maintain cloned kernel repos on their own.

There’s neither a “BPi 4.2 kernel” nor a dts from Igor for the M2. Once again: The BPi people clone the linux kernel for no reason and the M2 stuff originated here: http://www.bananapi.com/index.php/forum/general-discussion-for-bpi-m2/995-working-wifi-on-modern-kernels-4-1-tested

now ,we not support POE function on BPI, it is easy ,only need add POE AF module on BPI, if yon need ,we can customization for you .

sinovoip also have POE product :



Can you point in in the general direction, eBay preferable for a compatible 10.1/ 10.4" LCD screen that is compatible with your new mainline kernel, and the firmware Dts file please?

I bought a banana pi camera, and would like a nice screen as well.

Many thanks


this is DIY by user. if you need 10.1, it is easy to do a 10.1 TP, but for now ,we only 7 in stock.


Can you send me a link to the 10.1 TP please, and details of payment.

Do you accept PayPal?



sorry ,we only 7 TP instock , 10.1 TP, it is DIY test for user ,not by BPI team

This is an old thread, but for education on your system I tried to install your latest 4.2 Kernel for BPI-M2 using the 16.04.2 Ubuntu mate image you posted.

I am not happy with Kernel 3.3, too old, also no sound Analog or HDMI, also very slow.

I managed to compile the kernel, I had to add the following resources:

sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev git wget fakeroot kernel-package zlib1g-dev libncurses5-dev u-boot-tools

after running make in ~/BPI-Mainline-bsp folder

it produced all the needed files like zImage, uImage also said it the modules.

I have the following folders in /lib/modules: /lib/modules/3.3.0-BPI-M2-Kernel /lib/modules/3.4.39-BPI-M2P-Kernel /lib/modules/3.4.39-BPI-M3-Kernel /lib/modules/3.4.112-sun7i /lib/modules/3.4.112-sun8i /lib/modules/3.10.101-pine64 /lib/modules/4.4.15+ /lib/modules/4.4.15-v7+

I then did as you asked in /boot:

sudo mkimage -C none -A arm -T script -d boot.cmd boot.scr

but sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb1 bs=1024 seek=8

leads to rubbish maybe chinese files & folders of boot partition.

I do not need to copy the root partition, it is already available, only make the kernel of /lib/modules/4.4.15-v7+ set up.

In Arch Linux & Ubuntu I know how to do this with grub or efi.

In u-boot I am not used to it.

Can you explain how to make the kernel 4.x selected instead of 3.3

Also what is wrong with u-boot-sunxi-with-spl.bin ?