cancel
Showing results for 
Search instead for 
Did you mean: 

Wi-Fi Bluetooth for Linux

kkvara
New Contributor

Hi,

We are using Murata 1MW chip for BLE+WIFI with am335x processor.

To get the drivers, we have downloaded the fmac release cypress-fmac-v5.4.18-2020_0925 and tried cross compiling but getting below errors:

/--------------
| Your kernel headers are incomplete/not installed.
| Please install kernel headers, including a .config
| file or use the KLIB/KLIB_BUILD make variables to
| set the kernel to build against, e.g.
| make KLIB=/lib/modules/3.1.7/
| to compile/install for the installed kernel 3.1.7
| (that isn't currently running.)
\--
Makefile:40: recipe for target 'defconfig-brcmfmac' failed
make: *** [defconfig-brcmfmac] Error 1

Running linux version 4.15, even in makefile it is mentioned as KLIB = (uname -r), then why is it giving error for 3.17 kernel headers.

Can you please have a look on this and also let me know which fmac release can be used for am335x and kernel version 4.19.94

Thanks,

VK

0 Likes
1 Reply
Zhengbao_Zhang
Moderator
Moderator

Hello:

 We have  a README file in the release , it gives details. 

Instructions
------------
The patch files in this package are based on Linux v5.4.18, so older kernels
need use backports package. Below are examples of how to use this package
with an older kernel or linux-stable v5.4.18.

### Using backports with an older kernel (v3.10+)

Linux kernel image and cypress driver modules need to be built separately.
Below is the example of using with iMX Linux v4.14.78:

#### Build the kernel image
```bash
#1. Have the BSP kernel source available
git clone https://source.codeaurora.org/external/imx/linux-imx
cd linux-imx
git checkout imx_4.14.78_1.0.0_ga
#2. Set up build environment and kernel configuration
source /opt/poky/1.8/environment-setup-cortexa7hf-vfp-neon-poky-linux-gnueabi
make imx_v7_defconfig
#3. Edit .config and build cfg80211 as module
# CONFIG_CFG80211=m
# CONFIG_BCMDHD=n
#4. Enable below configs in .config
# CONFIG_ASYMMETRIC_KEY_TYPE=y
# CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
# CONFIG_X509_CERTIFICATE_PARSER=y
# CONFIG_PKCS7_MESSAGE_PARSER=y
#5. Build the Linux kernel image
make oldconfig
make zImage -j 8
#6. The kernel image is available here
arch/arm/boot/zImage
```

#### Build the cypress driver/backports modules
```bash
#1. Untar the Cypress backports package
tar zxvf cypress-backports-*.tar.gz
cd v5.4.18-backports
#2. (Native) compile local tools and generate .config (in a new terminal
# without sourcing Yoctol toolchain settings)
bash
MY_KERNEL=<the 4.14.78 kernel path>
make KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL defconfig-brcmfmac
#3. (Cross) compile kernel modules
source /opt/poky/1.8/environment-setup-cortexa7hf-vfp-neon-poky-linux-gnueabi
make KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL modules
#4. The kernel modules are available here
# compat/compat.ko
# net/wireless/cfg80211.ko
# drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
# drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
```

#### Device tree
```bash
#1. Untar the cypress devicetree package
tar zxvf cypress-devicetree-*.tar.gz
#2. Find your board's dtb file, for example
# cypress-devicetree/iMX6SX/4.14.78/imx6sx-sdb-btwifi-fmac.dtb
```
Note: If your board's dtb is not available in the cypress devicetree
package, please refer to the available dts/dtsi files and create
them for your board, then compile them for the dtb file. iMX dts
files are located in linux-imx/arch/arm/boot/dts/ folder of the
Linux kernel tree. Below command compiles a dtb file
```bash
make ARCH=arm <devicetree name>.dtb
```

#### Load the cypress wifi driver
```bash
#1. Copy your boards's zImage and dtb files to the target board
bash
TARGET_IP=<target board IP>
scp <dtb file> root@$TARGET_IP:/run/media/mmcblk1p1/cy.dtb
scp <zImage file> root@$TARGET_IP:/run/media/mmcblk1p1/zImage_cy
#2. Copy firmware files to the target board
tar zxvf cypress-firmware*.tar.gz
scp firmware/* root@$TARGET_IP:/lib/firmware/cypress
#3. Copy your nvram file (from board vendor) to the target board and rename it
scp <nvram file> root@$TARGET_IP:/lib/firmware/cypress/<fw name>.txt
# (fw name is your chip's *.bin file name in the cypress firmware package)
#4. Copy cypress kernel modules to the target board
scp <module files> root@$TARGET_IP:/lib/modules/4.14.78
#5. (iMX console) Press ctrl-c after target boot to enter u-boot and configure it
# for the new zImage/dtb files
env print image fdt_file
setenv image zImage_cy
setenv fdt_file cy.dtb
saveenv
env print image fdt_file
reset
#6. (iMX console) Boot up the target board with the above zImage and insmod cypress modules
insmod /lib/modules/4.14.78/compat.ko
insmod /lib/modules/4.14.78/cfg80211.ko
insmod /lib/modules/4.14.78/brcmutil.ko
insmod /lib/modules/4.14.78/brcmfmac.ko
```
Note: More on fmac driver [firmware/nvram install](https://wireless.wiki.kernel.org/en/users/drivers/brcm80211#firmware_installation1)

### Using Linux Stable v5.4.18
```bash
#1. Download Linux stable kernel source
wget https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/snapshot/linux-5.4.18.tar.gz
tar zxvf linux-5.4.18.tar.gz
#2. In Linux root folder, untar/apply cypress patches with below bash commands
cd linux-5.4.18
tar zxvf cypress-patch*.tar.gz
for i in cypress-patch/*.patch; do patch -p1 < $i; done
#3. Set kernel .config and enable below options, then compile kernel image
# CONFIG_BRCMUTIL=y
# CONFIG_BRCMFMAC=y
# CONFIG_BRCMFMAC_SDIO=y
# CONFIG_BRCMFMAC_PROTO_BCDC=y
# CONFIG_BRCMFMAC_PCIE=y
# CONFIG_BRCMFMAC_PROTO_MSGBUF=y
#4. (optional) Backup original firmware files
cp /lib/firmware/cypress /lib/firmware/cypress-bak -r
#5. Update firmware files in /lib/firmware/cypress
tar zxvf cypress-firmware*.tar.gz
cp firmware/* /lib/firmware/cypress
#6. Boot the system with the new kernel image
```

0 Likes