Skip to contentSkip to conversation

rpi4: add Xenomai building support for RPi4

PATCH Applied Yi Jiang 2 participants 5 messages May 24, 2024 – May 27, 2024

lore
Share & tools
lore

Yi Jiang

author
#0 lore raw

v3 cover rpi4: add Xenomai building support for RPi4

Hi, all,

this is the third version of the series for adding Xenomai building support for RPi4.

Thanks Florian for your comments on v2.

Changelog:
v2 -> v3:
- [PATCH v2 2/3]: Remove rpi4.cfg.

Best regards,
Yi Jiang

Florian Bezdeka (2):
rpi-firmware: Add recipe for building version 20230405
rpi4: Add rpi4 (Raspberry Pi 4) as target platform

Yi Jiang (1):
rpi4: add building options for rpi4; remove build options of old
kernel and Xenomai versions in kas menu for rpi4.

 Kconfig                                       | 14 +++++---
 board-rpi4.yml                                | 15 +++++++++
 conf/machine/rpi4.conf                        | 32 +++++++++++++++++++
 .../rpi-firmware/files/debian/aliases.dts     | 18 +++++++++++
 .../rpi-firmware/files/debian/cmdline.txt     |  1 +
 .../rpi-firmware/files/debian/config.txt      | 12 +++++++
 .../files/debian/rpi-firmware.install         |  9 ++++++
 recipes-bsp/rpi-firmware/files/rules          |  7 ++++
 .../rpi-firmware/rpi-firmware_1.20230405.bb   | 30 +++++++++++++++++
 .../customizations/files/primary.network      |  2 +-
 recipes-kernel/linux/files/arm64_defconfig    | 10 ++++--
 wic/rpi4.wks                                  | 17 ++++++++++
 12 files changed, 159 insertions(+), 8 deletions(-)
 create mode 100644 board-rpi4.yml
 create mode 100644 conf/machine/rpi4.conf
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/aliases.dts
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/cmdline.txt
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/config.txt
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/rpi-firmware.install
 create mode 100644 recipes-bsp/rpi-firmware/files/rules
 create mode 100644 recipes-bsp/rpi-firmware/rpi-firmware_1.20230405.bb
 create mode 100644 wic/rpi4.wks
Signature · 1 line
2.39.2
author
#1 lore raw

PATCH v3 1/3 rpi-firmware: Add recipe for building version 20230405

From: Florian Bezdeka <[email protected]>

Preparation for supporting the Raspberry Pi 4 as target platform.

---
 .../rpi-firmware/files/debian/aliases.dts     | 18 +++++++++++
 .../rpi-firmware/files/debian/cmdline.txt     |  1 +
 .../rpi-firmware/files/debian/config.txt      | 12 ++++++++
 .../files/debian/rpi-firmware.install         |  9 ++++++
 recipes-bsp/rpi-firmware/files/rules          |  7 +++++
 .../rpi-firmware/rpi-firmware_1.20230405.bb   | 30 +++++++++++++++++++
 6 files changed, 77 insertions(+)
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/aliases.dts
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/cmdline.txt
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/config.txt
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/rpi-firmware.install
 create mode 100644 recipes-bsp/rpi-firmware/files/rules
 create mode 100644 recipes-bsp/rpi-firmware/rpi-firmware_1.20230405.bb
