Skip to contentSkip to conversation

configs/mvebu: new defconfig for Turris MOX

PATCH New Vladimir Oltean 2 participants 3 messages Oct 29, 2020 – Oct 31, 2020 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configs/mvebu: new defconfig for Turris MOX

This adds the CZ.NIC Turris MOX Ethernet switch board, which uses a Marvell Armada 3720 SoC (EBU family).

The defconfig builds a sdcard image which can be loaded directly by the "distro boot" enabled U-Boot which is preinstalled in the SPI NOR flash of the board. The boot.scr file is taken directly from the stock OpenWRT system that the board is sold with.

---
 DEVELOPERS                                 |    4 +
 board/mvebu/cznic-turris-mox/boot.cmd      |   28 +
 board/mvebu/cznic-turris-mox/genimage.cfg  |   10 +
 board/mvebu/cznic-turris-mox/mox.config    | 1554 ++++++++++++++++++++
 board/mvebu/cznic-turris-mox/post-build.sh |    3 +
 configs/cznic_turris_mox_defconfig         |   46 +
 6 files changed, 1645 insertions(+)
 create mode 100644 board/mvebu/cznic-turris-mox/boot.cmd
 create mode 100644 board/mvebu/cznic-turris-mox/genimage.cfg
 create mode 100644 board/mvebu/cznic-turris-mox/mox.config
 create mode 100755 board/mvebu/cznic-turris-mox/post-build.sh
 create mode 100644 configs/cznic_turris_mox_defconfig
DEVELOPERS +4 -0
index ceb9cc9160f4..18de19b6c3a9 100644
@@ -2654,6 +2654,10 @@ N:	Vivien Didelot <[email protected]>
 F:	board/technologic/ts5500/
 F:	configs/ts5500_defconfig
 
+N:	Vladimir Oltean <[email protected]>
+F:	board/mvebu/cznic-turris-mox/
+F:	configs/cznic_turris_mox_defconfig
+
 N:	Volkov Viacheslav <[email protected]>
 F:	package/v4l2grab/
 F:	package/zbar/
board/mvebu/cznic-turris-mox/boot.cmd new file +28 -0
new file mode 100644
index 000000000000..fdc81aa94610
@@ -0,0 +1,28 @@
+if part uuid ${devtype} ${devnum}:${distro_bootpart} partuuid; then
+	if test "${bootfstype}" = "btrfs"; then
+		rootflags="commit=5,subvol=@"
+		subvol="/@"
+	else
+		rootflags="commit=5"
+		subvol=""
+	fi
+
+	if load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${subvol}/boot/armada-3720-turris-mox.dtb; then
+		has_dtb=1
+	else
+		setenv has_dtb 0
+		echo "Cannot find device tree binary!"
+	fi
+
+	if test $has_dtb -eq 1; then
+		if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${subvol}/boot/Image; then
+			setenv bootargs "earlyprintk console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000 rootfstype=${bootfstype} root=PARTUUID=${partuuid} rootflags=${rootflags} rootwait ${contract} rw cfg80211.freg=${regdomain}"
+			booti ${kernel_addr_r} - ${fdt_addr_r}
+			echo "Booting Image failed"
+		else
+			echo "Cannot load kernel binary"
+		fi
+	fi
+
+	env delete partuuid
+fi
board/mvebu/cznic-turris-mox/genimage.cfg new file +10 -0
new file mode 100644
index 000000000000..9ce3f00a0761
@@ -0,0 +1,10 @@
+image sdcard.img {
+	hdimage {
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext2"
+		size = 1G
+	}
+}
board/mvebu/cznic-turris-mox/mox.config new file +1554 -0

1,554 lines not on this page · raw message

board/mvebu/cznic-turris-mox/post-build.sh new file +3 -0
new file mode 100755
index 000000000000..808c94e94b57
@@ -0,0 +1,3 @@
+#!/bin/sh
+cp $BINARIES_DIR/boot.scr $TARGET_DIR/boot/boot.scr
+ln -sf boot/boot.scr $TARGET_DIR/boot.scr
configs/cznic_turris_mox_defconfig new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.25.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 1/1 configs/mvebu: new defconfig for Turris MOX

Quoted 2 lines · Marek Behun

Vladimir, is the stock boot.scr okay for buildroot? If you are building only ext2 image, you do not need btrfs root fs flags, for example.

Yes it's ok and I am not using btrfs, I preferred to not modify what I found.

Quoted 5 lines

BTW we updated the stock boot.scr to address some issues, mainly the USB3 comphy issue.

Look at
https://gitlab.nic.cz/turris/turris-os-packages/-/blob/master/hardware/mox/mox-support/files/boot.txt

Aha, is this supposed to fix the boot hang with CONFIG_XHCI_HCD=y? At the moment I left that disabled in the mox.config provided here. If it fixes that issue, it is worth picking up your FDT fixup done in the boot.scr. But what about the mainline DTS file for MOX, can't you just fix that directly?

Quoted 2 lines

I find MOX powerfull enough to run full distro like Gentoo. What usecase do you have for using buildroot there?

I am just using it as my home office switch, with a number of other boards connected to it. I literally need a single init script which sets up the bridging domains and VLAN domains that my boards need, and that's about it. I was also planning to involve it in some 1588/TSN testing with the other boards though.

#3 lore raw

