How do I use the BPI-Kernel4.0 with BPI-M2-BSP?

Hi,

I have managed to compile the 3.3.0 kernel that comes as linux-sunxi folder in your BPI-M2-BSP git repository, and have managed to write the FEX files to my SD card, and have successfully booted a root file system, but Wifi doesn’t work, and there doesn’t seem to be any drivers available to modprobe, compile or otherwise.

What do I need to do to create FEX files for the kernel from your BPI-Kernel4.0?

I have compiled it using option 3 on ./build.sh, but don’t know how to wrap the uImage and kernel up to burn to the SD card.

Many Thanks

Alan

Hi,

This is what I am running at the moment using the build I created using the BPI-M2-BSP package

root@bananapi:~# uname -a Linux bananapi 3.3.0-BPI-M2-Kernel #1 SMP PREEMPT Tue Sep 1 16:13:21 BST 2015 armv7l GNU/Linux root@bananapi:~#

Thanks

Alan

if you compile 3.3 kernel , WIFI will work fine .

and 4.1.6 kernel we have update ,you can try to compile it.

HI: you can try it.


Kernel 3.3:

cd system sudo mkdir vendor cd vendor sudo ln -s /lib/modules//3.3.0-BPI-M2-Kernel modules


Kernel 4.1.6:

1 Like

Hi Justin,

I have cloned your BPI-Mainline-Kernel and have successfully compiled it.

I set up two partitions on my MMC card

P1. FAT (50MB) P2. EXT4

  1. I copied a script.bin to FAT P1 which I created by the following command:

./fex2bin /usr/src/BPI-M2-bsp/sunxi-pack/chips/sun6i/configs/linux/BPI_M2_720P/sys_config.fex /usr/src/script.bin

  1. I copied uImage from /usr/src/BPI-Mainline-kernel/output/bpi/arch/arm/boot to FAT P1

root@ubuntu:/usr/src/BPI-Mainline-kernel/output/bpi/arch/arm/boot# ls -l total 32788 drwxr-xr-x 2 root root 4096 Sep 2 12:07 compressed drwxr-xr-x 2 root root 114688 Sep 2 12:00 dts -rwxr-xr-x 1 root root 17924096 Sep 2 12:07 Image -rw-r–r-- 1 root root 7763920 Sep 2 12:07 uImage -rwxr-xr-x 1 root root 7763856 Sep 2 12:07 zImage root@ubuntu:/usr/src/BPI-Mainline-kernel/output/bpi/arch/arm/boot#

  1. I set up U-Boot on the MMC Card

U-Boot SPL 2015.04 (Sep 02 2015 - 09:38:45) DRAM: 1024 MiB

  1. Set up root file system on EXT4 P2

I am trying to boot my linux using the following U-Boot CLI comands

setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 ${extra} fatload mmc 0 0x43000000 script.bin fatload mmc 0 0x48000000 uImage bootm 0x43000000 - 0x48000000

U-Boot 2015.04 (Sep 02 2015 - 09:38:45) Allwinner Technology

CPU: Allwinner A31s (SUN6I) I2C: ready DRAM: 1 GiB MMC: SUNXI SD/MMC: 0 *** Warning - bad CRC, using default environment

All I get is this…

sunxi# bootm 0x48000000

Booting kernel from Legacy Image at 48000000 …

Image Name: Linux-4.1.6-BPI-kernel+ Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 7763856 Bytes = 7.4 MiB Load Address: 40008000 Entry Point: 40008000 Verifying Checksum … OK Loading Kernel Image … OK

Starting kernel …

Can you tell me what I am doing wrong please?

N.B I am almost there

Thanks

Alan

Script.bin isn’t used any longer if you set on mainline U-Boot/kernel: http://linux-sunxi.org/Mainline_Kernel_Howto#Boot

Since the BPi people still refuse to cooperate with the linux-sunxi community, clone github repos like crazy, don’t use branches and proper commit comments and also don’t send their patches back to get them included upstream you’ll have to find out yourself what of the above applies to your M2 situation and what not :slight_smile:

Hi tkaiser,

Thanks your help :smile:

I am wondering if you could help me out with U-Boot’n a kernel?

root@ubuntu:/usr/src/BPI-Mainline-kernel/output/bpi/arch/arm/boot# ls -l total 51380 -rw-r–r-- 1 root root 11272192 Sep 2 14:00 boot.img drwxr-xr-x 2 root root 4096 Sep 2 12:07 compressed drwxr-xr-x 2 root root 114688 Sep 2 12:00 dts -rwxr-xr-x 1 root root 17924096 Sep 2 12:07 Image -rw-r–r-- 1 root root 7763920 Sep 2 12:07 uImage -rw-r–r-- 1 root root 7763920 Sep 2 14:17 uImage.2 -rwxr-xr-x 1 root root 7763856 Sep 2 12:07 zImage root@ubuntu:/usr/src/BPI-Mainline-kernel/output/bpi/arch/arm/boot#

I built my uImage using the following command

mkimage -A arm -O linux -T kernel -C none -a 0x48000000 -e 0x48000000 -n "Linux kernel" -d zImage uImage

I am booting it using the following U-Boot arguments

setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait
fatload mmc 0 0x43000000 uImage
bootm 0x43000000

This is what I get … It sits there all day like that!

sunxi# fatload mmc 0 0x43000000 uImage
reading uImage
7763920 bytes read in 546 ms (13.6 MiB/s)
sunxi#
sunxi# bootm 0x43000000
## Booting kernel from Legacy Image at 43000000 ...
   Image Name:   Linux kernel
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    7763856 Bytes = 7.4 MiB
   Load Address: 48000000
   Entry Point:  48000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