recipes-bsp/rpi-firmware/files/debian/aliases.dts new file +18 -0
new file mode 100644
index 0000000..15020d9
@@ -0,0 +1,18 @@
+/*
+ * Xenomai Real-Time System
+ *
+ * Copyright (c) Siemens AG, 2024
+ *
+ * Authors:
+ *  Florian Bezdeka <[email protected]>
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/dts-v1/;
+/plugin/;
+&{/aliases} {
+	/* Ensure stable /dev/mmcblk0 assignment */
+	mmc0 = "/emmc2bus/mmc@7e340000";
+	mmc1 = "/soc/mmc@7e300000";
+};
recipes-bsp/rpi-firmware/files/debian/cmdline.txt new file +1 -0
new file mode 100644
index 0000000..58971c5
@@ -0,0 +1 @@
+module_blacklist=vc4 console=ttyS1,115200 root=/dev/mmcblk0p2 rootwait
recipes-bsp/rpi-firmware/files/debian/config.txt new file +12 -0
new file mode 100644
index 0000000..61eee20
@@ -0,0 +1,12 @@
+dtparam=audio=on
+
+[pi4]
+dtoverlay=vc4-fkms-v3d
+max_framebuffers=2
+
+[all]
+enable_uart=1
+arm_64bit=1
+dtoverlay=aliases
+dtoverlay=dwc2
+initramfs initrd.img followkernel
recipes-bsp/rpi-firmware/files/debian/rpi-firmware.install new file +9 -0
new file mode 100644
index 0000000..28d6cc3
@@ -0,0 +1,9 @@
+boot/bootcode.bin		usr/lib/rpi-firmware/
+boot/LICENCE.broadcom		usr/lib/rpi-firmware/
+boot/*.dat			usr/lib/rpi-firmware/
+boot/*.dtb			usr/lib/rpi-firmware/
+boot/*.elf			usr/lib/rpi-firmware/
+boot/overlays/README		usr/lib/rpi-firmware/overlays/
+boot/overlays/aliases.dtbo	usr/lib/rpi-firmware/overlays/
+debian/cmdline.txt		usr/lib/rpi-firmware/
+debian/config.txt		usr/lib/rpi-firmware/
recipes-bsp/rpi-firmware/files/rules new file +7 -0
new file mode 100644
index 0000000..df0582c
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+override_dh_auto_build:
+	dtc -O dtb -b 0 -@ debian/aliases.dts -o boot/overlays/aliases.dtbo
+
+%:
+	dh $@
recipes-bsp/rpi-firmware/rpi-firmware_1.20230405.bb new file +30 -0
new file mode 100644
index 0000000..1cfb103
@@ -0,0 +1,30 @@
+#
+# Xenomai Real-Time System
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Florian Bezdeka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg
+
+SRC_URI = " \
+    https://github.com/raspberrypi/firmware/archive/${PV}.tar.gz;downloadfilename=${PN}-${PV}.tar.gz \
+    file://debian \
+    file://rules"
+
+SRC_URI[sha256sum] = "08b208bf715d0379a93d38f20aed409cbe2e12c1dc27e3a3794416faefde1aa9"
+
+S = "${WORKDIR}/firmware-${PV}"
+
+DEBIAN_BUILD_DEPENDS = "device-tree-compiler"
+
+do_prepare_build[cleandirs] += "${S}/debian"
+do_prepare_build() {
+    cp -r ${WORKDIR}/debian ${S}
+
+    deb_debianize
+}
Signature · 1 line
2.39.2
author
#2 lore raw

PATCH v3 2/3 rpi4: Add rpi4 (Raspberry Pi 4) as target platform

In reply to Yi Jiang

From: Florian Bezdeka <[email protected]>

---
 board-rpi4.yml                                | 15 +++++++++
 conf/machine/rpi4.conf                        | 32 +++++++++++++++++++
 .../customizations/files/primary.network      |  2 +-
 recipes-kernel/linux/files/arm64_defconfig    | 10 ++++--
 wic/rpi4.wks                                  | 17 ++++++++++
 5 files changed, 72 insertions(+), 4 deletions(-)
 create mode 100644 board-rpi4.yml
 create mode 100644 conf/machine/rpi4.conf
 create mode 100644 wic/rpi4.wks
board-rpi4.yml new file +15 -0
new file mode 100644
index 0000000..debff7a
@@ -0,0 +1,15 @@
+#
+# Xenomai Real-Time System
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Florian Bezdeka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+header:
+  version: 14
+
+machine: rpi4
conf/machine/rpi4.conf new file +32 -0
new file mode 100644
index 0000000..3c0607e
@@ -0,0 +1,32 @@
+#
+# Xenomai Real-Time System
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Florian Bezdeka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+DISTRO_ARCH = "arm64"
+
+IMAGE_FSTYPES ?= "wic"
+IMAGER_BUILD_DEPS = "rpi-firmware linux-image-${KERNEL_NAME}"
+IMAGER_INSTALL += "${IMAGER_BUILD_DEPS}"
+
+IMAGE_BOOT_FILES = " \
+    /usr/lib/rpi-firmware/bootcode.bin;bootcode.bin \
+    /usr/lib/rpi-firmware/cmdline.txt;cmdline.txt \
+    /usr/lib/rpi-firmware/config.txt;config.txt \
+    /usr/lib/rpi-firmware/fixup4.dat;fixup4.dat \
+    /usr/lib/rpi-firmware/fixup4x.dat;fixup4x.dat \
+    /usr/lib/rpi-firmware/start4.elf;start4.elf \
+    /usr/lib/rpi-firmware/start4x.elf;start4x.elf \
+    /usr/lib/rpi-firmware/overlays/*;overlays/ \
+    /usr/lib/linux-image-*/broadcom/bcm2711-rpi-4-b.dtb \
+    /usr/lib/linux-image-*/overlays/*;overlays/ \
+    ${IMAGE_ROOTFS}/vmlinuz;kernel8.img \
+    "
+
+IMAGE_PREINSTALL:append = " firmware-brcm80211"
recipes-core/customizations/files/primary.network +1 -1
index c517d10..2343386 100644
@@ -1,5 +1,5 @@
 [Match]
-Name=eth0 enp2s0 enp3s0
+Name=eth0 enp2s0 enp3s0 end0
 
 [Network]
 DHCP=yes
recipes-kernel/linux/files/arm64_defconfig +7 -3
index 9bacb82..94f7b5b 100644
@@ -603,6 +603,7 @@ CONFIG_FREEZER=y
 # CONFIG_ARCH_ACTIONS is not set
 CONFIG_ARCH_SUNXI=y
 CONFIG_ARCH_ALPINE=y
+CONFIG_ARCH_BCM=y
 CONFIG_ARCH_BCM2835=y
 CONFIG_ARCH_BCM_IPROC=y
 CONFIG_ARCH_BERLIN=y
@@ -704,6 +705,7 @@ CONFIG_PCIE_IPROC_MSI=y
 # CONFIG_PCI_HOST_THUNDER_ECAM is not set
 CONFIG_PCIE_ROCKCHIP=m
 # CONFIG_PCIE_MEDIATEK is not set
+CONFIG_PCIE_BRCMSTB=y
 
 #
 # PCI Endpoint
@@ -1552,7 +1554,7 @@ CONFIG_OF_MDIO=y
 CONFIG_OF_PCI=y
 CONFIG_OF_PCI_IRQ=y
 CONFIG_OF_RESERVED_MEM=y
-# CONFIG_OF_OVERLAY is not set
+CONFIG_OF_OVERLAY=y
 CONFIG_OF_NUMA=y
 # CONFIG_PARPORT is not set
 CONFIG_PNP=y
@@ -1949,7 +1951,7 @@ CONFIG_MACB_USE_HWSTAMP=y
 # CONFIG_MACB_PCI is not set
 CONFIG_NET_VENDOR_BROADCOM=y
 # CONFIG_B44 is not set
-# CONFIG_BCMGENET is not set
+ CONFIG_BCMGENET=y
 # CONFIG_BNX2 is not set
 # CONFIG_CNIC is not set
 # CONFIG_TIGON3 is not set
@@ -2640,7 +2642,7 @@ CONFIG_I2C_ALGOBIT=y
 #
 # I2C system bus drivers (mostly embedded / system-on-chip)
 #
-CONFIG_I2C_BCM2835=m
+CONFIG_I2C_BCM2835=y
 CONFIG_I2C_BCM_IPROC=y
 CONFIG_I2C_BRCMSTB=y
 # CONFIG_I2C_CADENCE is not set
@@ -2880,6 +2882,7 @@ CONFIG_GPIO_GENERIC=y
 # CONFIG_GPIO_ALTERA is not set
 # CONFIG_GPIO_AMDPT is not set
 # CONFIG_GPIO_AXP209 is not set
+CONFIG_GPIO_BCM_XGS_IPROC=y
 CONFIG_GPIO_BRCMSTB=y
 CONFIG_GPIO_DWAPB=y
 # CONFIG_GPIO_EXAR is not set
@@ -5473,6 +5476,7 @@ CONFIG_PHY_MESON_GXL_USB2=y
 # CONFIG_BCM_KONA_USB2_PHY is not set
 # CONFIG_PHY_BCM_NS_USB2 is not set
 # CONFIG_PHY_BCM_NS_USB3 is not set
+CONFIG_PHY_BCM_SR_USB=y
 CONFIG_PHY_NS2_PCIE=y
 CONFIG_PHY_NS2_USB_DRD=y
 CONFIG_PHY_BRCM_SATA=y
wic/rpi4.wks new file +17 -0
new file mode 100644
index 0000000..22eeb87
@@ -0,0 +1,17 @@
+#
+# Xenomai Real-Time System
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Florian Bezdeka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+part --source bootimg-partition --ondisk mmcblk0 --fstype vfat --label boot --align 1 --size 128 --overhead-factor 1 --extra-space 0
+
+part / --source rootfs --ondisk mmcblk0 --fstype ext4 --mkfs-extraopts "-T default" --label platform --align 1024 --active
+
+# silence wic
+bootloader
Signature · 1 line
2.39.2
author
#3 lore raw

PATCH v3 3/3 rpi4: add building options for rpi4; remove build options of old kernel and Xenomai versions in kas menu for rpi4.

In reply to Yi Jiang

For RPi4, the following building option of kernel version is not supported any more. Therefore, it is removed from kas menu.

- Xenomai 3, Head of stable/v3.1.x branch.

For RPi4, the following building options of Xenomai versions are not supported any more. Therefore, they are removed from kas menu.

- Xenomai 3, Latest 4.19-cip I-pipe release;
- Xenomai 3, Head of 4.19-cip I-pipe branch;
- Xenomai 3, Latest 5.4 I-pipe release;
- Xenomai 3, Head of 5.4 I-pipe branch.

---
 Kconfig | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
Kconfig +10 -4
index 669ea65..13699bf 100644
@@ -45,6 +45,10 @@ config TARGET_HIKEY
 	bool "LeMaker HiKey"
 	select ARCH_ARM64
 
+config TARGET_RPI4
+	bool "Raspberry Pi 4"
+	select ARCH_ARM64
+
 endchoice
 
 config KAS_INCLUDE_TARGET
@@ -55,6 +59,7 @@ config KAS_INCLUDE_TARGET
 	default "board-beagle-bone-black.yml" if TARGET_BBB
 	default "board-qemu-arm64.yml" if TARGET_QEMU_ARM64
 	default "board-hikey.yml" if TARGET_HIKEY
+	default "board-rpi4.yml" if TARGET_RPI4
 
 choice
 	prompt "Xenomai version"
@@ -85,6 +90,7 @@ config XENOMAI_3_2
 
 config XENOMAI_3_1_LATEST
 	bool "Head of stable/v3.1.x branch"
+	depends on !TARGET_RPI4
 
 config XENOMAI_3_0_LATEST
 	bool "Head of stable/v3.0.x branch"
@@ -141,19 +147,19 @@ config KERNEL_5_10
 
 config KERNEL_5_4_LATEST
 	bool "Head of 5.4 I-pipe branch"
-	depends on XENOMAI_3_2_LATEST || XENOMAI_3_2 || XENOMAI_3_1_LATEST || XENOMAI_3_1
+	depends on !TARGET_RPI4 && (XENOMAI_3_2_LATEST || XENOMAI_3_2 || XENOMAI_3_1_LATEST || XENOMAI_3_1)
 
 config KERNEL_5_4
 	bool "Latest 5.4 I-pipe release"
-	depends on XENOMAI_3_2_LATEST || XENOMAI_3_2 || XENOMAI_3_1_LATEST || XENOMAI_3_1
+	depends on !TARGET_RPI4 && (XENOMAI_3_2_LATEST || XENOMAI_3_2 || XENOMAI_3_1_LATEST || XENOMAI_3_1)
 
 config KERNEL_4_19_LATEST
 	bool "Head of 4.19-cip I-pipe branch"
-	depends on XENOMAI_3_2_LATEST || XENOMAI_3_2 || XENOMAI_3_1_LATEST || XENOMAI_3_1
+	depends on !TARGET_RPI4 && (XENOMAI_3_2_LATEST || XENOMAI_3_2 || XENOMAI_3_1_LATEST || XENOMAI_3_1)
 
 config KERNEL_4_19
 	bool "Latest 4.19-cip I-pipe release"
-	depends on XENOMAI_3_2_LATEST || XENOMAI_3_2 || XENOMAI_3_1_LATEST || XENOMAI_3_1
+	depends on !TARGET_RPI4 && (XENOMAI_3_2_LATEST || XENOMAI_3_2 || XENOMAI_3_1_LATEST || XENOMAI_3_1)
 
 config KERNEL_4_4_LATEST
 	bool "Head of 4.4-cip I-pipe branch"
Signature · 1 line
2.39.2
Applied
#4 lore raw
In reply to Yi Jiang
Quoted 36 lines · Yi Jiang

Hi, all,

this is the third version of the series for adding Xenomai building support for RPi4.

Thanks Florian for your comments on v2.

Changelog:
v2 -> v3:
- [PATCH v2 2/3]: Remove rpi4.cfg.

Best regards,
Yi Jiang

Florian Bezdeka (2):
rpi-firmware: Add recipe for building version 20230405
rpi4: Add rpi4 (Raspberry Pi 4) as target platform

Yi Jiang (1):
rpi4: add building options for rpi4; remove build options of old
kernel and Xenomai versions in kas menu for rpi4.

 Kconfig                                       | 14 +++++---
 board-rpi4.yml                                | 15 +++++++++
 conf/machine/rpi4.conf                        | 32 +++++++++++++++++++
 .../rpi-firmware/files/debian/aliases.dts     | 18 +++++++++++
 .../rpi-firmware/files/debian/cmdline.txt     |  1 +
 .../rpi-firmware/files/debian/config.txt      | 12 +++++++
 .../files/debian/rpi-firmware.install         |  9 ++++++
 recipes-bsp/rpi-firmware/files/rules          |  7 ++++
 .../rpi-firmware/rpi-firmware_1.20230405.bb   | 30 +++++++++++++++++
 .../customizations/files/primary.network      |  2 +-
 recipes-kernel/linux/files/arm64_defconfig    | 10 ++++--
 wic/rpi4.wks                                  | 17 ++++++++++
 12 files changed, 159 insertions(+), 8 deletions(-)
 create mode 100644 board-rpi4.yml
Quoted 9 lines
 create mode 100644 conf/machine/rpi4.conf
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/aliases.dts
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/cmdline.txt
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/config.txt
 create mode 100644 recipes-bsp/rpi-firmware/files/debian/rpi-firmware.install
 create mode 100644 recipes-bsp/rpi-firmware/files/rules
 create mode 100644 recipes-bsp/rpi-firmware/rpi-firmware_1.20230405.bb
 create mode 100644 wic/rpi4.wks

Thanks, applied.

I've massaged the subject and commit message of patch 3 to the point what I prefer in this case: On the point, explaining why the extra rules are needed in kconfig.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center