* [Buildroot] [PATCH] board/broadcom: add support for Northstar platform devices
@ 2021-08-10 13:12 Rafał Miłecki
2021-08-10 14:01 ` Baruch Siach
2021-08-19 21:39 ` Thomas Petazzoni
0 siblings, 2 replies; 4+ messages in thread
From: Rafał Miłecki @ 2021-08-10 13:12 UTC (permalink / raw)
To: buildroot; +Cc: Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
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 the D-Link). Some
vendors (like Luxul and Netgear) wrap TRX in their own containers.
For above reason a plain kernel and rootfs are useless for flashing
purposes. CFE requires TRX(-like) format and there isn't any CFE
replacement. Another issue is lack for DTS support in CFE.
That's why for this board there is post-image script building device
specific images. It takes care of appending DTB to the kernel and
putting everything in a TRX image.
Kernel config was adjusted to provide minimal support all on-SoC blocks
(like Ethernet, switch, USB, PCIe). For rootfs this boards adds network
config that setups interfaces making device accessible over the network.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
board/broadcom/ns/linux.config | 115 ++++++++++++++++++
board/broadcom/ns/post-image.sh | 43 +++++++
.../ns/rootfs_overlay/etc/init.d/S39network | 6 +
.../etc/network/interfaces.luxul,xap-1610-v1 | 24 ++++
.../etc/network/interfaces.luxul,xwr-3150-v1 | 49 ++++++++
.../etc/network/interfaces.smartrg,sr400ac | 49 ++++++++
configs/broadcom_ns_defconfig | 22 ++++
7 files changed, 308 insertions(+)
create mode 100644 board/broadcom/ns/linux.config
create mode 100755 board/broadcom/ns/post-image.sh
create mode 100755 board/broadcom/ns/rootfs_overlay/etc/init.d/S39network
create mode 100644 board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xap-1610-v1
create mode 100644 board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xwr-3150-v1
create mode 100644 board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.smartrg,sr400ac
create mode 100644 configs/broadcom_ns_defconfig
diff --git a/board/broadcom/ns/linux.config b/board/broadcom/ns/linux.config
new file mode 100644
index 0000000000..1737e1d81a
--- /dev/null
+++ b/board/broadcom/ns/linux.config
@@ -0,0 +1,115 @@
+CONFIG_KERNEL_XZ=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE="${BR_BINARIES_DIR}/rootfs.cpio"
+CONFIG_INITRAMFS_COMPRESSION_ZSTD=y
+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_SUSPEND is not set
+CONFIG_BCM47XX_NVRAM=y
+CONFIG_BCM47XX_SPROM=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+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_PCIE_IPROC_PLATFORM is not set
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_MTD=y
+CONFIG_MTD_BCM47XX_PARTS=y
+CONFIG_MTD_PARSER_TRX=y
+CONFIG_MTD_BLOCK=y
+CONFIG_MTD_BCM47XXSFLASH=y
+CONFIG_MTD_SPI_NOR=y
+# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_BLOCK=y
+CONFIG_NETDEVICES=y
+CONFIG_VXLAN=m
+CONFIG_VETH=m
+CONFIG_B53=y
+CONFIG_BGMAC_BCMA=y
+# CONFIG_BGMAC_PLATFORM is not set
+CONFIG_BROADCOM_PHY=y
+# CONFIG_MDIO_BUS_MUX_BCM_IPROC is not set
+CONFIG_MDIO_BUS_MUX_MMIOREG=y
+# CONFIG_USB_NET_DRIVERS is not set
+# CONFIG_WLAN_VENDOR_ADMTEK is not set
+# CONFIG_WLAN_VENDOR_ATH is not set
+# CONFIG_WLAN_VENDOR_ATMEL is not set
+# CONFIG_WLAN_VENDOR_BROADCOM 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
+# CONFIG_WLAN_VENDOR_QUANTENNA is not set
+# CONFIG_INPUT is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+# CONFIG_LEGACY_PTYS is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+# CONFIG_SERIAL_8250_PCI is not set
+CONFIG_SERIAL_8250_NR_UARTS=2
+CONFIG_SERIAL_8250_RUNTIME_UARTS=2
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_HW_RANDOM=y
+CONFIG_SPI=y
+# CONFIG_PINCTRL_IPROC_GPIO is not set
+CONFIG_GPIO_SYSFS=y
+CONFIG_GPIO_74X164=y
+CONFIG_POWER_SUPPLY=y
+# CONFIG_HWMON is not set
+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_VGA_ARB is not set
+CONFIG_USB=m
+CONFIG_USB_LEDS_TRIGGER_USBPORT=m
+CONFIG_USB_XHCI_HCD=m
+CONFIG_USB_XHCI_PLATFORM=m
+CONFIG_USB_EHCI_HCD=m
+CONFIG_USB_OHCI_HCD=m
+# CONFIG_USB_OHCI_HCD_PCI is not set
+CONFIG_USB_HCD_BCMA=m
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_BRIGHTNESS_HW_CHANGED=y
+CONFIG_LEDS_GPIO=m
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=m
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+CONFIG_LEDS_TRIGGER_NETDEV=y
+# CONFIG_CLK_BCM_NS2 is not set
+# CONFIG_CLK_BCM_SR is not set
+CONFIG_PHY_BCM_NS_USB2=m
+CONFIG_PHY_BCM_NS_USB3=m
+# CONFIG_PHY_NS2_USB_DRD is not set
+# CONFIG_PHY_BRCM_SATA is not set
+CONFIG_CRYPTO=y
+CONFIG_DEBUG_LL=y
+CONFIG_DEBUG_UNCOMPRESS=y
+CONFIG_EARLY_PRINTK=y
diff --git a/board/broadcom/ns/post-image.sh b/board/broadcom/ns/post-image.sh
new file mode 100755
index 0000000000..34856991a6
--- /dev/null
+++ b/board/broadcom/ns/post-image.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# $1: images directory path
+# $2: device dts filename
+# $3: board id
+build_lxl() {
+ local images="$1"
+ local device="$2"
+ local board="$3"
+
+ 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
+ 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"
+
+ 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
+ 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-xap-1610")
+ build_lxl "$1" "$device" "XAP-1610"
+ ;;
+ "bcm47094-luxul-xwr-3150-v1")
+ build_lxl "$1" "$device" "XWR-3150"
+ ;;
+ esac
+done
diff --git a/board/broadcom/ns/rootfs_overlay/etc/init.d/S39network b/board/broadcom/ns/rootfs_overlay/etc/init.d/S39network
new file mode 100755
index 0000000000..a8098d2ab4
--- /dev/null
+++ b/board/broadcom/ns/rootfs_overlay/etc/init.d/S39network
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+machine="$(cat /proc/device-tree/compatible | tr '\0' '\t' | cut -f 1)"
+
+interfaces="/usr/local/etc/network/interfaces.$machine"
+[ -f "$interfaces" ] && cp "$interfaces" /etc/network/interfaces
diff --git a/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xap-1610-v1 b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xap-1610-v1
new file mode 100644
index 0000000000..bf766044b4
--- /dev/null
+++ b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xap-1610-v1
@@ -0,0 +1,24 @@
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto poe
+iface poe inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto lan
+iface lan inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto br0
+iface br0 inet dhcp
+ pre-up ip link add br0 type bridge
+ pre-up ip link set poe master br0
+ pre-up ip link set lan master br0
+ post-down ip link delete br0 type bridge
diff --git a/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xwr-3150-v1 b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xwr-3150-v1
new file mode 100644
index 0000000000..d53fb4b5d6
--- /dev/null
+++ b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xwr-3150-v1
@@ -0,0 +1,49 @@
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto wan
+iface wan inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto lan1
+iface lan1 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto lan2
+iface lan2 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto lan3
+iface lan3 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto lan4
+iface lan4 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto br-wan
+iface br-wan inet dhcp
+ pre-up ip link add br-wan type bridge
+ pre-up ip link set wan master br-wan
+ post-down ip link delete br-wan type bridge
+
+auto br-lan
+iface br-lan inet static
+ address 192.168.1.1
+ netmask 255.255.255.0
+ pre-up ip link add br-lan type bridge
+ pre-up ip link set lan1 master br-lan
+ pre-up ip link set lan2 master br-lan
+ pre-up ip link set lan3 master br-lan
+ pre-up ip link set lan4 master br-lan
+ post-down ip link delete br-lan type bridge
diff --git a/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.smartrg,sr400ac b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.smartrg,sr400ac
new file mode 100644
index 0000000000..d53fb4b5d6
--- /dev/null
+++ b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.smartrg,sr400ac
@@ -0,0 +1,49 @@
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto wan
+iface wan inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto lan1
+iface lan1 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto lan2
+iface lan2 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto lan3
+iface lan3 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto lan4
+iface lan4 inet static
+ address 0.0.0.0
+ netmask 255.255.255.0
+
+auto br-wan
+iface br-wan inet dhcp
+ pre-up ip link add br-wan type bridge
+ pre-up ip link set wan master br-wan
+ post-down ip link delete br-wan type bridge
+
+auto br-lan
+iface br-lan inet static
+ address 192.168.1.1
+ netmask 255.255.255.0
+ pre-up ip link add br-lan type bridge
+ pre-up ip link set lan1 master br-lan
+ pre-up ip link set lan2 master br-lan
+ pre-up ip link set lan3 master br-lan
+ pre-up ip link set lan4 master br-lan
+ post-down ip link delete br-lan type bridge
diff --git a/configs/broadcom_ns_defconfig b/configs/broadcom_ns_defconfig
new file mode 100644
index 0000000000..b68de2e093
--- /dev/null
+++ b/configs/broadcom_ns_defconfig
@@ -0,0 +1,22 @@
+BR2_arm=y
+BR2_cortex_a9=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
+BR2_ROOTFS_OVERLAY="board/broadcom/ns/rootfs_overlay"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/broadcom/ns/post-image.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.57"
+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_XZ=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm4708-smartrg-sr400ac bcm47094-luxul-xap-1610 bcm47094-luxul-xwr-3150-v1"
+BR2_PACKAGE_MTD=y
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM4366C0=y
+BR2_PACKAGE_BRIDGE_UTILS=y
+BR2_PACKAGE_DROPBEAR=y
+BR2_TARGET_ROOTFS_INITRAMFS=y
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_PACKAGE_HOST_FIRMWARE_UTILS=y
--
2.26.2
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] board/broadcom: add support for Northstar platform devices
2021-08-10 13:12 [Buildroot] [PATCH] board/broadcom: add support for Northstar platform devices Rafał Miłecki
@ 2021-08-10 14:01 ` Baruch Siach
2021-08-10 14:04 ` Rafał Miłecki
2021-08-19 21:39 ` Thomas Petazzoni
1 sibling, 1 reply; 4+ messages in thread
From: Baruch Siach @ 2021-08-10 14:01 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: Rafał Miłecki, buildroot
Hi Rafał,
on Tue, Aug 10 2021, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> 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 the D-Link). Some
> vendors (like Luxul and Netgear) wrap TRX in their own containers.
>
> For above reason a plain kernel and rootfs are useless for flashing
> purposes. CFE requires TRX(-like) format and there isn't any CFE
> replacement. Another issue is lack for DTS support in CFE.
> That's why for this board there is post-image script building device
> specific images. It takes care of appending DTB to the kernel and
> putting everything in a TRX image.
>
> Kernel config was adjusted to provide minimal support all on-SoC blocks
> (like Ethernet, switch, USB, PCIe). For rootfs this boards adds network
> config that setups interfaces making device accessible over the network.
>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
[meta-patch text goes here]
> +++ b/board/broadcom/ns/post-image.sh
> @@ -0,0 +1,43 @@
> +#!/bin/sh
> +
> +# $1: images directory path
> +# $2: device dts filename
> +# $3: board id
> +build_lxl() {
> + local images="$1"
> + local device="$2"
> + local board="$3"
> +
> + 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
> + 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"
> +
> + 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
Is this utility part of the firmware-utils host package? I see that
defconfig selects BR2_PACKAGE_HOST_FIRMWARE_UTILS which is not in
current Buildroot master. So this patch depends on the patch
"package/firmware-utils: add package":
http://patchwork.ozlabs.org/project/buildroot/patch/20210809144144.30105-1-zajec5@gmail.com/
You should mentions that in the meta-patch part of the email (see
above).
baruch
> + 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-xap-1610")
> + build_lxl "$1" "$device" "XAP-1610"
> + ;;
> + "bcm47094-luxul-xwr-3150-v1")
> + build_lxl "$1" "$device" "XWR-3150"
> + ;;
> + esac
> +done
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] board/broadcom: add support for Northstar platform devices
2021-08-10 14:01 ` Baruch Siach
@ 2021-08-10 14:04 ` Rafał Miłecki
0 siblings, 0 replies; 4+ messages in thread
From: Rafał Miłecki @ 2021-08-10 14:04 UTC (permalink / raw)
To: Baruch Siach; +Cc: Rafał Miłecki, buildroot
On 10.08.2021 16:01, Baruch Siach wrote:
> on Tue, Aug 10 2021, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> 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 the D-Link). Some
>> vendors (like Luxul and Netgear) wrap TRX in their own containers.
>>
>> For above reason a plain kernel and rootfs are useless for flashing
>> purposes. CFE requires TRX(-like) format and there isn't any CFE
>> replacement. Another issue is lack for DTS support in CFE.
>> That's why for this board there is post-image script building device
>> specific images. It takes care of appending DTB to the kernel and
>> putting everything in a TRX image.
>>
>> Kernel config was adjusted to provide minimal support all on-SoC blocks
>> (like Ethernet, switch, USB, PCIe). For rootfs this boards adds network
>> config that setups interfaces making device accessible over the network.
>>
>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>> ---
>
> [meta-patch text goes here]
>
>> +++ b/board/broadcom/ns/post-image.sh
>> @@ -0,0 +1,43 @@
>> +#!/bin/sh
>> +
>> +# $1: images directory path
>> +# $2: device dts filename
>> +# $3: board id
>> +build_lxl() {
>> + local images="$1"
>> + local device="$2"
>> + local board="$3"
>> +
>> + 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
>> + 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"
>> +
>> + 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
>
> Is this utility part of the firmware-utils host package? I see that
> defconfig selects BR2_PACKAGE_HOST_FIRMWARE_UTILS which is not in
> current Buildroot master. So this patch depends on the patch
> "package/firmware-utils: add package":
>
> http://patchwork.ozlabs.org/project/buildroot/patch/20210809144144.30105-1-zajec5@gmail.com/
>
> You should mentions that in the meta-patch part of the email (see
> above).
That's correct, sorry for not describing that dependency.
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] board/broadcom: add support for Northstar platform devices
2021-08-10 13:12 [Buildroot] [PATCH] board/broadcom: add support for Northstar platform devices Rafał Miłecki
2021-08-10 14:01 ` Baruch Siach
@ 2021-08-19 21:39 ` Thomas Petazzoni
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2021-08-19 21:39 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: Rafał Miłecki, buildroot
Hello Rafał,
Thanks for this proposal!
On Tue, 10 Aug 2021 15:12:36 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> 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 the D-Link). Some
> vendors (like Luxul and Netgear) wrap TRX in their own containers.
>
> For above reason a plain kernel and rootfs are useless for flashing
> purposes. CFE requires TRX(-like) format and there isn't any CFE
> replacement. Another issue is lack for DTS support in CFE.
> That's why for this board there is post-image script building device
> specific images. It takes care of appending DTB to the kernel and
> putting everything in a TRX image.
Is this also the reason why an initramfs is used, instead of a separated
rootfs?
> board/broadcom/ns/linux.config | 115 ++++++++++++++++++
> board/broadcom/ns/post-image.sh | 43 +++++++
> .../ns/rootfs_overlay/etc/init.d/S39network | 6 +
> .../etc/network/interfaces.luxul,xap-1610-v1 | 24 ++++
> .../etc/network/interfaces.luxul,xwr-3150-v1 | 49 ++++++++
> .../etc/network/interfaces.smartrg,sr400ac | 49 ++++++++
> configs/broadcom_ns_defconfig | 22 ++++
> 7 files changed, 308 insertions(+)
We also need board/broadcom/ns/readme.txt that explains how to use this
defconfig (see other readme.txt files in board/). And we also need an
update to the DEVELOPERS file to associate you with this defconfig and
board/broadcom/ns/ folder.
> diff --git a/board/broadcom/ns/linux.config b/board/broadcom/ns/linux.config
> new file mode 100644
> index 0000000000..1737e1d81a
> --- /dev/null
> +++ b/board/broadcom/ns/linux.config
> @@ -0,0 +1,115 @@
> +CONFIG_KERNEL_XZ=y
> +CONFIG_BLK_DEV_INITRD=y
> +CONFIG_INITRAMFS_SOURCE="${BR_BINARIES_DIR}/rootfs.cpio"
This should not be needed, as it's added by Buildroot.
> diff --git a/board/broadcom/ns/post-image.sh b/board/broadcom/ns/post-image.sh
> new file mode 100755
> index 0000000000..34856991a6
> --- /dev/null
> +++ b/board/broadcom/ns/post-image.sh
> @@ -0,0 +1,43 @@
> +#!/bin/sh
> +
> +# $1: images directory path
> +# $2: device dts filename
> +# $3: board id
> +build_lxl() {
> + local images="$1"
> + local device="$2"
> + local board="$3"
> +
> + lzma-alone e $images/zImage.$device $images/zImage.$device.lzma -d16
I don't have lzma-alone on my system, so it means that this tool should
probably be built by a Buildroot host package, as it's not necessarily
installed on the developer machine.
> + rm -f $images/zImage.$device
> + $HOST_DIR/bin/otrx create $images/$device.trx -f $images/zImage.$device.lzma
> + 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"
> +
> + 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
> + 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-xap-1610")
> + build_lxl "$1" "$device" "XAP-1610"
> + ;;
> + "bcm47094-luxul-xwr-3150-v1")
> + build_lxl "$1" "$device" "XWR-3150"
> + ;;
> + esac
> +done
Hm, so this defconfig in fact targets a family of devices. Buildroot
defconfigs normally target a single device. But I see the point here,
so perhaps we should leave it as you propose.
> diff --git a/board/broadcom/ns/rootfs_overlay/etc/init.d/S39network b/board/broadcom/ns/rootfs_overlay/etc/init.d/S39network
> new file mode 100755
> index 0000000000..a8098d2ab4
> --- /dev/null
> +++ b/board/broadcom/ns/rootfs_overlay/etc/init.d/S39network
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +
> +machine="$(cat /proc/device-tree/compatible | tr '\0' '\t' | cut -f 1)"
> +
> +interfaces="/usr/local/etc/network/interfaces.$machine"
> +[ -f "$interfaces" ] && cp "$interfaces" /etc/network/interfaces
> diff --git a/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xap-1610-v1 b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xap-1610-v1
> new file mode 100644
> index 0000000000..bf766044b4
> --- /dev/null
> +++ b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xap-1610-v1
[...]
> diff --git a/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xwr-3150-v1 b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.luxul,xwr-3150-v1
[...]
> diff --git a/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.smartrg,sr400ac b/board/broadcom/ns/rootfs_overlay/usr/local/etc/network/interfaces.smartrg,sr400ac
I am not sure how much we want those quite specific network
configuration files in Buildroot itself. Shouldn't we leave that up to
the user? Those example files use 0.0.0.0 as a static IP address for
all interfaces, which isn't going to be very useful in practice I guess.
> diff --git a/configs/broadcom_ns_defconfig b/configs/broadcom_ns_defconfig
> new file mode 100644
> index 0000000000..b68de2e093
> --- /dev/null
> +++ b/configs/broadcom_ns_defconfig
> @@ -0,0 +1,22 @@
> +BR2_arm=y
> +BR2_cortex_a9=y
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
> +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
Needed for ?
> +BR2_ROOTFS_OVERLAY="board/broadcom/ns/rootfs_overlay"
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/broadcom/ns/post-image.sh"
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.57"
> +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_XZ=y
> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm4708-smartrg-sr400ac bcm47094-luxul-xap-1610 bcm47094-luxul-xwr-3150-v1"
> +BR2_PACKAGE_MTD=y
Not needed.
> +BR2_PACKAGE_LINUX_FIRMWARE=y
> +BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM4366C0=y
> +BR2_PACKAGE_BRIDGE_UTILS=y
Most likely not needed if we drop the network configuration files.
> +BR2_PACKAGE_DROPBEAR=y
Not needed (we want defconfigs to be minimal)
> +BR2_TARGET_ROOTFS_INITRAMFS=y
> +# BR2_TARGET_ROOTFS_TAR is not set
> +BR2_PACKAGE_HOST_FIRMWARE_UTILS=y
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-19 21:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 13:12 [Buildroot] [PATCH] board/broadcom: add support for Northstar platform devices Rafał Miłecki
2021-08-10 14:01 ` Baruch Siach
2021-08-10 14:04 ` Rafał Miłecki
2021-08-19 21:39 ` Thomas Petazzoni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.