Skip to contentSkip to conversation

board/broadcom: add support for Northstar platform devices

PATCH Applied Rafał Miłecki 3 participants 3 messages Mar 10, 2022 – Aug 3, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 board/broadcom: add support for Northstar platform devices

From: Rafał Miłecki <[email protected]>

Broadcom Northstar family of SoCs is most commonly used for home routers. It's an ARM platform with Cortex-A9 CPU(s).

All known Northstar devices come with CFE bootloader which almost always expects a TRX firmware format (with exception for D-Link). Some vendors (like Luxul and Netgear) wrap TRX in their own containers.

This board code provides:

1. Minimal kernel with support for on-SoC blocks
It enables Linux drivers for SoC, watchdog, Ethernet, switch, USB, PCIe, LEDs).

2. Post image script building firmware images
In uses Buildroot packages tools (lzma_alone, otrx, lxlfw) to build bootloader-compatible images that can be flashed.

---
Previous attempt:
[PATCH] board/broadcom: add support for Northstar platform devices
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

V2: Update DEVELOPERS
Reduce kernel config
Add readme.txt
Use UBI with ubifs for rootfs (instead of initramfs)

---
 DEVELOPERS                      |  2 +
 board/broadcom/ns/linux.config  | 70 +++++++++++++++++++++++++++++++++
 board/broadcom/ns/post-image.sh | 40 +++++++++++++++++++
 board/broadcom/ns/readme.txt    | 38 ++++++++++++++++++
 configs/broadcom_ns_defconfig   | 14 +++++++
 5 files changed, 164 insertions(+)
 create mode 100644 board/broadcom/ns/linux.config
 create mode 100755 board/broadcom/ns/post-image.sh
 create mode 100644 board/broadcom/ns/readme.txt
 create mode 100644 configs/broadcom_ns_defconfig
DEVELOPERS +2 -0
index 3bc9819382..4d17194af3 100644
@@ -2382,6 +2382,8 @@ F:	board/avnet/s6lx9_microboard/
 F:	configs/s6lx9_microboard_defconfig
 
 N:	Rafał Miłecki <[email protected]>
+F:	board/broadcom/ns/
+F:	configs/broadcom_ns_defconfig
 F:	package/firmware-utils/
 
 N:	Rahul Bedarkar <[email protected]>
board/broadcom/ns/linux.config new file +70 -0

70 lines not on this page · raw message

