Message ID | 20210508201614.16041-1-vincent.stehle@laposte.net |
---|---|
State | Changes Requested |
Headers | show |
Series | configs/bananapi_m2_zero: bump versions and add WiFi support | expand |
Vincent, All, On 2021-05-08 22:16 +0200, Vincent Stehlé via buildroot spake thusly: > - Bump kernel to version 5.12.2. > - Bump U-Boot to version 2021.04. > > Also, adapt the SD card name in the boot script to follow Linux naming. > While at it, add comments to make the defconfig more readable. > > The Banana Pi M2 Zero comprises an AMPAK AP6212 module with a Broadcom > bcm43438/a1 WiFi chip. Add the necessary firmware and tools to support it > and update documentation. We switch to mdev for /dev management, so that > the WiFi driver get auto-loaded. > > Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net> > --- [--SNIP--] > diff --git a/board/bananapi/bananapi-m2-zero/firmware-links.sh b/board/bananapi/bananapi-m2-zero/firmware-links.sh > new file mode 100755 > index 0000000000..7f320fb1a5 > --- /dev/null > +++ b/board/bananapi/bananapi-m2-zero/firmware-links.sh > @@ -0,0 +1,9 @@ > +#!/bin/sh > +# Create the necessary WiFi firmware symbolic links for the brcmfmac driver > +set -eu > + > +cd "$1/lib/firmware" > +[ -d brcm ] || mkdir -v brcm > +cd brcm > +ln -svf ../ap6212/nvram.txt brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt > +ln -svf ../ap6212/fw_bcm43438a1_apsta.bin brcmfmac43430-sdio.bin In linux-firmware, there is the WHENCE file which describes the links to install, and we parse that in linux-firmware.mk. Why can't we do similarly with armbian-firmware.mk? Yeah, it misses WHENCE or something similar, but we should do it nonethelessC, like so: diff --git a/package/armbian-firmware/armbian-firmware.mk b/package/armbian-firmware/armbian-firmware.mk index 0ed069025d..51bc5b903d 100644 --- a/package/armbian-firmware/armbian-firmware.mk +++ b/package/armbian-firmware/armbian-firmware.mk @@ -11,6 +11,13 @@ ARMBIAN_FIRMWARE_SITE_METHOD = git # AP6212 WiFi/BT combo firmware ifeq ($(BR2_PACKAGE_ARMBIAN_FIRMWARE_AP6212),y) ARMBIAN_FIRMWARE_DIRS += ap6212 +define ARMBIAN_FIRMWARE_AP6212_LINKS + ln -svf ../ap6212/nvram.txt \ + $(TARGET_DIR)/lib/firmware/brcm/brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt + ln -svf ../ap6212/fw_bcm43438a1_apsta.bin \ + $(TARGET_DIR)/lib/firmware/brcm/brcmfmac43430-sdio.bin +endef +ARMBIAN_FIRMWARE_POST_INSTALL_TARGET_HOOKS += ARMBIAN_FIRMWARE_AP6212_LINKS endif # AP6256 WiFi/BT combo firmware Also, if one look at armbian-firmware, there is already a brcm/ sub-directory, and that already has brcm/brcmfmac43430-sdio.bin. Of course, the two are different... Additionally, linux-firmware has brcm/brcmfmac43430a0-sdio.bin and brcm/brcmfmac43430-sdio.AP6212.txt, again with different content. The latter states "NVRAM config file for the Ampak AP6212 43430 WiFi/BT module". So, this is quite a mess. Why do we have to use the armbian-fw ones, instead of those from linux-firmware? We are using an upstream kernel, and supposedly, drivers in there are supposed (as I understand it) to only require blobs from linux-firmware... By the way, where does the weird 'brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt' name comes from? Is that a 'compatible' string from the DT? Regards, Yann E. MORIN.
Hello Yann, On Wed, 19 May 2021 13:38:11 +0200, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote: > Vincent, All, > > On 2021-05-08 22:16 +0200, Vincent Stehlé via buildroot spake thusly: > > - Bump kernel to version 5.12.2. > > - Bump U-Boot to version 2021.04. > > > > Also, adapt the SD card name in the boot script to follow Linux naming. > > While at it, add comments to make the defconfig more readable. > > > > The Banana Pi M2 Zero comprises an AMPAK AP6212 module with a Broadcom > > bcm43438/a1 WiFi chip. Add the necessary firmware and tools to support it > > and update documentation. We switch to mdev for /dev management, so that > > the WiFi driver get auto-loaded. > > > > Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net> > > --- > [--SNIP--] > > diff --git a/board/bananapi/bananapi-m2-zero/firmware-links.sh b/board/bananapi/bananapi-m2-zero/firmware-links.sh > > new file mode 100755 > > index 0000000000..7f320fb1a5 > > --- /dev/null > > +++ b/board/bananapi/bananapi-m2-zero/firmware-links.sh > > @@ -0,0 +1,9 @@ > > +#!/bin/sh > > +# Create the necessary WiFi firmware symbolic links for the brcmfmac driver > > +set -eu > > + > > +cd "$1/lib/firmware" > > +[ -d brcm ] || mkdir -v brcm > > +cd brcm > > +ln -svf ../ap6212/nvram.txt brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt > > +ln -svf ../ap6212/fw_bcm43438a1_apsta.bin brcmfmac43430-sdio.bin > > In linux-firmware, there is the WHENCE file which describes the links to > install, and we parse that in linux-firmware.mk. > > Why can't we do similarly with armbian-firmware.mk? > > Yeah, it misses WHENCE or something similar, but we should do it > nonethelessC, like so: > > diff --git a/package/armbian-firmware/armbian-firmware.mk b/package/armbian-firmware/armbian-firmware.mk > index 0ed069025d..51bc5b903d 100644 > --- a/package/armbian-firmware/armbian-firmware.mk > +++ b/package/armbian-firmware/armbian-firmware.mk > @@ -11,6 +11,13 @@ ARMBIAN_FIRMWARE_SITE_METHOD = git > # AP6212 WiFi/BT combo firmware > ifeq ($(BR2_PACKAGE_ARMBIAN_FIRMWARE_AP6212),y) > ARMBIAN_FIRMWARE_DIRS += ap6212 > +define ARMBIAN_FIRMWARE_AP6212_LINKS > + ln -svf ../ap6212/nvram.txt \ > + $(TARGET_DIR)/lib/firmware/brcm/brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt > + ln -svf ../ap6212/fw_bcm43438a1_apsta.bin \ > + $(TARGET_DIR)/lib/firmware/brcm/brcmfmac43430-sdio.bin > +endef > +ARMBIAN_FIRMWARE_POST_INSTALL_TARGET_HOOKS += ARMBIAN_FIRMWARE_AP6212_LINKS > endif > > # AP6256 WiFi/BT combo firmware > > Also, if one look at armbian-firmware, there is already a brcm/ > sub-directory, and that already has brcm/brcmfmac43430-sdio.bin. Of > course, the two are different... > > Additionally, linux-firmware has brcm/brcmfmac43430a0-sdio.bin and > brcm/brcmfmac43430-sdio.AP6212.txt, again with different content. The > latter states "NVRAM config file for the Ampak AP6212 43430 WiFi/BT > module". > > So, this is quite a mess. Why do we have to use the armbian-fw ones, > instead of those from linux-firmware? We are using an upstream kernel, > and supposedly, drivers in there are supposed (as I understand it) to > only require blobs from linux-firmware... > > By the way, where does the weird 'brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt' > name comes from? Is that a 'compatible' string from the DT? It is the naming schema for (wifi) firmware configuration files: brcmfmac43430-sdio.<vendor>,<board>.txt See e.g. [1] for raspberry pi examples..., I think the board name comes from the dtb entries... Regards, peter [1] http://lists.busybox.net/pipermail/buildroot/2021-March/306920.html > > Regards, > Yann E. MORIN. >
On Wed, May 19, 2021 at 01:38:11PM +0200, Yann E. MORIN wrote: .. > Also, if one look at armbian-firmware, there is already a brcm/ > sub-directory, and that already has brcm/brcmfmac43430-sdio.bin. Of > course, the two are different... > > Additionally, linux-firmware has brcm/brcmfmac43430a0-sdio.bin and > brcm/brcmfmac43430-sdio.AP6212.txt, again with different content. The > latter states "NVRAM config file for the Ampak AP6212 43430 WiFi/BT > module". > > So, this is quite a mess. Why do we have to use the armbian-fw ones, > instead of those from linux-firmware? We are using an upstream kernel, > and supposedly, drivers in there are supposed (as I understand it) to > only require blobs from linux-firmware... Hi Yann, Thanks for the review. You are right, there are multiple firmware candidates. I selected this Armbian AP6212 firmware a while ago for a specific scenario of STA+AP. For the buildroot config, I think any firmware capable of STA should do. After a quick re-test the following combinations work fine: linux-firmware-20201022/brcm/brcmfmac43430-sdio.AP6212.txt + linux-firmware-20201022/brcm/brcmfmac43430-sdio.bin armbian-firmware-70a08503ac9e765f5d1ccf4fa3e825db0751e53e/brcm/brcmfmac43430-sdio.bin + armbian-firmware-70a08503ac9e765f5d1ccf4fa3e825db0751e53e/brcm/brcmfmac43430-sdio.txt armbian-firmware-70a08503ac9e765f5d1ccf4fa3e825db0751e53e/ap6212/fw_bcm43438a1.bin + armbian-firmware-70a08503ac9e765f5d1ccf4fa3e825db0751e53e/ap6212/nvram.txt armbian-firmware-70a08503ac9e765f5d1ccf4fa3e825db0751e53e/ap6212/fw_bcm43438a1_apsta.bin + armbian-firmware-70a08503ac9e765f5d1ccf4fa3e825db0751e53e/ap6212/nvram.txt (No working combination with rpi-wifi-firmware.) I will re-post an updated configuration using linux-firmware instead. Let's see if I can submit a patch to the linux-firmware WHENCE file for the symlinks. > By the way, where does the weird 'brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt' > name comes from? Is that a 'compatible' string from the DT? Peter explained the naming in another e-mail already but FWIW the driver also considers the more generic brcmfmac43430-sdio.txt as second choice. Not sure if that helps us here. Best regards, Vincent.
diff --git a/board/bananapi/bananapi-m2-zero/boot.cmd b/board/bananapi/bananapi-m2-zero/boot.cmd index 081450935b..70ccdf7045 100644 --- a/board/bananapi/bananapi-m2-zero/boot.cmd +++ b/board/bananapi/bananapi-m2-zero/boot.cmd @@ -1,4 +1,4 @@ -setenv bootargs console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait +setenv bootargs console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rootwait mmc dev 0 fatload mmc 0 $kernel_addr_r zImage diff --git a/board/bananapi/bananapi-m2-zero/firmware-links.sh b/board/bananapi/bananapi-m2-zero/firmware-links.sh new file mode 100755 index 0000000000..7f320fb1a5 --- /dev/null +++ b/board/bananapi/bananapi-m2-zero/firmware-links.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Create the necessary WiFi firmware symbolic links for the brcmfmac driver +set -eu + +cd "$1/lib/firmware" +[ -d brcm ] || mkdir -v brcm +cd brcm +ln -svf ../ap6212/nvram.txt brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt +ln -svf ../ap6212/fw_bcm43438a1_apsta.bin brcmfmac43430-sdio.bin diff --git a/board/bananapi/bananapi-m2-zero/linux-extras.config b/board/bananapi/bananapi-m2-zero/linux-extras.config new file mode 100644 index 0000000000..b9d3b143c8 --- /dev/null +++ b/board/bananapi/bananapi-m2-zero/linux-extras.config @@ -0,0 +1,9 @@ +# wireless core +CONFIG_WIRELESS=y +CONFIG_CFG80211=m +CONFIG_CFG80211_WEXT=y + +# wireless drivers +CONFIG_WLAN=y +CONFIG_WLAN_VENDOR_BROADCOM=y +CONFIG_BRCMFMAC=m diff --git a/board/bananapi/bananapi-m2-zero/readme.txt b/board/bananapi/bananapi-m2-zero/readme.txt index 9edd477f11..a48c514c14 100644 --- a/board/bananapi/bananapi-m2-zero/readme.txt +++ b/board/bananapi/bananapi-m2-zero/readme.txt @@ -32,3 +32,17 @@ Copy the bootable "sdcard.img" onto an SD card with "dd": Insert the micro SDcard in your Bananapi M2 Zero and power it up. The console is on the Debug UART on the CON3 header, with serial settings 115200 8N1. + +Using Wifi +========== + + # iwconfig wlan0 essid ACCESSPOINTNAME + # wpa_passphrase ACCESSPOINTNAME > /etc/wpa.conf + +(enter the wifi password and press enter) + + # wpa_supplicant -i wlan0 -c /etc/wpa.conf & + # udhcpc -i wlan0 + # ping buildroot.org + +Enjoy! diff --git a/configs/bananapi_m2_zero_defconfig b/configs/bananapi_m2_zero_defconfig index e5c89fce40..9e6760d196 100644 --- a/configs/bananapi_m2_zero_defconfig +++ b/configs/bananapi_m2_zero_defconfig @@ -1,23 +1,45 @@ +# Architecture BR2_arm=y BR2_cortex_a7=y BR2_ARM_FPU_NEON_VFPV4=y -BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_9=y + +# Linux headers same as kernel, a 5.12 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_12=y + +# System BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot for the Bananapi M2 Zero" +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y +BR2_ROOTFS_POST_BUILD_SCRIPT="board/bananapi/bananapi-m2-zero/firmware-links.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/bananapi/bananapi-m2-zero/genimage.cfg" + +# Kernel BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.9.11" +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.12.2" BR2_LINUX_KERNEL_DEFCONFIG="sunxi" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/bananapi/bananapi-m2-zero/linux-extras.config" BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-h2-plus-bananapi-m2-zero" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y + +# WiFi +BR2_PACKAGE_ARMBIAN_FIRMWARE=y +BR2_PACKAGE_ARMBIAN_FIRMWARE_AP6212=y +BR2_PACKAGE_WIRELESS_TOOLS=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y + +# Filesystem BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y # BR2_TARGET_ROOTFS_TAR is not set + +# Bootloader BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BOARDNAME="bananapi_m2_zero" BR2_TARGET_UBOOT_CUSTOM_VERSION=y -BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.10" +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2021.04" BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_NEEDS_PYTHON3=y BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y @@ -26,6 +48,8 @@ BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin" BR2_PACKAGE_HOST_UBOOT_TOOLS=y BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/bananapi/bananapi-m2-zero/boot.cmd" + +# Required tools to create the SD image BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y
- Bump kernel to version 5.12.2. - Bump U-Boot to version 2021.04. Also, adapt the SD card name in the boot script to follow Linux naming. While at it, add comments to make the defconfig more readable. The Banana Pi M2 Zero comprises an AMPAK AP6212 module with a Broadcom bcm43438/a1 WiFi chip. Add the necessary firmware and tools to support it and update documentation. We switch to mdev for /dev management, so that the WiFi driver get auto-loaded. Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net> --- board/bananapi/bananapi-m2-zero/boot.cmd | 2 +- .../bananapi-m2-zero/firmware-links.sh | 9 ++++++ .../bananapi-m2-zero/linux-extras.config | 9 ++++++ board/bananapi/bananapi-m2-zero/readme.txt | 14 +++++++++ configs/bananapi_m2_zero_defconfig | 30 +++++++++++++++++-- 5 files changed, 60 insertions(+), 4 deletions(-) create mode 100755 board/bananapi/bananapi-m2-zero/firmware-links.sh create mode 100644 board/bananapi/bananapi-m2-zero/linux-extras.config