PATCH 1/1 configs/mvebu: new defconfig for Turris MOX

In reply to Vladimir Oltean

Hello Vladimir,

Thanks for this contribution!

Quoted 6 lines · On Thu, 29 Oct 2020 23:56:29 +0200 Vladimir Oltean <[email protected]> wrote:
 DEVELOPERS                                 |    4 +
 board/mvebu/cznic-turris-mox/boot.cmd      |   28 +
 board/mvebu/cznic-turris-mox/genimage.cfg  |   10 +
 board/mvebu/cznic-turris-mox/mox.config    | 1554 ++++++++++++++++++++
 board/mvebu/cznic-turris-mox/post-build.sh |    3 +
 configs/cznic_turris_mox_defconfig         |   46 +

We normally like to have a readme.txt file in board/mvebu/cznic-turris-mox/ to explain how to use the defconfig. Especially how to use the build results on the board. See other readme.txt files in board/.

board/mvebu/cznic-turris-mox/mox.config

Quoted 5 lines
board/mvebu/cznic-turris-mox/mox.config new file +0 -0
new file mode 100644
index 000000000000..07f8b801f3e0

Instead of mox.config, could you call is linux.config or kernel.config ?

Also, this configuration files looks really huge, with lots of useless things. There's really two options there:

- Use the full-blown arm64 defconfig from the upstream kernel, optionally with a small fragment file to add a few more options that are needed for your platform.

- Use a dedicated configuration like you're doing, but in this case, it should be reasonably tweaked to the platform, which clearly isn't the case here.

board/mvebu/cznic-turris-mox/mox.config line 5

Quoted 6 lines
board/mvebu/cznic-turris-mox/mox.config new file +5 -0
@@ -0,0 +1,1554 @@
+CONFIG_ACPI_CPPC_CPUFREQ=y
+CONFIG_ALTERA_FREEZE_BRIDGE=y
+CONFIG_ARMADA_37XX_RWTM_MBOX=y
+CONFIG_ARMADA_37XX_WATCHDOG=y
+CONFIG_ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM=y

Allwinner stuff.

board/mvebu/cznic-turris-mox/mox.config line 6

Quoted 1 line
board/mvebu/cznic-turris-mox/mox.config new file +1 -0
+CONFIG_ARM_IMX_CPUFREQ_DT=y

i.MX stuff.

board/mvebu/cznic-turris-mox/mox.config line 7

Quoted 1 line
board/mvebu/cznic-turris-mox/mox.config new file +1 -0
+CONFIG_ARM_RASPBERRYPI_CPUFREQ=y

RPi stuff.

board/mvebu/cznic-turris-mox/mox.config line 156

Quoted 1 line
board/mvebu/cznic-turris-mox/mox.config new file +1 -0
+CONFIG_DRM=y

DRM for a platform that has no display.

etc.

Quoted 21 lines
board/mvebu/cznic-turris-mox/post-build.sh new file +3 -0
new file mode 100755
index 000000000000..808c94e94b57
@@ -0,0 +1,3 @@
+#!/bin/sh
+cp $BINARIES_DIR/boot.scr $TARGET_DIR/boot/boot.scr
+ln -sf boot/boot.scr $TARGET_DIR/boot.scr
configs/cznic_turris_mox_defconfig new file +6 -0
new file mode 100644
index 000000000000..bd382db1769a
@@ -0,0 +1,46 @@
+# Architecture
+BR2_aarch64=y
+# Armada 3720
+BR2_cortex_a53=y
+
+# Filesystem

configs/cznic_turris_mox_defconfig line 16

Quoted 10 lines
configs/cznic_turris_mox_defconfig new file +10 -0
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="1G"
+BR2_TARGET_ROOTFS_EXT2_4=y
+
+# toolchain
+BR2_TOOLCHAIN=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64=y
+BR2_TOOLCHAIN_USES_GLIBC=y
+BR2_TOOLCHAIN_EXTERNAL_GLIBC=y

Please keep the default toolchain.

configs/cznic_turris_mox_defconfig line 19

Quoted 3 lines
configs/cznic_turris_mox_defconfig new file +3 -0
+
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_LATEST_VERSION=y

Use a fixed kernel version, and not "the latest".

configs/cznic_turris_mox_defconfig line 32

Quoted 13 lines
configs/cznic_turris_mox_defconfig new file +13 -0
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/mvebu/cznic-turris-mox/mox.config"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="marvell/armada-3720-turris-mox"
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/mvebu/cznic-turris-mox/boot.cmd"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/mvebu/cznic-turris-mox/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/mvebu/cznic-turris-mox/genimage.cfg"
+
+BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y

This should be with the rest of the U-Boot boot script options.

configs/cznic_turris_mox_defconfig line 45

Quoted 12 lines
configs/cznic_turris_mox_defconfig new file +12 -0
+# Serial port config
+BR2_TARGET_GENERIC_GETTY=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttyMV0"
+
+# required tools to create the microSD image
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
+
+BR2_TARGET_GENERIC_HOSTNAME="mox"
+
+BR2_USE_MMU=y

Not needed.

configs/cznic_turris_mox_defconfig line 46

Quoted 1 line
configs/cznic_turris_mox_defconfig new file +1 -0
+BR2_USE_WCHAR=y

Ditto.

Could you rework your patch and send an updated version ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com