board/broadcom/ns/post-image.sh new file +40 -0
new file mode 100755
index 0000000000..b6150fc539
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# $1: images directory path
+# $2: device dts filename
+# $3: board id
+build_lxl() {
+	local images="$1"
+	local device="$2"
+	local board="$3"
+
+	$HOST_DIR/bin/lzma_alone e $images/zImage.$device $images/zImage.$device.lzma -d16
+	rm -f $images/zImage.$device
+	$HOST_DIR/bin/otrx create $images/$device.trx -f $images/zImage.$device.lzma -a 0x20000 -f $images/rootfs.ubi
+	rm -f $images/zImage.$device.lzma
+	$HOST_DIR/bin/lxlfw create $images/$device.lxl -i $images/$device.trx -b "$board"
+}
+
+# $1: images directory path
+# $2: device dts filename
+build_trx() {
+	local images="$1"
+	local device="$2"
+
+	$HOST_DIR/bin/lzma_alone e $images/zImage.$device $images/zImage.$device.lzma -d16
+	rm -f $images/zImage.$device
+	$HOST_DIR/bin/otrx create $images/$device.trx -f $images/zImage.$device.lzma -a 0x20000 -f $images/rootfs.ubi
+	rm -f $images/zImage.$device.lzma
+}
+
+devices="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+for device in $devices; do
+	case "$device" in
+		"bcm4708-smartrg-sr400ac")
+			build_trx "$1" "$device"
+			;;
+		"bcm47094-luxul-xwr-3150-v1")
+			build_lxl "$1" "$device" "XWR-3150"
+			;;
+	esac
+done
board/broadcom/ns/readme.txt new file +38 -0
new file mode 100644
index 0000000000..18c9b03c13
@@ -0,0 +1,38 @@
+Broadcom Northstar
+
+Intro
+=====
+
+This readme covers Northstar family of Broadcom SoCs. It includes:
+  - BCM4708 (2 x 800 MHz)
+  - BCM47081 (1 x 800 MHz)
+  - BCM4709 (2 x 1 GHz)
+  - BCM47094 (2 x 1 GHz) (AKA BCM4709C0)
+
+Northstar platform is used in some home routers by multiple vendors. There are
+over 100 market devices based on it and they can all be supported with 1 kernel.
+
+There is no point in having separated board for each model. This board code is
+meant for all supported Northstar devices.
+
+All Northstar devices come with CFE bootloader by default. It's basically closed
+source as sources are available for some old releases only. There is no U-Boot (or
+any other) drop-in replacement or second stage loader with Northstar support.
+
+CFE supports flashing firmware images over TFTP and HTTP (depending on vendor /
+device setup).
+
+How to build it
+===============
+
+  $ make broadcom_ns_defconfig
+
+  $ make
+
+How to flash over HTTP
+======================
+
+Power on device and press (and hold) CTRL+C in serial console terminal. When CFE
+gets into prompt mode it'll automatically start built-in HTTP server. Navigate
+to http://192.168.1.1/ (unless IP was changed - verify with "ifconfig") and
+upload new firmware using a web browser.
configs/broadcom_ns_defconfig new file +14 -0
new file mode 100644
index 0000000000..bba7011aac
@@ -0,0 +1,14 @@
+BR2_arm=y
+BR2_cortex_a9=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/broadcom/ns/post-image.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/broadcom/ns/linux.config"
+BR2_LINUX_KERNEL_APPENDED_ZIMAGE=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm4708-smartrg-sr400ac bcm47094-luxul-xwr-3150-v1"
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_ROOTFS_UBI=y
+BR2_TARGET_ROOTFS_UBI_SUBSIZE=2048
+BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f000
+BR2_PACKAGE_HOST_FIRMWARE_UTILS=y
+BR2_PACKAGE_HOST_LZMA_ALONE=y
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by on v2 1/1
#1 lore raw

Hi Rafał,

Quoted 230 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Broadcom Northstar family of SoCs is most commonly used for home routers. It's an ARM platform with Cortex-A9 CPU(s).

All known Northstar devices come with CFE bootloader which almost always expects a TRX firmware format (with exception for D-Link). Some vendors (like Luxul and Netgear) wrap TRX in their own containers.

This board code provides:

1. Minimal kernel with support for on-SoC blocks
It enables Linux drivers for SoC, watchdog, Ethernet, switch, USB, PCIe, LEDs).

2. Post image script building firmware images
In uses Buildroot packages tools (lzma_alone, otrx, lxlfw) to build bootloader-compatible images that can be flashed.

---
Previous attempt:
[PATCH] board/broadcom: add support for Northstar platform devices
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

V2: Update DEVELOPERS
Reduce kernel config
Add readme.txt
Use UBI with ubifs for rootfs (instead of initramfs)

---
  DEVELOPERS                      |  2 +
  board/broadcom/ns/linux.config  | 70 +++++++++++++++++++++++++++++++++
  board/broadcom/ns/post-image.sh | 40 +++++++++++++++++++
  board/broadcom/ns/readme.txt    | 38 ++++++++++++++++++
  configs/broadcom_ns_defconfig   | 14 +++++++
  5 files changed, 164 insertions(+)

create mode 100644 board/broadcom/ns/linux.config create mode 100755 board/broadcom/ns/post-image.sh create mode 100644 board/broadcom/ns/readme.txt create mode 100644 configs/broadcom_ns_defconfig

DEVELOPERS +2 -0
index 3bc9819382..4d17194af3 100644
@@ -2382,6 +2382,8 @@ F:	board/avnet/s6lx9_microboard/
  F:	configs/s6lx9_microboard_defconfig
 
  N:	Rafał Miłecki <[email protected]>
+F:	board/broadcom/ns/
+F:	configs/broadcom_ns_defconfig
  F:	package/firmware-utils/
 
  N:	Rahul Bedarkar <[email protected]>
