Skip to contentSkip to conversation

board: add support for Banana Pro

PATCH New Jörg Krause 2 participants 2 messages Jan 13, 2017 – Mar 5, 2017 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: add support for Banana Pro

The board support package includes the following components:
- U-Boot 2016.11
- Linux 4.9.3
- packages:
- resize2fs to expand the minimal rootfs
- alsa-utils for basic audio usage of the on-board headphone jack and microphone
- iw and wpa_supplicant for managing the wireless interface

Two Linux patches are necessary to enable audio and wifi support. Both patches are fetched from the Linux next branch and are probably mainlined in Linux 4.11.

A Linux configuration fragment enables the wireless device driver, which is not enabled by default in the mainline defconfig of the board.

The wifi chip needs a NVRAM configuration file which is provided in the rootfs overlay.

---
 board/lemaker/bananapro/boot.cmd                   |  5 ++
 board/lemaker/bananapro/genimage.cfg               | 37 ++++++++++
 board/lemaker/bananapro/linux-wifi.fragment        | 23 ++++++
 ...ts-sun7i-Enable-audio-codec-on-Banana-Pro.patch | 35 +++++++++
 ...-dts-sun7i-Add-wifi-dt-node-on-Banana-Pro.patch | 85 ++++++++++++++++++++++
 board/lemaker/bananapro/post-build.sh              | 12 +++
 board/lemaker/bananapro/post-image.sh              | 16 ++++
 board/lemaker/bananapro/readme.txt                 | 71 ++++++++++++++++++
 .../lib/firmware/brcm/brcmfmac43362-sdio.txt       | 56 ++++++++++++++
 configs/bananapro_defconfig                        | 80 ++++++++++++++++++++
 10 files changed, 420 insertions(+)
 create mode 100644 board/lemaker/bananapro/boot.cmd
 create mode 100644 board/lemaker/bananapro/genimage.cfg
 create mode 100644 board/lemaker/bananapro/linux-wifi.fragment
 create mode 100644 board/lemaker/bananapro/patches/linux/0001-ARM-dts-sun7i-Enable-audio-codec-on-Banana-Pro.patch
 create mode 100644 board/lemaker/bananapro/patches/linux/0002-ARM-dts-sun7i-Add-wifi-dt-node-on-Banana-Pro.patch
 create mode 100755 board/lemaker/bananapro/post-build.sh
 create mode 100755 board/lemaker/bananapro/post-image.sh
 create mode 100644 board/lemaker/bananapro/readme.txt
 create mode 100644 board/lemaker/bananapro/rootfs_overlay/lib/firmware/brcm/brcmfmac43362-sdio.txt
 create mode 100644 configs/bananapro_defconfig
board/lemaker/bananapro/boot.cmd new file +5 -0
new file mode 100644
index 000000000..439f5b12c
@@ -0,0 +1,5 @@
+setenv fdt_high ffffffff
+setenv bootargs console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait
+fatload mmc 0 $kernel_addr_r zImage
+fatload mmc 0 $fdt_addr_r sun7i-a20-bananapro.dtb
+bootz $kernel_addr_r - $fdt_addr_r
board/lemaker/bananapro/genimage.cfg new file +37 -0
new file mode 100644
index 000000000..190a4b1ff
@@ -0,0 +1,37 @@
+# Minimal SD card image for the Banana Pro
+# Based in the Orange Pi genimage.cfg
+
+image boot.vfat {
+	vfat {
+		files = {
+			"zImage",
+			"sun7i-a20-bananapro.dtb",
+			"boot.scr"
+		}
+	}
+	size = 10M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition u-boot {
+		in-partition-table = "no"
+		image = "u-boot-sunxi-with-spl.bin"
+		offset = 8192
+		size = 1040384 # 1MB - 8192
+	}
+
+	partition boot {
+		partition-type = 0xC
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+	}
+}
board/lemaker/bananapro/linux-wifi.fragment new file +23 -0
new file mode 100644
index 000000000..40ca859d4
@@ -0,0 +1,23 @@
+# Networking support
+CONFIG_WIRELESS=y
+CONFIG_CFG80211=y
+CONFIG_CFG80211_WEXT=y
+
+# Network device support
+CONFIG_WLAN=y
+CONFIG_WLAN_VENDOR_BROADCOM=y
+CONFIG_BRCMFMAC=m
+# CONFIG_WLAN_VENDOR_ADMTEK is not set
+# CONFIG_WLAN_VENDOR_ATH is not set
+# CONFIG_WLAN_VENDOR_ATMEL is not set
+# CONFIG_WLAN_VENDOR_CISCO is not set
+# CONFIG_WLAN_VENDOR_INTEL is not set
+# CONFIG_WLAN_VENDOR_INTERSIL is not set
+# CONFIG_WLAN_VENDOR_MARVELL is not set
+# CONFIG_WLAN_VENDOR_MEDIATEK is not set
+# CONFIG_WLAN_VENDOR_RALINK is not set
+# CONFIG_WLAN_VENDOR_REALTEK is not set
+# CONFIG_WLAN_VENDOR_RSI is not set
+# CONFIG_WLAN_VENDOR_ST is not set
+# CONFIG_WLAN_VENDOR_TI is not set
+# CONFIG_WLAN_VENDOR_ZYDAS is not set
\ No newline at end of file
board/lemaker/bananapro/patches/linux/0001-ARM-dts-sun7i-Enable-audio-codec-on-Banana-Pro.patch new file +35 -0
new file mode 100644
index 000000000..8552daafc
@@ -0,0 +1,35 @@
+From 1647fe31882a105cef4c99770e4ec8ea47c5c653 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <[email protected]>
+Date: Wed, 4 Jan 2017 15:22:50 +0100
+Subject: [PATCH 1/1] ARM: dts: sun7i: Enable audio codec on Banana Pro
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This commit enables the on-chip audio codec present on the A20 SoC
+on the Banana Pro board.
+
+Signed-off-by: J?rg Krause <[email protected]>
+Signed-off-by: Maxime Ripard <[email protected]>
+---
+ arch/arm/boot/dts/sun7i-a20-bananapro.dts | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/arm/boot/dts/sun7i-a20-bananapro.dts b/arch/arm/boot/dts/sun7i-a20-bananapro.dts
+index 19d63d4049de..03799c647e13 100644
+--- a/arch/arm/boot/dts/sun7i-a20-bananapro.dts
++++ b/arch/arm/boot/dts/sun7i-a20-bananapro.dts
+@@ -104,6 +104,10 @@
+ 	status = "okay";
+ };
+ 
++&codec {
++	status = "okay";
++};
++
+ &ehci0 {
+ 	status = "okay";
+ };
+-- 
+2.11.0
+
board/lemaker/bananapro/patches/linux/0002-ARM-dts-sun7i-Add-wifi-dt-node-on-Banana-Pro.patch new file +85 -0