Any help would be appreciated!

I found some inspiration here, however I just can’t get this pi to boot!!

https://linux-sunxi.org/Mainline_U-boot

Thanks

Alan

Hi alantrundle,

If you want to use BPI-Mainline-kernel, you should also compile BPI-Mainline-uboot. After that,

Partition the sdcard with a 32MB FAT32 boot partition starting at 1MB, and the rest as rootfs partition with ext4 format. You can change the boot partition size as you want.

Create a file boot.cmd on the boot partition.


setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 load mmc 0:1 0x43000000 bananapi/${fdtfile} load mmc 0:1 0x42000000 bananapi/uImage bootm 0x42000000 - 0x43000000

Then convert boot.cmd to boot.scr

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

Download u-boot

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

Copy uImage and dtb file(sun6i-a31s-bananapi-m2.dtb) to ${BOOT_PARTITION}/bananapi/

Copy your rootfs to rootfs partition and copy kernel modules.

You will be clear about this if you see the readme in BPI-Mainline-bsp/README.md

thanks, DK

I cannot help since I donanted my M2 to the linux-sunxi community a few months ago. But you’ll need a correct boot.scr (made from boot.cmd) and of course the .dtb in place.

Check out if that helps: http://www.bananapi.com/index.php/forum/general-discussion-for-bpi-m2/995-working-wifi-on-modern-kernels-4-1-tested?limitstart=0

Hi alantrundle,

If you want to use the 3.3 kernel of BPI-M2-BSP, after compile the source with build.sh finished,

$ cd scripts $ sudo ./dd_download.sh /dev/sdX //This will download all the fex bsp files.

For wifi working on your own rootfs, you must

  1. mount your sdcard ext4 partition to /mnt

  2. copy the kernel modules in path download/$BOARD/lib/modules/3.3.0-BPI-M2-Kernel to /mnt/lib/modules/

  3. $ cd /mnt

  4. $ ln -s /lib/modules/3.3.0-BPI-M2-Kernel system/vendor/modules //for wlan firmware load

  5. Then you can bootup and run “modprobe bcmdhd” command for wifi driver insert or you can write it to /etc/modules for loading it automatically.

thanks, DK

Hi DK,

Absolutely briliant - Thanks

I was able to use the uImage generated by my build of BPI-Mainline, and the U-Boot generated from the BPI-Kernel4.0 build, and combined with your know how, managed to create a very nice slick bootable Debian 7 build.

**U-Boot SPL 2015.04 (Sep 02 2015 - 10:52:20)**
DRAM: 1024 MiB


U-Boot 2015.04 (Sep 02 2015 - 10:52:20) Allwinner Technology

CPU:   Allwinner A31s (SUN6I)
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
**HDMI connected: Setting up a 1920x1080 hdmi console** < You need to add console=tty0 to boot.cmd/boot.scr
**In:    serial**
**Out:   vga**
**Err:   vga**
Net:   dwmac.1c30000
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 4 USB Device(s) found
USB1:   USB EHCI 1.00
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
reading /boot.scr
272 bytes read in 18 ms (14.6 KiB/s)
## Executing script at 43100000
reading sun6i-a31s-bananapi-m2.dtb
21826 bytes read in 33 ms (645.5 KiB/s)
reading uImage
7763920 bytes read in 546 ms (13.6 MiB/s)
## Booting kernel from Legacy Image at 42000000 ...
   Image Name:   Linux-4.1.6-BPI-kernel+
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    7763856 Bytes = 7.4 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Loading Kernel Image ... OK
   Loading Device Tree to 4eff7000, end 4efff541 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0

[   10.136598] stmmaceth 1c30000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off

Debian GNU/Linux 7 bananapi ttyS0

bananapi login: root

Thanks

Alan

Hi DK,

One very last problem I am facing is how to get the onboard Wifi working.

So far I have created the /system/Vendor

root@bananapi:~# cd /system/vendor/
root@bananapi:/system/vendor# ls -l
total 0
lrwxrwxrwx 1 root root 31 Sep  2 14:13 modules -> /lib/modules/4.1.6-BPI-kernel+/
root@bananapi:/system/vendor#

Seems that the linux build is seeing the card

root@bananapi:/system/vendor# dmesg | grep cfg80211
[    2.899871] cfg80211: Calling CRDA to update world regulatory domain
[    3.229706] cfg80211: World regulatory domain updated:
[    3.234906] cfg80211:  DFS Master region: unset
[    3.239282] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    3.249084] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    3.257125] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    3.265162] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[    3.273199] cfg80211:   (5170000 KHz - 5250000 KHz @ 160000 KHz), (N/A, 2000 mBm), (N/A)
[    3.281324] cfg80211:   (5250000 KHz - 5330000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    3.289449] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    3.297576] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[    3.305613] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
root@bananapi:/system/vendor#


brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[    5.321726] brcmfmac: brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
[    5.329266] brcmfmac: brcmf_bus_start: failed: -52
[    5.329283] brcmfmac: brcmf_sdio_firmware_callback: dongle is not responding

using http://dl.cubieboard.org/public/Cubieboard/benn/firmware/ap6210/nvram_ap6210.txt

But you cannot scan for access points. Interface WLAN0 won’t come up

root@bananapi:/system/vendor# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# loopback network interface
auto lo
iface lo inet loopback

# primary network interface
auto eth0
iface eth0 inet static
 address 10.6.1.30
 netmask 255.255.0.0
 gateway 10.6.254.254

# wireless network interface
auto wlan0
iface wlan0 inet manual

root@bananapi:/system/vendor# iwlist wlan0 scan
wlan0     Interface doesn't support scanning.

If you could help, then I would appreciate it very much

Regards

Alan