board/broadcom/ns/linux.config new file +70 -0
new file mode 100644
index 0000000000..47e6990032
@@ -0,0 +1,70 @@
+CONFIG_EMBEDDED=y
+CONFIG_ARCH_BCM=y
+CONFIG_ARCH_BCM_5301X=y
+CONFIG_ARCH_BCM_53573=y
+CONFIG_SMP=y
+CONFIG_NR_CPUS=2
+CONFIG_HIGHMEM=y
+CONFIG_ARM_APPENDED_DTB=y
+CONFIG_CMDLINE="ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs"
+CONFIG_CMDLINE_FORCE=y
+# CONFIG_SUSPEND is not set
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_BRIDGE=y
+CONFIG_BRIDGE_VLAN_FILTERING=y
+CONFIG_NET_DSA=y
+CONFIG_VLAN_8021Q=y
+CONFIG_PCI=y
+CONFIG_BCM47XX_NVRAM=y
+CONFIG_BCM47XX_SPROM=y
+CONFIG_MTD=y
+CONFIG_MTD_BCM47XX_PARTS=y
+CONFIG_MTD_PARSER_TRX=y
+CONFIG_MTD_BCM47XXSFLASH=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_MTD_NAND_BRCMNAND=y
+CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_UBI=y
+CONFIG_NETDEVICES=y
+CONFIG_VXLAN=y
+CONFIG_VETH=y
+CONFIG_B53=y
+CONFIG_BGMAC_BCMA=y
+CONFIG_BROADCOM_PHY=y
+CONFIG_MDIO_BUS_MUX_MMIOREG=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=2
+CONFIG_SERIAL_8250_RUNTIME_UARTS=2
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_SPI=y
+CONFIG_THERMAL=y
+CONFIG_WATCHDOG=y
+CONFIG_BCM47XX_WDT=y
+CONFIG_BCMA_HOST_SOC=y
+CONFIG_BCMA_DRIVER_GMAC_CMN=y
+CONFIG_BCMA_DRIVER_GPIO=y
+CONFIG_USB=y
+CONFIG_USB_LEDS_TRIGGER_USBPORT=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_PLATFORM=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_HCD_PCI is not set
+CONFIG_USB_HCD_BCMA=y
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+CONFIG_PHY_BCM_NS_USB2=y
+CONFIG_PHY_BCM_NS_USB3=y
+CONFIG_UBIFS_FS=y
+CONFIG_DEBUG_LL=y
+CONFIG_DEBUG_UNCOMPRESS=y
+CONFIG_EARLY_PRINTK=y
board/broadcom/ns/post-image.sh new file +40 -0
new file mode 100755
index 0000000000..b6150fc539
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# $1: images directory path
+# $2: device dts filename
+# $3: board id
+build_lxl() {
+	local images="$1"
+	local device="$2"
+	local board="$3"
+
+	$HOST_DIR/bin/lzma_alone e $images/zImage.$device $images/zImage.$device.lzma -d16
+	rm -f $images/zImage.$device
+	$HOST_DIR/bin/otrx create $images/$device.trx -f $images/zImage.$device.lzma -a 0x20000 -f $images/rootfs.ubi
+	rm -f $images/zImage.$device.lzma
+	$HOST_DIR/bin/lxlfw create $images/$device.lxl -i $images/$device.trx -b "$board"
+}
+
+# $1: images directory path
+# $2: device dts filename
+build_trx() {
+	local images="$1"
+	local device="$2"
+
+	$HOST_DIR/bin/lzma_alone e $images/zImage.$device $images/zImage.$device.lzma -d16
+	rm -f $images/zImage.$device
+	$HOST_DIR/bin/otrx create $images/$device.trx -f $images/zImage.$device.lzma -a 0x20000 -f $images/rootfs.ubi
+	rm -f $images/zImage.$device.lzma
+}
+
+devices="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+for device in $devices; do
+	case "$device" in
+		"bcm4708-smartrg-sr400ac")
+			build_trx "$1" "$device"
+			;;
+		"bcm47094-luxul-xwr-3150-v1")
+			build_lxl "$1" "$device" "XWR-3150"
+			;;
+	esac
+done
board/broadcom/ns/readme.txt new file +38 -0
new file mode 100644
index 0000000000..18c9b03c13
@@ -0,0 +1,38 @@
+Broadcom Northstar
+
+Intro
+=====
+
+This readme covers Northstar family of Broadcom SoCs. It includes:
+  - BCM4708 (2 x 800 MHz)
+  - BCM47081 (1 x 800 MHz)
+  - BCM4709 (2 x 1 GHz)
+  - BCM47094 (2 x 1 GHz) (AKA BCM4709C0)
+
+Northstar platform is used in some home routers by multiple vendors. There are
+over 100 market devices based on it and they can all be supported with 1 kernel.
+
+There is no point in having separated board for each model. This board code is
+meant for all supported Northstar devices.
+
+All Northstar devices come with CFE bootloader by default. It's basically closed
+source as sources are available for some old releases only. There is no U-Boot (or
+any other) drop-in replacement or second stage loader with Northstar support.
+
+CFE supports flashing firmware images over TFTP and HTTP (depending on vendor /
+device setup).
+
+How to build it
+===============
+
+  $ make broadcom_ns_defconfig
+
+  $ make
+
+How to flash over HTTP
+======================
+
+Power on device and press (and hold) CTRL+C in serial console terminal. When CFE
+gets into prompt mode it'll automatically start built-in HTTP server. Navigate
+to http://192.168.1.1/ (unless IP was changed - verify with "ifconfig") and
+upload new firmware using a web browser.
configs/broadcom_ns_defconfig new file +4 -0
new file mode 100644
index 0000000000..bba7011aac
@@ -0,0 +1,14 @@
+BR2_arm=y
+BR2_cortex_a9=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/broadcom/ns/post-image.sh"
+BR2_LINUX_KERNEL=y