85 lines not on this page · raw message

board/lemaker/bananapro/post-build.sh new file +12 -0
new file mode 100755
index 000000000..fb4b6e99e
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Remove all but the brcmfmac43362 firmware files
+find $TARGET_DIR/lib/firmware/brcm -type f -not -name "brcmfmac43362*" -delete
+
+BOARD_DIR="$(dirname $0)"
+MKIMAGE=$HOST_DIR/usr/bin/mkimage
+BOOT_CMD=$BOARD_DIR/boot.cmd
+BOOT_CMD_H=$BINARIES_DIR/boot.scr
+
+# U-Boot script
+$MKIMAGE -C none -A arm -T script -d $BOOT_CMD $BOOT_CMD_H
board/lemaker/bananapro/post-image.sh new file +16 -0
new file mode 100755
index 000000000..9cca1b178
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                           \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+exit $?
board/lemaker/bananapro/readme.txt new file +71 -0

71 lines not on this page · raw message

board/lemaker/bananapro/rootfs_overlay/lib/firmware/brcm/brcmfmac43362-sdio.txt new file +56 -0

56 lines not on this page · raw message

configs/bananapro_defconfig new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 board: add support for Banana Pro

Hello,

Quoted 5 lines · J?rg Krause

The board support package includes the following components:
- U-Boot 2016.11
- Linux 4.9.3
- packages:
- resize2fs to expand the minimal rootfs

We're not doing this in other defconfigs, so I've removed this. Note that the ext2 options allow you to request the filesystem to be larger than the amount of files to store in it (but we also don't use that in our defconfigs).

Quoted 11 lines
 board/lemaker/bananapro/boot.cmd                   |  5 ++
 board/lemaker/bananapro/genimage.cfg               | 37 ++++++++++
 board/lemaker/bananapro/linux-wifi.fragment        | 23 ++++++
 ...ts-sun7i-Enable-audio-codec-on-Banana-Pro.patch | 35 +++++++++
 ...-dts-sun7i-Add-wifi-dt-node-on-Banana-Pro.patch | 85 ++++++++++++++++++++++
 board/lemaker/bananapro/post-build.sh              | 12 +++
 board/lemaker/bananapro/post-image.sh              | 16 ++++
 board/lemaker/bananapro/readme.txt                 | 71 ++++++++++++++++++
 .../lib/firmware/brcm/brcmfmac43362-sdio.txt       | 56 ++++++++++++++
 configs/bananapro_defconfig                        | 80 ++++++++++++++++++++
 10 files changed, 420 insertions(+)

You forgot to add yourself in the DEVELOPERS file, so I've added that.

Quoted 2 lines
 create mode 100644 board/lemaker/bananapro/patches/linux/0001-ARM-dts-sun7i-Enable-audio-codec-on-Banana-Pro.patch
 create mode 100644 board/lemaker/bananapro/patches/linux/0002-ARM-dts-sun7i-Add-wifi-dt-node-on-Banana-Pro.patch

Don't forget to send a follow-up patch when those are merged upstream, and available in a stable kernel release :)

board/lemaker/bananapro/readme.txt line 45

Quoted 8 lines
board/lemaker/bananapro/readme.txt new file +8 -0
+Resizing the roof filesystem
+============================
+
+By default Buildroot creates a minimal root file system with very
+little free space. You can expand the filesystem using the resize2fs
+tool on the target:
+
+  # resize2fs /dev/mmcblk0p2

I've dropped this paragraph.

configs/bananapro_defconfig line 12

Quoted 3 lines
configs/bananapro_defconfig new file +3 -0
+# Toolchain
+BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y

I didn't see why C++ was needed, so I dropped it. wchar is indeed needed for alsa.

configs/bananapro_defconfig line 68

Quoted 3 lines
configs/bananapro_defconfig new file +3 -0
+# For expanding the root filesystem
+BR2_PACKAGE_E2FSPROGS=y
+BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y

And I've dropped this.

Applied with those fixes. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com