configs/broadcom_ns_defconfig line 14

Quoted 10 lines
configs/broadcom_ns_defconfig new file +10 -0
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/broadcom/ns/linux.config"
+BR2_LINUX_KERNEL_APPENDED_ZIMAGE=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm4708-smartrg-sr400ac bcm47094-luxul-xwr-3150-v1"
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_ROOTFS_UBI=y
+BR2_TARGET_ROOTFS_UBI_SUBSIZE=2048
+BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f000
+BR2_PACKAGE_HOST_FIRMWARE_UTILS=y
+BR2_PACKAGE_HOST_LZMA_ALONE=y

I've built broadcom_ns_defconfig successfully using buildroot's utils/docker-run. I don't have a hardware to give a try but everything looks good to me now except I'd like to have 2 URL pointing to 2 different products for the 2 .dts cases:
- bcm4708-smartrg-sr400ac
- bcm47094-luxul-xwr-3150-v1
This because they use 2 different outputs and can help people looking around for support for their Northstar routers, so this can lead to have more people using this support.

Maybe you can provide them in commit log and readme.txt too and with that included:

Best regards

Signature · 6 lines
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Rafał Miłecki
Quoted 19 lines · On Thu, 10 Mar 2022 13:12:29 +0100 Rafał Miłecki <[email protected]> wrote:

From: Rafał Miłecki <[email protected]>

Broadcom Northstar family of SoCs is most commonly used for home routers. It's an ARM platform with Cortex-A9 CPU(s).

All known Northstar devices come with CFE bootloader which almost always expects a TRX firmware format (with exception for D-Link). Some vendors (like Luxul and Netgear) wrap TRX in their own containers.

This board code provides:

1. Minimal kernel with support for on-SoC blocks
It enables Linux drivers for SoC, watchdog, Ethernet, switch, USB, PCIe, LEDs).

2. Post image script building firmware images
In uses Buildroot packages tools (lzma_alone, otrx, lxlfw) to build bootloader-compatible images that can be flashed.

Quoted 5 lines

---
Previous attempt:
[PATCH] board/broadcom: add support for Northstar platform devices
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Applied to master after renaming ns to northstar:
board/broadcom/northstar, configs/broadcom_northstar_defconfig.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot