Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] rpi-*: update and support rpi5
@ 2023-11-18  4:01 classabbyamp
  2023-11-18  4:02 ` [PR PATCH] [Updated] " classabbyamp
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: classabbyamp @ 2023-11-18  4:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

There is a new pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages rpi5
https://github.com/void-linux/void-packages/pull/47288

rpi-*: update and support rpi5
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES** (RPi5 glibc so far)

prebuilt packages and RPi5-compatible install images coming soon


A patch file from https://github.com/void-linux/void-packages/pull/47288.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi5-47288.patch --]
[-- Type: text/x-diff, Size: 21806 bytes --]

From cdaa7b93256d481a0678a7c2de9baa3336133a33 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:48:03 -0500
Subject: [PATCH 1/4] rpi-kernel: update to 6.1.62.

- add rpi5 support and optimised kernel
- add support for BTRFS root
- add /proc/config.gz by default
---
 srcpkgs/rpi-kernel/template | 221 +++++++++++++++++++++++-------------
 srcpkgs/rpi5-kernel         |   1 +
 srcpkgs/rpi5-kernel-headers |   1 +
 3 files changed, 143 insertions(+), 80 deletions(-)
 create mode 120000 srcpkgs/rpi5-kernel
 create mode 120000 srcpkgs/rpi5-kernel-headers

diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 2fa1bb54b683e..d90257a9a044b 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -12,9 +12,9 @@
 #
 # Upstream documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html
 pkgname=rpi-kernel
-version=6.1.54
+version=6.1.62
 revision=1
-_githash=fad58933544bb2a7b7db92847c25c79a83171fa6
+_githash=3fdb0eb8be5803a16fc308b8441cdcdeafbb944e
 archs="armv6l* armv7l* aarch64*"
 hostmakedepends="perl kmod uboot-mkimage openssl-devel bc bison flex xz"
 makedepends="ncurses-devel"
@@ -23,8 +23,10 @@ maintainer="Piraty <mail@piraty.dev>"
 license="GPL-2.0-only"
 homepage="http://www.kernel.org"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
-checksum=1bd02902fae49351fb16ac0d5ccc3bf4d67aa0640006dbbf8846963519b01ab8
+checksum=a44b7d642fc2d80a8cfd05d0b461ecbff019680932754b3f9190bb22be9b8fe2
 python_version=3
+provides="rpi-kernel-${version}_${revision}"
+replaces="rpi5-kernel>=0"
 
 _kernver="${version}_${revision}"
 
@@ -51,28 +53,20 @@ case "$XBPS_TARGET_MACHINE" in
 	*) broken="No Raspberry Pi exists for this arch" ;;
 esac
 
+make_build_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+make_install_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+
 if [ "$CROSS_BUILD" ]; then
-	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
-else
-	_cross=
+	make_build_args+=("CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-")
 fi
 
-do_configure() {
-	local target defconfig
-
-	case "$XBPS_TARGET_MACHINE" in
-		# for zero, 1
-		armv6l*) target=bcmrpi_defconfig ;;
-		# for 2
-		armv7l*) target=bcm2709_defconfig ;;
-		# for 3, 4, zero 2
-		aarch64*) target=bcm2711_defconfig ;;
-	esac
+_configure() {
+	local target="$1" defconfig
 
 	defconfig="arch/${_arch}/configs/${target}"
 	cp "$defconfig" .config
 
-	cat <<-! > "foo"
+	cat <<-! > void.config
 	CONFIG_CONNECTOR=y
 	CONFIG_HID_STEAM=y
 	CONFIG_PROC_EVENTS=y
@@ -113,15 +107,19 @@ do_configure() {
 	CONFIG_LZ4_COMPRESS=y
 	CONFIG_CRYPTO_RNG=y
 	CONFIG_CRYPTO_RNG_DEFAULT=y
+	CONFIG_BTRFS_FS=y
+	CONFIG_BTRFS_POSIX_ACL=y
+	CONFIG_IKCONFIG_PROC=y
 	!
 
 	while read -r line; do
+		local option="" str="" cmd=""
 		# skip comments
 		case "$line" in
 			"#"*) continue;;
 		esac
-		local option=${line%%=*} str=
-		local cmd="$(echo "$line" | cut -d= -f2)"
+		option="${line%%=*}"
+		cmd="$(echo "$line" | cut -d= -f2)"
 		case "$cmd" in
 			y) cmd="enable";;
 			n) cmd="disable";;
@@ -135,31 +133,27 @@ do_configure() {
 		./scripts/config \
 			--file .config \
 			"--$cmd" "$option" "${str//\"/}"
-	done < foo
+	done < void.config
 
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" olddefconfig
+	make "${make_build_args[@]}" olddefconfig
 }
 
-do_build() {
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" prepare
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" "${_image_target}" modules dtbs
-}
-
-do_install() {
-	local hdrdest="${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}"
+_install() {
+	local _pkg="$1" _destdir="$2"
+	local hdrdest="usr/src/${_pkg}-headers-${_kernver}"
 
 	# Run depmod after compressing modules.
 	vsed -i -e '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
-	make "${makejobs}" ARCH="${_arch}" INSTALL_MOD_PATH="${DESTDIR}" modules_install
+	make "${make_install_args[@]}" INSTALL_MOD_PATH="${_destdir}" modules_install
 
 	# Install device tree blobs
-	make "${makejobs}" "ARCH=${_arch}" INSTALL_DTBS_PATH="${DESTDIR}/boot" dtbs_install
+	make "${make_install_args[@]}" INSTALL_DTBS_PATH="${_destdir}/boot" dtbs_install
 
 	# move dtbs that ended up in /boot/broadcom
-	if [ -d "${DESTDIR}/boot/broadcom" ]; then
-		mv "${DESTDIR}"/boot/broadcom/*dtb "${DESTDIR}/boot"
+	if [ -d "${_destdir}/boot/broadcom" ]; then
+		mv "${_destdir}"/boot/broadcom/*dtb "${_destdir}/boot"
 	fi
 
 	# Install kernel image
@@ -167,96 +161,118 @@ do_install() {
 
 	# Switch to /usr.
 	vmkdir usr
-	mv "${DESTDIR}/lib" "${DESTDIR}/usr"
+	mv "${_destdir}/lib" "${_destdir}/usr"
 
-	pushd "${DESTDIR}/usr/lib/modules/${_kernver}"
+	pushd "${_destdir}/usr/lib/modules/${_kernver}"
 	rm -f source build
-	ln -sf "../../../src/${sourcepkg}-headers-${_kernver}" build
+	ln -sf "../../../src/${_pkg}-headers-${_kernver}" build
 	popd
 
 	# Install required headers to build external modules
-	install -Dm644 Makefile "${hdrdest}/Makefile"
-	install -Dm644 Kbuild "${hdrdest}/Kbuild"
-	install -Dm644 kernel/Makefile "${hdrdest}/kernel/Makefile"
-	install -Dm644 .config "${hdrdest}/.config"
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname "$file")"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find . -name 'Kconfig*')
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname $file)"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform)
-	mkdir -p "${hdrdest}/include"
+	vinstall Makefile 644 "${hdrdest}"
+	vinstall Kbuild 644 "${hdrdest}"
+	vinstall kernel/Makefile 644 "${hdrdest}/kernel"
+	vinstall .config 644 "${hdrdest}"
+	find . -name 'Kconfig*' | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	vmkdir "${hdrdest}/include"
 
 	# Remove firmware stuff provided by the "linux-firmware" pkg.
-	rm -rf "${DESTDIR}/usr/lib/firmware"
+	rm -rf "${_destdir}/usr/lib/firmware"
 
-	for i in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
+	for d in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
 		math-emu media net pcmcia scsi sound trace uapi vdso video xen; do
-		[ -d include/$i ] && cp -a "include/$i" "${hdrdest}/include"
+		[ -d include/$d ] && vcopy "include/$d" "${hdrdest}/include"
 	done
 
 	# Remove helper binaries built for host,
 	# if generated files from the scripts/ directory need to be included,
 	# they need to be copied to ${hdrdest} before this step
 	if [ "$CROSS_BUILD" ]; then
-		make "${makejobs}" ARCH="${_arch}" _mrproper_scripts
+		make "${make_install_args[@]}" _mrproper_scripts
 		# remove host specific objects as well
 		find scripts -name '*.o' -delete
 	fi
 
 	# Copy files necessary for later builds.
-	cp Module.symvers "${hdrdest}"
-	cp -a scripts "${hdrdest}"
-	mkdir -p "${hdrdest}/security/selinux"
-	cp -a security/selinux/include "${hdrdest}/security/selinux"
-	mkdir -p "${hdrdest}/tools/include"
-	cp -a tools/include/tools "${hdrdest}/tools/include"
+	vinstall Module.symvers 644 "${hdrdest}"
+	vcopy scripts "${hdrdest}"
+	vmkdir "${hdrdest}/security/selinux"
+	vcopy security/selinux/include "${hdrdest}/security/selinux"
+	vmkdir "${hdrdest}/tools/include"
+	vcopy tools/include/tools "${hdrdest}/tools/include"
 	if [ -d "arch/${_arch}/tools" ]; then
-		cp -a "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
+		vcopy "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
 	fi
-	cp -a kernel/time/timeconst.bc "${hdrdest}/kernel/time"
-	cp -a kernel/bounds.c "${hdrdest}/kernel"
-	mkdir -p "${hdrdest}/arch/x86/entry/syscalls"
-	cp -a arch/x86/entry/syscalls/syscall_32.tbl "${hdrdest}/arch/x86/entry/syscalls"
+	vinstall kernel/time/timeconst.bc 644 "${hdrdest}/kernel/time"
+	vinstall kernel/bounds.c 644 "${hdrdest}/kernel"
+	vinstall arch/x86/entry/syscalls/syscall_32.tbl 644 "${hdrdest}/arch/x86/entry/syscalls"
 
 	# copy arch includes for external modules
-	mkdir -p "${hdrdest}/arch/${_arch}"
-	cp -a "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
+	vmkdir "${hdrdest}/arch/${_arch}"
+	vcopy "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
 
 	mkdir -p "${hdrdest}/arch/${_arch}/kernel"
-	cp "arch/${_arch}/Makefile" "${hdrdest}/arch/${_arch}"
-	cp "arch/${_arch}/kernel/asm-offsets.s" "${hdrdest}/arch/${_arch}/kernel"
+	vinstall "arch/${_arch}/Makefile" 644 "${hdrdest}/arch/${_arch}"
+	vinstall "arch/${_arch}/kernel/asm-offsets.s" 644 "${hdrdest}/arch/${_arch}/kernel"
 	if [ "$_arch" = "arm64" ] ; then
-		cp -a "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
+		vcopy "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
 	fi
 
 	# Add md headers
-	mkdir -p "${hdrdest}/drivers/md"
-	cp drivers/md/*.h "${hdrdest}/drivers/md"
+	vmkdir "${hdrdest}/drivers/md"
+	vcopy drivers/md/*.h "${hdrdest}/drivers/md"
 
 	# Add inotify.h
-	mkdir -p "${hdrdest}/include/linux"
-	cp include/linux/inotify.h "${hdrdest}/include/linux"
+	vinstall include/linux/inotify.h 644 "${hdrdest}/include/linux"
 
 	# Add wireless headers
-	mkdir -p "${hdrdest}/net/mac80211/"
-	cp net/mac80211/*.h "${hdrdest}/net/mac80211"
+	vmkdir "${hdrdest}/net/mac80211/"
+	vcopy net/mac80211/*.h "${hdrdest}/net/mac80211"
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
-	find "${DESTDIR}" -name '*.ko' | xargs -n1 -P0 gzip -9
+	msg_normal "$_pkg-$version: compressing kernel modules with gzip, please wait...\n"
+	find "${_destdir}" -name '*.ko' | xargs -n1 -P0 gzip -9
 
 	# ... and run depmod again.
-	depmod -b "${DESTDIR}/usr" -F System.map "${_kernver}"
+	depmod -b "${_destdir}/usr" -F System.map "${_kernver}"
+}
+
+do_configure() {
+	local target
+
+	case "$XBPS_TARGET_MACHINE" in
+		# for zero, 1
+		armv6l*) target=bcmrpi_defconfig ;;
+		# for 2
+		armv7l*) target=bcm2709_defconfig ;;
+		# for 3, 4, zero 2, 5
+		aarch64*) target=bcm2711_defconfig ;;
+	esac
+
+	_configure "$target"
+}
+
+do_build() {
+	make "${make_build_args[@]}" prepare
+	make "${make_build_args[@]}" "${_image_target}" modules dtbs
+}
+
+do_install() {
+	_install "$pkgname" "$DESTDIR"
 }
 
 subpackages="rpi-kernel-headers"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv7l*) subpackages+=" rpi2-kernel rpi2-kernel-headers" ;;
-	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers" ;;
+	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers rpi5-kernel rpi5-kernel-headers" ;;
 esac
 
 rpi-kernel-headers_package() {
@@ -264,9 +280,54 @@ rpi-kernel-headers_package() {
 	noverifyrdeps=yes
 	noshlibprovides=yes
 	short_desc="${short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi5-kernel-headers>=0"
 	pkg_install() {
 		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		vmove "usr/lib/modules/${_kernver}/build"
+	}
+}
+
+_rpi5_short_desc="Linux kernel for Raspberry Pi 5 (${version%.*} series)"
+
+rpi5-kernel_package() {
+	nodebug=yes
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	python_version=3
+	triggers="kernel-hooks"
+	# These files could be modified when an external module is built.
+	mutable_files="
+	 /usr/lib/modules/${_kernver}/modules.dep
+	 /usr/lib/modules/${_kernver}/modules.dep.bin
+	 /usr/lib/modules/${_kernver}/modules.symbols
+	 /usr/lib/modules/${_kernver}/modules.symbols.bin
+	 /usr/lib/modules/${_kernver}/modules.alias
+	 /usr/lib/modules/${_kernver}/modules.alias.bin
+	 /usr/lib/modules/${_kernver}/modules.devname"
+	short_desc="$_rpi5_short_desc"
+	provides="rpi-kernel-${version}_${revision}"
+	replaces="rpi-kernel>=0"
+	pkg_install() {
+		_configure "bcm2712_defconfig"
+		make "${make_build_args[@]}" prepare
+		make "${make_build_args[@]}" "${_image_target}" modules dtbs
+		_install "rpi5-kernel" "$PKGDESTDIR"
+	}
+}
+
+rpi5-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="${_rpi5_short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi-kernel-headers>=0"
+	pkg_install() {
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/src" "${PKGDESTDIR}"/usr/src
+		vmkdir "usr/lib/modules/${_kernver}"
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/lib/modules/${_kernver}/build" "${PKGDESTDIR}/usr/lib/modules/${_kernver}/build"
 	}
 }
 
diff --git a/srcpkgs/rpi5-kernel b/srcpkgs/rpi5-kernel
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi5-kernel-headers b/srcpkgs/rpi5-kernel-headers
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

From 49bc94a773081ae1a79fd11e1d2d027759834f12 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:05 -0500
Subject: [PATCH 2/4] rpi-firmware: update to 20231102.

add rpi5-specific firmware
---
 srcpkgs/rpi-firmware/template | 40 +++++++++++++----------------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/srcpkgs/rpi-firmware/template b/srcpkgs/rpi-firmware/template
index 0a2efa3b80db0..d251448948f95 100644
--- a/srcpkgs/rpi-firmware/template
+++ b/srcpkgs/rpi-firmware/template
@@ -1,12 +1,12 @@
 # Template file for 'rpi-firmware'
 pkgname=rpi-firmware
-version=20230925
+version=20231102
 revision=1
-_rpi_fw=6b37a457122714aa14b2c7df0926455173fd04f1
-_rpi_bt=9556b08ace2a1735127894642cc8ea6529c04c90
-_rpi_brcm=2c3a8701193ba23d0ef85cdf0d0c9e47baf03dfc
+_rpi_fw=83dafbc92c0e63f76ca2ecdd42462d56489d1c77
+_rpi_bt=d9d4741caba7314d6500f588b1eaa5ab387a4ff5
+_rpi_brcm=88aa085bfa1a4650e1ccd88896f8343c22a24055
 create_wrksrc=yes
-archs="armv6l* armv7l* aarch64*"
+archs="aarch64* armv6l* armv7l*"
 short_desc="Firmware files for the Raspberry Pi"
 maintainer="Piraty <mail@piraty.dev>"
 license="BSD-3-Clause, custom:Cypress"
@@ -14,26 +14,14 @@ homepage="https://github.com/raspberrypi/firmware"
 distfiles="
  https://github.com/raspberrypi/firmware/archive/${_rpi_fw}.tar.gz
  https://github.com/RPi-Distro/firmware-nonfree/archive/${_rpi_brcm}.tar.gz
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430A1.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430B0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C5.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430A1.hcd>BCM43430A1.raspberrypi,model-zero-2-w.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430B0.hcd>BCM43430B0.raspberrypi,model-zero-2-w.hcd
+ https://github.com/RPi-Distro/bluez-firmware/archive/${_rpi_bt}.tar.gz
  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/LICENCE.cypress>LICENCE.cypress"
-checksum="913986b1be22b8dc30a3e6a9b5a28316b1bbee7bec90040ddefff0d7512560f4
- 9156d90116b921d2e7938b52fad84fbe1d96df622a66c5db09569c735832387a
- c096ad4a5c3f06ed7d69eba246bf89ada9acba64a5b6f51b1e9c12f99bb1e1a7
- 51c45e77ddad91a19e96dc8fb75295b2087c279940df2634b23baf71b6dea42c
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
- fb9f4ec2df5301bd35f416384e103c012c5983024c49aa72fbbaf90177512caa
- 55071227c94d86369d04f9aff3bbfd4197a78a53dc350295123e1a8b048bba8f
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
+checksum="dd43e77ca1a8969cdb7f05dd72a57f90862071d5a93bdd6aea8246aba85689cf
+ bb3d8fed40546e03e29d9e635745433f8083391e62d6ff151c895b892776964a
+ ae076a08ece89624b0449ea2495b0dfe2ea1223f683f5b57f2b89966e6a093d6
  ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f"
 
-skip_extraction="BCM43430A1.hcd BCM4345C0.hcd BCM43430B0.hcd BCM4345C5.hcd
- BCM43430A1.raspberrypi,model-zero-2-w.hcd BCM43430B0.raspberrypi,model-zero-2-w.hcd
- LICENCE.cypress"
+skip_extraction="LICENCE.cypress"
 
 provides="linux-firmware-broadcom-${version}_${revision}"
 replaces="linux-firmware-broadcom>=0"
@@ -72,7 +60,9 @@ do_install() {
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43456"* usr/lib/firmware/brcm
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43436"* usr/lib/firmware/brcm
 
-	for file in "${XBPS_SRCDISTDIR}/${pkgname}-${version}/"*.hcd; do
-		vinstall "$file" 0644 usr/lib/firmware/brcm
-	done
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/broadcom/"*.hcd usr/lib/firmware/brcm
+
+	vmkdir usr/lib/firmware/synaptics
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/"*.hcd usr/lib/firmware/synaptics
+	vlicense "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/LICENSE.synaptics"
 }

From 3b03ab3c8efb48089103f78893bc729086bf9410 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:48 -0500
Subject: [PATCH 3/4] New package: rpi-utils-20231105

replaces rpi-userland:
https://github.com/raspberrypi/userland/blob/master/README.md
---
 .../rpi-utils/patches/no-overlaycheck.patch   | 14 +++++++++++++
 srcpkgs/rpi-utils/template                    | 20 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 srcpkgs/rpi-utils/patches/no-overlaycheck.patch
 create mode 100644 srcpkgs/rpi-utils/template

diff --git a/srcpkgs/rpi-utils/patches/no-overlaycheck.patch b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
new file mode 100644
index 0000000000000..3e64958e238d2
--- /dev/null
+++ b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
@@ -0,0 +1,14 @@
+This program is not very useful as a downstream, it seems to be only intended
+for internal QA. It also has a lot of weird things like hardcoding the prefixed
+cpp to use and putting a text file in /usr/bin.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,6 @@
+ # List of subsidiary CMakeLists
+ add_subdirectory(dtmerge)
+ add_subdirectory(otpset)
+-add_subdirectory(overlaycheck)
+ add_subdirectory(ovmerge)
+ add_subdirectory(pinctrl)
+ add_subdirectory(raspinfo)
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
new file mode 100644
index 0000000000000..bbb7472b72a33
--- /dev/null
+++ b/srcpkgs/rpi-utils/template
@@ -0,0 +1,20 @@
+# Template file for 'rpi-utils'
+pkgname=rpi-utils
+version=20231105
+revision=1
+_commit=84b1831fe16b784fb3e5bfbacf76b42a821ae720
+archs="armv6l* armv7l* aarch64*"
+build_style=cmake
+makedepends="dtc-devel"
+depends="python3 perl bash"
+short_desc="Collection of utilities for Raspberry Pi"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="BSD-3-Clause"
+homepage="https://github.com/raspberrypi/utils"
+distfiles="https://github.com/raspberrypi/utils/archive/${_commit}.tar.gz"
+checksum=c97ad394e1694f41c2c6748b6e78621c74a51f20bf006c9579267f68d3157563
+python_version=3
+
+post_install() {
+	vlicense LICENCE
+}

From 13dd5bd77d9cb0111c0e59b722e8d6dda5d812bd Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:51:52 -0500
Subject: [PATCH 4/4] rpi-eeprom: update to 2023.11.09.

- install manpages (like is done in the debian rules)
- adds rpi5 firmware
---
 srcpkgs/rpi-eeprom/template | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/rpi-eeprom/template b/srcpkgs/rpi-eeprom/template
index fb017a50966cd..55b7d396efeb5 100644
--- a/srcpkgs/rpi-eeprom/template
+++ b/srcpkgs/rpi-eeprom/template
@@ -1,17 +1,18 @@
 # Template file for 'rpi-eeprom'
 pkgname=rpi-eeprom
-version=2023.09.29
+version=2023.11.09
 revision=1
-_githash="4f2d676b4e2a9c2d9ee1ab42015ce711fde97afa"
-archs="armv7* aarch64*"
+_githash="6b14e84a2fb2e1f7220a404f65e7e0985f07c9e5"
+archs="armv7l* aarch64*"
 conf_files="/etc/default/rpi-eeprom-update"
-depends="binutils pciutils python3 rpi-firmware rpi-userland"
-short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4"
+hostmakedepends="help2man python3"
+depends="binutils pciutils python3 rpi-firmware rpi-utils"
+short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4/5"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="BSD-3-Clause, custom:Proprietary"
 homepage="https://github.com/raspberrypi/rpi-eeprom/"
 distfiles="https://github.com/raspberrypi/rpi-eeprom/archive/${_githash}.tar.gz"
-checksum="189c5d37f3102247cec72619e3cb357d027ec526fa3c7373d3107bd6c9e30e29"
+checksum=3907711bb2ff78a0e9120709b72b04d6d010f93f79d525af0454d3d27a772aca
 python_version=3
 repository=nonfree
 
@@ -21,9 +22,20 @@ do_install() {
 	vbin rpi-eeprom-digest
 	vinstall rpi-eeprom-update-default 644 etc/default rpi-eeprom-update
 
-	vmkdir usr/lib/firmware/raspberrypi/bootloader
-	# need to figure out how to package both pi4 (2711) and pi5 (2712) fw
-	vcopy firmware-2711/* usr/lib/firmware/raspberrypi/bootloader/
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Checks whether the Raspberry Pi bootloader EEPROM is up-to-date and updates the EEPROM" \
+		--output=rpi-eeprom-update.1 ./rpi-eeprom-update
+	vman rpi-eeprom-update.1
+
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Bootloader EEPROM configuration tool for the Raspberry Pi 4/5" \
+		--output=rpi-eeprom-config.1 ./rpi-eeprom-config
+	vman rpi-eeprom-config.1
+
+	for soc in 2711 2712; do
+		vmkdir usr/lib/firmware/raspberrypi/bootloader-"$soc"
+		vcopy firmware-"$soc"/* usr/lib/firmware/raspberrypi/bootloader-"$soc"/
+	done
 
 	vlicense LICENSE
 }

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
@ 2023-11-18  4:02 ` classabbyamp
  2023-11-18 19:54 ` classabbyamp
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2023-11-18  4:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages rpi5
https://github.com/void-linux/void-packages/pull/47288

rpi-*: update and support rpi5
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES** (RPi5 glibc so far)

prebuilt packages and RPi5-compatible install images coming soon

[ci skip]


A patch file from https://github.com/void-linux/void-packages/pull/47288.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi5-47288.patch --]
[-- Type: text/x-diff, Size: 21806 bytes --]

From cdaa7b93256d481a0678a7c2de9baa3336133a33 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:48:03 -0500
Subject: [PATCH 1/4] rpi-kernel: update to 6.1.62.

- add rpi5 support and optimised kernel
- add support for BTRFS root
- add /proc/config.gz by default
---
 srcpkgs/rpi-kernel/template | 221 +++++++++++++++++++++++-------------
 srcpkgs/rpi5-kernel         |   1 +
 srcpkgs/rpi5-kernel-headers |   1 +
 3 files changed, 143 insertions(+), 80 deletions(-)
 create mode 120000 srcpkgs/rpi5-kernel
 create mode 120000 srcpkgs/rpi5-kernel-headers

diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 2fa1bb54b683e..d90257a9a044b 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -12,9 +12,9 @@
 #
 # Upstream documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html
 pkgname=rpi-kernel
-version=6.1.54
+version=6.1.62
 revision=1
-_githash=fad58933544bb2a7b7db92847c25c79a83171fa6
+_githash=3fdb0eb8be5803a16fc308b8441cdcdeafbb944e
 archs="armv6l* armv7l* aarch64*"
 hostmakedepends="perl kmod uboot-mkimage openssl-devel bc bison flex xz"
 makedepends="ncurses-devel"
@@ -23,8 +23,10 @@ maintainer="Piraty <mail@piraty.dev>"
 license="GPL-2.0-only"
 homepage="http://www.kernel.org"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
-checksum=1bd02902fae49351fb16ac0d5ccc3bf4d67aa0640006dbbf8846963519b01ab8
+checksum=a44b7d642fc2d80a8cfd05d0b461ecbff019680932754b3f9190bb22be9b8fe2
 python_version=3
+provides="rpi-kernel-${version}_${revision}"
+replaces="rpi5-kernel>=0"
 
 _kernver="${version}_${revision}"
 
@@ -51,28 +53,20 @@ case "$XBPS_TARGET_MACHINE" in
 	*) broken="No Raspberry Pi exists for this arch" ;;
 esac
 
+make_build_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+make_install_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+
 if [ "$CROSS_BUILD" ]; then
-	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
-else
-	_cross=
+	make_build_args+=("CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-")
 fi
 
-do_configure() {
-	local target defconfig
-
-	case "$XBPS_TARGET_MACHINE" in
-		# for zero, 1
-		armv6l*) target=bcmrpi_defconfig ;;
-		# for 2
-		armv7l*) target=bcm2709_defconfig ;;
-		# for 3, 4, zero 2
-		aarch64*) target=bcm2711_defconfig ;;
-	esac
+_configure() {
+	local target="$1" defconfig
 
 	defconfig="arch/${_arch}/configs/${target}"
 	cp "$defconfig" .config
 
-	cat <<-! > "foo"
+	cat <<-! > void.config
 	CONFIG_CONNECTOR=y
 	CONFIG_HID_STEAM=y
 	CONFIG_PROC_EVENTS=y
@@ -113,15 +107,19 @@ do_configure() {
 	CONFIG_LZ4_COMPRESS=y
 	CONFIG_CRYPTO_RNG=y
 	CONFIG_CRYPTO_RNG_DEFAULT=y
+	CONFIG_BTRFS_FS=y
+	CONFIG_BTRFS_POSIX_ACL=y
+	CONFIG_IKCONFIG_PROC=y
 	!
 
 	while read -r line; do
+		local option="" str="" cmd=""
 		# skip comments
 		case "$line" in
 			"#"*) continue;;
 		esac
-		local option=${line%%=*} str=
-		local cmd="$(echo "$line" | cut -d= -f2)"
+		option="${line%%=*}"
+		cmd="$(echo "$line" | cut -d= -f2)"
 		case "$cmd" in
 			y) cmd="enable";;
 			n) cmd="disable";;
@@ -135,31 +133,27 @@ do_configure() {
 		./scripts/config \
 			--file .config \
 			"--$cmd" "$option" "${str//\"/}"
-	done < foo
+	done < void.config
 
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" olddefconfig
+	make "${make_build_args[@]}" olddefconfig
 }
 
-do_build() {
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" prepare
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" "${_image_target}" modules dtbs
-}
-
-do_install() {
-	local hdrdest="${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}"
+_install() {
+	local _pkg="$1" _destdir="$2"
+	local hdrdest="usr/src/${_pkg}-headers-${_kernver}"
 
 	# Run depmod after compressing modules.
 	vsed -i -e '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
-	make "${makejobs}" ARCH="${_arch}" INSTALL_MOD_PATH="${DESTDIR}" modules_install
+	make "${make_install_args[@]}" INSTALL_MOD_PATH="${_destdir}" modules_install
 
 	# Install device tree blobs
-	make "${makejobs}" "ARCH=${_arch}" INSTALL_DTBS_PATH="${DESTDIR}/boot" dtbs_install
+	make "${make_install_args[@]}" INSTALL_DTBS_PATH="${_destdir}/boot" dtbs_install
 
 	# move dtbs that ended up in /boot/broadcom
-	if [ -d "${DESTDIR}/boot/broadcom" ]; then
-		mv "${DESTDIR}"/boot/broadcom/*dtb "${DESTDIR}/boot"
+	if [ -d "${_destdir}/boot/broadcom" ]; then
+		mv "${_destdir}"/boot/broadcom/*dtb "${_destdir}/boot"
 	fi
 
 	# Install kernel image
@@ -167,96 +161,118 @@ do_install() {
 
 	# Switch to /usr.
 	vmkdir usr
-	mv "${DESTDIR}/lib" "${DESTDIR}/usr"
+	mv "${_destdir}/lib" "${_destdir}/usr"
 
-	pushd "${DESTDIR}/usr/lib/modules/${_kernver}"
+	pushd "${_destdir}/usr/lib/modules/${_kernver}"
 	rm -f source build
-	ln -sf "../../../src/${sourcepkg}-headers-${_kernver}" build
+	ln -sf "../../../src/${_pkg}-headers-${_kernver}" build
 	popd
 
 	# Install required headers to build external modules
-	install -Dm644 Makefile "${hdrdest}/Makefile"
-	install -Dm644 Kbuild "${hdrdest}/Kbuild"
-	install -Dm644 kernel/Makefile "${hdrdest}/kernel/Makefile"
-	install -Dm644 .config "${hdrdest}/.config"
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname "$file")"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find . -name 'Kconfig*')
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname $file)"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform)
-	mkdir -p "${hdrdest}/include"
+	vinstall Makefile 644 "${hdrdest}"
+	vinstall Kbuild 644 "${hdrdest}"
+	vinstall kernel/Makefile 644 "${hdrdest}/kernel"
+	vinstall .config 644 "${hdrdest}"
+	find . -name 'Kconfig*' | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	vmkdir "${hdrdest}/include"
 
 	# Remove firmware stuff provided by the "linux-firmware" pkg.
-	rm -rf "${DESTDIR}/usr/lib/firmware"
+	rm -rf "${_destdir}/usr/lib/firmware"
 
-	for i in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
+	for d in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
 		math-emu media net pcmcia scsi sound trace uapi vdso video xen; do
-		[ -d include/$i ] && cp -a "include/$i" "${hdrdest}/include"
+		[ -d include/$d ] && vcopy "include/$d" "${hdrdest}/include"
 	done
 
 	# Remove helper binaries built for host,
 	# if generated files from the scripts/ directory need to be included,
 	# they need to be copied to ${hdrdest} before this step
 	if [ "$CROSS_BUILD" ]; then
-		make "${makejobs}" ARCH="${_arch}" _mrproper_scripts
+		make "${make_install_args[@]}" _mrproper_scripts
 		# remove host specific objects as well
 		find scripts -name '*.o' -delete
 	fi
 
 	# Copy files necessary for later builds.
-	cp Module.symvers "${hdrdest}"
-	cp -a scripts "${hdrdest}"
-	mkdir -p "${hdrdest}/security/selinux"
-	cp -a security/selinux/include "${hdrdest}/security/selinux"
-	mkdir -p "${hdrdest}/tools/include"
-	cp -a tools/include/tools "${hdrdest}/tools/include"
+	vinstall Module.symvers 644 "${hdrdest}"
+	vcopy scripts "${hdrdest}"
+	vmkdir "${hdrdest}/security/selinux"
+	vcopy security/selinux/include "${hdrdest}/security/selinux"
+	vmkdir "${hdrdest}/tools/include"
+	vcopy tools/include/tools "${hdrdest}/tools/include"
 	if [ -d "arch/${_arch}/tools" ]; then
-		cp -a "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
+		vcopy "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
 	fi
-	cp -a kernel/time/timeconst.bc "${hdrdest}/kernel/time"
-	cp -a kernel/bounds.c "${hdrdest}/kernel"
-	mkdir -p "${hdrdest}/arch/x86/entry/syscalls"
-	cp -a arch/x86/entry/syscalls/syscall_32.tbl "${hdrdest}/arch/x86/entry/syscalls"
+	vinstall kernel/time/timeconst.bc 644 "${hdrdest}/kernel/time"
+	vinstall kernel/bounds.c 644 "${hdrdest}/kernel"
+	vinstall arch/x86/entry/syscalls/syscall_32.tbl 644 "${hdrdest}/arch/x86/entry/syscalls"
 
 	# copy arch includes for external modules
-	mkdir -p "${hdrdest}/arch/${_arch}"
-	cp -a "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
+	vmkdir "${hdrdest}/arch/${_arch}"
+	vcopy "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
 
 	mkdir -p "${hdrdest}/arch/${_arch}/kernel"
-	cp "arch/${_arch}/Makefile" "${hdrdest}/arch/${_arch}"
-	cp "arch/${_arch}/kernel/asm-offsets.s" "${hdrdest}/arch/${_arch}/kernel"
+	vinstall "arch/${_arch}/Makefile" 644 "${hdrdest}/arch/${_arch}"
+	vinstall "arch/${_arch}/kernel/asm-offsets.s" 644 "${hdrdest}/arch/${_arch}/kernel"
 	if [ "$_arch" = "arm64" ] ; then
-		cp -a "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
+		vcopy "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
 	fi
 
 	# Add md headers
-	mkdir -p "${hdrdest}/drivers/md"
-	cp drivers/md/*.h "${hdrdest}/drivers/md"
+	vmkdir "${hdrdest}/drivers/md"
+	vcopy drivers/md/*.h "${hdrdest}/drivers/md"
 
 	# Add inotify.h
-	mkdir -p "${hdrdest}/include/linux"
-	cp include/linux/inotify.h "${hdrdest}/include/linux"
+	vinstall include/linux/inotify.h 644 "${hdrdest}/include/linux"
 
 	# Add wireless headers
-	mkdir -p "${hdrdest}/net/mac80211/"
-	cp net/mac80211/*.h "${hdrdest}/net/mac80211"
+	vmkdir "${hdrdest}/net/mac80211/"
+	vcopy net/mac80211/*.h "${hdrdest}/net/mac80211"
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
-	find "${DESTDIR}" -name '*.ko' | xargs -n1 -P0 gzip -9
+	msg_normal "$_pkg-$version: compressing kernel modules with gzip, please wait...\n"
+	find "${_destdir}" -name '*.ko' | xargs -n1 -P0 gzip -9
 
 	# ... and run depmod again.
-	depmod -b "${DESTDIR}/usr" -F System.map "${_kernver}"
+	depmod -b "${_destdir}/usr" -F System.map "${_kernver}"
+}
+
+do_configure() {
+	local target
+
+	case "$XBPS_TARGET_MACHINE" in
+		# for zero, 1
+		armv6l*) target=bcmrpi_defconfig ;;
+		# for 2
+		armv7l*) target=bcm2709_defconfig ;;
+		# for 3, 4, zero 2, 5
+		aarch64*) target=bcm2711_defconfig ;;
+	esac
+
+	_configure "$target"
+}
+
+do_build() {
+	make "${make_build_args[@]}" prepare
+	make "${make_build_args[@]}" "${_image_target}" modules dtbs
+}
+
+do_install() {
+	_install "$pkgname" "$DESTDIR"
 }
 
 subpackages="rpi-kernel-headers"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv7l*) subpackages+=" rpi2-kernel rpi2-kernel-headers" ;;
-	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers" ;;
+	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers rpi5-kernel rpi5-kernel-headers" ;;
 esac
 
 rpi-kernel-headers_package() {
@@ -264,9 +280,54 @@ rpi-kernel-headers_package() {
 	noverifyrdeps=yes
 	noshlibprovides=yes
 	short_desc="${short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi5-kernel-headers>=0"
 	pkg_install() {
 		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		vmove "usr/lib/modules/${_kernver}/build"
+	}
+}
+
+_rpi5_short_desc="Linux kernel for Raspberry Pi 5 (${version%.*} series)"
+
+rpi5-kernel_package() {
+	nodebug=yes
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	python_version=3
+	triggers="kernel-hooks"
+	# These files could be modified when an external module is built.
+	mutable_files="
+	 /usr/lib/modules/${_kernver}/modules.dep
+	 /usr/lib/modules/${_kernver}/modules.dep.bin
+	 /usr/lib/modules/${_kernver}/modules.symbols
+	 /usr/lib/modules/${_kernver}/modules.symbols.bin
+	 /usr/lib/modules/${_kernver}/modules.alias
+	 /usr/lib/modules/${_kernver}/modules.alias.bin
+	 /usr/lib/modules/${_kernver}/modules.devname"
+	short_desc="$_rpi5_short_desc"
+	provides="rpi-kernel-${version}_${revision}"
+	replaces="rpi-kernel>=0"
+	pkg_install() {
+		_configure "bcm2712_defconfig"
+		make "${make_build_args[@]}" prepare
+		make "${make_build_args[@]}" "${_image_target}" modules dtbs
+		_install "rpi5-kernel" "$PKGDESTDIR"
+	}
+}
+
+rpi5-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="${_rpi5_short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi-kernel-headers>=0"
+	pkg_install() {
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/src" "${PKGDESTDIR}"/usr/src
+		vmkdir "usr/lib/modules/${_kernver}"
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/lib/modules/${_kernver}/build" "${PKGDESTDIR}/usr/lib/modules/${_kernver}/build"
 	}
 }
 
diff --git a/srcpkgs/rpi5-kernel b/srcpkgs/rpi5-kernel
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi5-kernel-headers b/srcpkgs/rpi5-kernel-headers
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

From 49bc94a773081ae1a79fd11e1d2d027759834f12 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:05 -0500
Subject: [PATCH 2/4] rpi-firmware: update to 20231102.

add rpi5-specific firmware
---
 srcpkgs/rpi-firmware/template | 40 +++++++++++++----------------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/srcpkgs/rpi-firmware/template b/srcpkgs/rpi-firmware/template
index 0a2efa3b80db0..d251448948f95 100644
--- a/srcpkgs/rpi-firmware/template
+++ b/srcpkgs/rpi-firmware/template
@@ -1,12 +1,12 @@
 # Template file for 'rpi-firmware'
 pkgname=rpi-firmware
-version=20230925
+version=20231102
 revision=1
-_rpi_fw=6b37a457122714aa14b2c7df0926455173fd04f1
-_rpi_bt=9556b08ace2a1735127894642cc8ea6529c04c90
-_rpi_brcm=2c3a8701193ba23d0ef85cdf0d0c9e47baf03dfc
+_rpi_fw=83dafbc92c0e63f76ca2ecdd42462d56489d1c77
+_rpi_bt=d9d4741caba7314d6500f588b1eaa5ab387a4ff5
+_rpi_brcm=88aa085bfa1a4650e1ccd88896f8343c22a24055
 create_wrksrc=yes
-archs="armv6l* armv7l* aarch64*"
+archs="aarch64* armv6l* armv7l*"
 short_desc="Firmware files for the Raspberry Pi"
 maintainer="Piraty <mail@piraty.dev>"
 license="BSD-3-Clause, custom:Cypress"
@@ -14,26 +14,14 @@ homepage="https://github.com/raspberrypi/firmware"
 distfiles="
  https://github.com/raspberrypi/firmware/archive/${_rpi_fw}.tar.gz
  https://github.com/RPi-Distro/firmware-nonfree/archive/${_rpi_brcm}.tar.gz
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430A1.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430B0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C5.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430A1.hcd>BCM43430A1.raspberrypi,model-zero-2-w.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430B0.hcd>BCM43430B0.raspberrypi,model-zero-2-w.hcd
+ https://github.com/RPi-Distro/bluez-firmware/archive/${_rpi_bt}.tar.gz
  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/LICENCE.cypress>LICENCE.cypress"
-checksum="913986b1be22b8dc30a3e6a9b5a28316b1bbee7bec90040ddefff0d7512560f4
- 9156d90116b921d2e7938b52fad84fbe1d96df622a66c5db09569c735832387a
- c096ad4a5c3f06ed7d69eba246bf89ada9acba64a5b6f51b1e9c12f99bb1e1a7
- 51c45e77ddad91a19e96dc8fb75295b2087c279940df2634b23baf71b6dea42c
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
- fb9f4ec2df5301bd35f416384e103c012c5983024c49aa72fbbaf90177512caa
- 55071227c94d86369d04f9aff3bbfd4197a78a53dc350295123e1a8b048bba8f
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
+checksum="dd43e77ca1a8969cdb7f05dd72a57f90862071d5a93bdd6aea8246aba85689cf
+ bb3d8fed40546e03e29d9e635745433f8083391e62d6ff151c895b892776964a
+ ae076a08ece89624b0449ea2495b0dfe2ea1223f683f5b57f2b89966e6a093d6
  ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f"
 
-skip_extraction="BCM43430A1.hcd BCM4345C0.hcd BCM43430B0.hcd BCM4345C5.hcd
- BCM43430A1.raspberrypi,model-zero-2-w.hcd BCM43430B0.raspberrypi,model-zero-2-w.hcd
- LICENCE.cypress"
+skip_extraction="LICENCE.cypress"
 
 provides="linux-firmware-broadcom-${version}_${revision}"
 replaces="linux-firmware-broadcom>=0"
@@ -72,7 +60,9 @@ do_install() {
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43456"* usr/lib/firmware/brcm
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43436"* usr/lib/firmware/brcm
 
-	for file in "${XBPS_SRCDISTDIR}/${pkgname}-${version}/"*.hcd; do
-		vinstall "$file" 0644 usr/lib/firmware/brcm
-	done
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/broadcom/"*.hcd usr/lib/firmware/brcm
+
+	vmkdir usr/lib/firmware/synaptics
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/"*.hcd usr/lib/firmware/synaptics
+	vlicense "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/LICENSE.synaptics"
 }

From 3b03ab3c8efb48089103f78893bc729086bf9410 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:48 -0500
Subject: [PATCH 3/4] New package: rpi-utils-20231105

replaces rpi-userland:
https://github.com/raspberrypi/userland/blob/master/README.md
---
 .../rpi-utils/patches/no-overlaycheck.patch   | 14 +++++++++++++
 srcpkgs/rpi-utils/template                    | 20 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 srcpkgs/rpi-utils/patches/no-overlaycheck.patch
 create mode 100644 srcpkgs/rpi-utils/template

diff --git a/srcpkgs/rpi-utils/patches/no-overlaycheck.patch b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
new file mode 100644
index 0000000000000..3e64958e238d2
--- /dev/null
+++ b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
@@ -0,0 +1,14 @@
+This program is not very useful as a downstream, it seems to be only intended
+for internal QA. It also has a lot of weird things like hardcoding the prefixed
+cpp to use and putting a text file in /usr/bin.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,6 @@
+ # List of subsidiary CMakeLists
+ add_subdirectory(dtmerge)
+ add_subdirectory(otpset)
+-add_subdirectory(overlaycheck)
+ add_subdirectory(ovmerge)
+ add_subdirectory(pinctrl)
+ add_subdirectory(raspinfo)
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
new file mode 100644
index 0000000000000..bbb7472b72a33
--- /dev/null
+++ b/srcpkgs/rpi-utils/template
@@ -0,0 +1,20 @@
+# Template file for 'rpi-utils'
+pkgname=rpi-utils
+version=20231105
+revision=1
+_commit=84b1831fe16b784fb3e5bfbacf76b42a821ae720
+archs="armv6l* armv7l* aarch64*"
+build_style=cmake
+makedepends="dtc-devel"
+depends="python3 perl bash"
+short_desc="Collection of utilities for Raspberry Pi"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="BSD-3-Clause"
+homepage="https://github.com/raspberrypi/utils"
+distfiles="https://github.com/raspberrypi/utils/archive/${_commit}.tar.gz"
+checksum=c97ad394e1694f41c2c6748b6e78621c74a51f20bf006c9579267f68d3157563
+python_version=3
+
+post_install() {
+	vlicense LICENCE
+}

From b1ad884add2dcffb65da247526fb56d568c4330e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:51:52 -0500
Subject: [PATCH 4/4] rpi-eeprom: update to 2023.11.09.

- install manpages (like is done in the debian rules)
- adds rpi5 firmware
---
 srcpkgs/rpi-eeprom/template | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/rpi-eeprom/template b/srcpkgs/rpi-eeprom/template
index fb017a50966cd..55b7d396efeb5 100644
--- a/srcpkgs/rpi-eeprom/template
+++ b/srcpkgs/rpi-eeprom/template
@@ -1,17 +1,18 @@
 # Template file for 'rpi-eeprom'
 pkgname=rpi-eeprom
-version=2023.09.29
+version=2023.11.09
 revision=1
-_githash="4f2d676b4e2a9c2d9ee1ab42015ce711fde97afa"
-archs="armv7* aarch64*"
+_githash="6b14e84a2fb2e1f7220a404f65e7e0985f07c9e5"
+archs="armv7l* aarch64*"
 conf_files="/etc/default/rpi-eeprom-update"
-depends="binutils pciutils python3 rpi-firmware rpi-userland"
-short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4"
+hostmakedepends="help2man python3"
+depends="binutils pciutils python3 rpi-firmware rpi-utils"
+short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4/5"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="BSD-3-Clause, custom:Proprietary"
 homepage="https://github.com/raspberrypi/rpi-eeprom/"
 distfiles="https://github.com/raspberrypi/rpi-eeprom/archive/${_githash}.tar.gz"
-checksum="189c5d37f3102247cec72619e3cb357d027ec526fa3c7373d3107bd6c9e30e29"
+checksum=3907711bb2ff78a0e9120709b72b04d6d010f93f79d525af0454d3d27a772aca
 python_version=3
 repository=nonfree
 
@@ -21,9 +22,20 @@ do_install() {
 	vbin rpi-eeprom-digest
 	vinstall rpi-eeprom-update-default 644 etc/default rpi-eeprom-update
 
-	vmkdir usr/lib/firmware/raspberrypi/bootloader
-	# need to figure out how to package both pi4 (2711) and pi5 (2712) fw
-	vcopy firmware-2711/* usr/lib/firmware/raspberrypi/bootloader/
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Checks whether the Raspberry Pi bootloader EEPROM is up-to-date and updates the EEPROM" \
+		--output=rpi-eeprom-update.1 ./rpi-eeprom-update
+	vman rpi-eeprom-update.1
+
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Bootloader EEPROM configuration tool for the Raspberry Pi 4/5" \
+		--output=rpi-eeprom-config.1 ./rpi-eeprom-config
+	vman rpi-eeprom-config.1
+
+	for soc in 2711 2712; do
+		vmkdir usr/lib/firmware/raspberrypi/bootloader-"$soc"
+		vcopy firmware-"$soc"/* usr/lib/firmware/raspberrypi/bootloader-"$soc"/
+	done
 
 	vlicense LICENSE
 }

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
  2023-11-18  4:02 ` [PR PATCH] [Updated] " classabbyamp
@ 2023-11-18 19:54 ` classabbyamp
  2023-11-19 19:19 ` classabbyamp
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2023-11-18 19:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages rpi5
https://github.com/void-linux/void-packages/pull/47288

rpi-*: update and support rpi5
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES** (RPi5 glibc so far)

### Prebuilt packages and RPi5-compatible install images for testing

**packages:** https://files.placeviolette.net/rpi5

```
`https://files.placeviolette.net/rpi5' repository has been RSA signed by "classabbyamp"
Fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
```
**images:** https://files.placeviolette.net/rpi5-live

`rpi5-kernel` is not installed by default on these images, but can be seamlessly switched to by installing it. it will uninstall  `rpi-kernel` (and vice-versa). RPi5 is compatible with both, but `rpi5-kernel` may provide some performance benefits.

The images also include the changes from void-linux/void-mklive#361

[ci skip]

closes #46815 
closes #46522 

A patch file from https://github.com/void-linux/void-packages/pull/47288.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi5-47288.patch --]
[-- Type: text/x-diff, Size: 21826 bytes --]

From eb5ad41c587846f57efee33d79c9994c3e67a7b3 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:48:03 -0500
Subject: [PATCH 1/4] rpi-kernel: update to 6.1.62.

- add rpi5 support and optimised kernel
- add support for BTRFS root
- add /proc/config.gz by default
---
 srcpkgs/rpi-kernel/template | 222 +++++++++++++++++++++++-------------
 srcpkgs/rpi5-kernel         |   1 +
 srcpkgs/rpi5-kernel-headers |   1 +
 3 files changed, 144 insertions(+), 80 deletions(-)
 create mode 120000 srcpkgs/rpi5-kernel
 create mode 120000 srcpkgs/rpi5-kernel-headers

diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 2fa1bb54b683e..34d5c9a9855f2 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -12,9 +12,9 @@
 #
 # Upstream documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html
 pkgname=rpi-kernel
-version=6.1.54
+version=6.1.62
 revision=1
-_githash=fad58933544bb2a7b7db92847c25c79a83171fa6
+_githash=3fdb0eb8be5803a16fc308b8441cdcdeafbb944e
 archs="armv6l* armv7l* aarch64*"
 hostmakedepends="perl kmod uboot-mkimage openssl-devel bc bison flex xz"
 makedepends="ncurses-devel"
@@ -23,8 +23,10 @@ maintainer="Piraty <mail@piraty.dev>"
 license="GPL-2.0-only"
 homepage="http://www.kernel.org"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
-checksum=1bd02902fae49351fb16ac0d5ccc3bf4d67aa0640006dbbf8846963519b01ab8
+checksum=a44b7d642fc2d80a8cfd05d0b461ecbff019680932754b3f9190bb22be9b8fe2
 python_version=3
+provides="rpi-kernel-${version}_${revision}"
+replaces="rpi5-kernel>=0"
 
 _kernver="${version}_${revision}"
 
@@ -51,28 +53,20 @@ case "$XBPS_TARGET_MACHINE" in
 	*) broken="No Raspberry Pi exists for this arch" ;;
 esac
 
+make_build_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+make_install_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+
 if [ "$CROSS_BUILD" ]; then
-	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
-else
-	_cross=
+	make_build_args+=("CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-")
 fi
 
-do_configure() {
-	local target defconfig
-
-	case "$XBPS_TARGET_MACHINE" in
-		# for zero, 1
-		armv6l*) target=bcmrpi_defconfig ;;
-		# for 2
-		armv7l*) target=bcm2709_defconfig ;;
-		# for 3, 4, zero 2
-		aarch64*) target=bcm2711_defconfig ;;
-	esac
+_configure() {
+	local target="$1" defconfig
 
 	defconfig="arch/${_arch}/configs/${target}"
 	cp "$defconfig" .config
 
-	cat <<-! > "foo"
+	cat <<-! > void.config
 	CONFIG_CONNECTOR=y
 	CONFIG_HID_STEAM=y
 	CONFIG_PROC_EVENTS=y
@@ -113,15 +107,20 @@ do_configure() {
 	CONFIG_LZ4_COMPRESS=y
 	CONFIG_CRYPTO_RNG=y
 	CONFIG_CRYPTO_RNG_DEFAULT=y
+	CONFIG_BTRFS_FS=y
+	CONFIG_BTRFS_POSIX_ACL=y
+	CONFIG_IKCONFIG=y
+	CONFIG_IKCONFIG_PROC=y
 	!
 
 	while read -r line; do
+		local option="" str="" cmd=""
 		# skip comments
 		case "$line" in
 			"#"*) continue;;
 		esac
-		local option=${line%%=*} str=
-		local cmd="$(echo "$line" | cut -d= -f2)"
+		option="${line%%=*}"
+		cmd="$(echo "$line" | cut -d= -f2)"
 		case "$cmd" in
 			y) cmd="enable";;
 			n) cmd="disable";;
@@ -135,31 +134,27 @@ do_configure() {
 		./scripts/config \
 			--file .config \
 			"--$cmd" "$option" "${str//\"/}"
-	done < foo
+	done < void.config
 
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" olddefconfig
+	make "${make_build_args[@]}" olddefconfig
 }
 
-do_build() {
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" prepare
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" "${_image_target}" modules dtbs
-}
-
-do_install() {
-	local hdrdest="${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}"
+_install() {
+	local _pkg="$1" _destdir="$2"
+	local hdrdest="usr/src/${_pkg}-headers-${_kernver}"
 
 	# Run depmod after compressing modules.
 	vsed -i -e '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
-	make "${makejobs}" ARCH="${_arch}" INSTALL_MOD_PATH="${DESTDIR}" modules_install
+	make "${make_install_args[@]}" INSTALL_MOD_PATH="${_destdir}" modules_install
 
 	# Install device tree blobs
-	make "${makejobs}" "ARCH=${_arch}" INSTALL_DTBS_PATH="${DESTDIR}/boot" dtbs_install
+	make "${make_install_args[@]}" INSTALL_DTBS_PATH="${_destdir}/boot" dtbs_install
 
 	# move dtbs that ended up in /boot/broadcom
-	if [ -d "${DESTDIR}/boot/broadcom" ]; then
-		mv "${DESTDIR}"/boot/broadcom/*dtb "${DESTDIR}/boot"
+	if [ -d "${_destdir}/boot/broadcom" ]; then
+		mv "${_destdir}"/boot/broadcom/*dtb "${_destdir}/boot"
 	fi
 
 	# Install kernel image
@@ -167,96 +162,118 @@ do_install() {
 
 	# Switch to /usr.
 	vmkdir usr
-	mv "${DESTDIR}/lib" "${DESTDIR}/usr"
+	mv "${_destdir}/lib" "${_destdir}/usr"
 
-	pushd "${DESTDIR}/usr/lib/modules/${_kernver}"
+	pushd "${_destdir}/usr/lib/modules/${_kernver}"
 	rm -f source build
-	ln -sf "../../../src/${sourcepkg}-headers-${_kernver}" build
+	ln -sf "../../../src/${_pkg}-headers-${_kernver}" build
 	popd
 
 	# Install required headers to build external modules
-	install -Dm644 Makefile "${hdrdest}/Makefile"
-	install -Dm644 Kbuild "${hdrdest}/Kbuild"
-	install -Dm644 kernel/Makefile "${hdrdest}/kernel/Makefile"
-	install -Dm644 .config "${hdrdest}/.config"
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname "$file")"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find . -name 'Kconfig*')
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname $file)"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform)
-	mkdir -p "${hdrdest}/include"
+	vinstall Makefile 644 "${hdrdest}"
+	vinstall Kbuild 644 "${hdrdest}"
+	vinstall kernel/Makefile 644 "${hdrdest}/kernel"
+	vinstall .config 644 "${hdrdest}"
+	find . -name 'Kconfig*' | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	vmkdir "${hdrdest}/include"
 
 	# Remove firmware stuff provided by the "linux-firmware" pkg.
-	rm -rf "${DESTDIR}/usr/lib/firmware"
+	rm -rf "${_destdir}/usr/lib/firmware"
 
-	for i in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
+	for d in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
 		math-emu media net pcmcia scsi sound trace uapi vdso video xen; do
-		[ -d include/$i ] && cp -a "include/$i" "${hdrdest}/include"
+		[ -d include/$d ] && vcopy "include/$d" "${hdrdest}/include"
 	done
 
 	# Remove helper binaries built for host,
 	# if generated files from the scripts/ directory need to be included,
 	# they need to be copied to ${hdrdest} before this step
 	if [ "$CROSS_BUILD" ]; then
-		make "${makejobs}" ARCH="${_arch}" _mrproper_scripts
+		make "${make_install_args[@]}" _mrproper_scripts
 		# remove host specific objects as well
 		find scripts -name '*.o' -delete
 	fi
 
 	# Copy files necessary for later builds.
-	cp Module.symvers "${hdrdest}"
-	cp -a scripts "${hdrdest}"
-	mkdir -p "${hdrdest}/security/selinux"
-	cp -a security/selinux/include "${hdrdest}/security/selinux"
-	mkdir -p "${hdrdest}/tools/include"
-	cp -a tools/include/tools "${hdrdest}/tools/include"
+	vinstall Module.symvers 644 "${hdrdest}"
+	vcopy scripts "${hdrdest}"
+	vmkdir "${hdrdest}/security/selinux"
+	vcopy security/selinux/include "${hdrdest}/security/selinux"
+	vmkdir "${hdrdest}/tools/include"
+	vcopy tools/include/tools "${hdrdest}/tools/include"
 	if [ -d "arch/${_arch}/tools" ]; then
-		cp -a "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
+		vcopy "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
 	fi
-	cp -a kernel/time/timeconst.bc "${hdrdest}/kernel/time"
-	cp -a kernel/bounds.c "${hdrdest}/kernel"
-	mkdir -p "${hdrdest}/arch/x86/entry/syscalls"
-	cp -a arch/x86/entry/syscalls/syscall_32.tbl "${hdrdest}/arch/x86/entry/syscalls"
+	vinstall kernel/time/timeconst.bc 644 "${hdrdest}/kernel/time"
+	vinstall kernel/bounds.c 644 "${hdrdest}/kernel"
+	vinstall arch/x86/entry/syscalls/syscall_32.tbl 644 "${hdrdest}/arch/x86/entry/syscalls"
 
 	# copy arch includes for external modules
-	mkdir -p "${hdrdest}/arch/${_arch}"
-	cp -a "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
+	vmkdir "${hdrdest}/arch/${_arch}"
+	vcopy "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
 
 	mkdir -p "${hdrdest}/arch/${_arch}/kernel"
-	cp "arch/${_arch}/Makefile" "${hdrdest}/arch/${_arch}"
-	cp "arch/${_arch}/kernel/asm-offsets.s" "${hdrdest}/arch/${_arch}/kernel"
+	vinstall "arch/${_arch}/Makefile" 644 "${hdrdest}/arch/${_arch}"
+	vinstall "arch/${_arch}/kernel/asm-offsets.s" 644 "${hdrdest}/arch/${_arch}/kernel"
 	if [ "$_arch" = "arm64" ] ; then
-		cp -a "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
+		vcopy "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
 	fi
 
 	# Add md headers
-	mkdir -p "${hdrdest}/drivers/md"
-	cp drivers/md/*.h "${hdrdest}/drivers/md"
+	vmkdir "${hdrdest}/drivers/md"
+	vcopy drivers/md/*.h "${hdrdest}/drivers/md"
 
 	# Add inotify.h
-	mkdir -p "${hdrdest}/include/linux"
-	cp include/linux/inotify.h "${hdrdest}/include/linux"
+	vinstall include/linux/inotify.h 644 "${hdrdest}/include/linux"
 
 	# Add wireless headers
-	mkdir -p "${hdrdest}/net/mac80211/"
-	cp net/mac80211/*.h "${hdrdest}/net/mac80211"
+	vmkdir "${hdrdest}/net/mac80211/"
+	vcopy net/mac80211/*.h "${hdrdest}/net/mac80211"
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
-	find "${DESTDIR}" -name '*.ko' | xargs -n1 -P0 gzip -9
+	msg_normal "$_pkg-$version: compressing kernel modules with gzip, please wait...\n"
+	find "${_destdir}" -name '*.ko' | xargs -n1 -P0 gzip -9
 
 	# ... and run depmod again.
-	depmod -b "${DESTDIR}/usr" -F System.map "${_kernver}"
+	depmod -b "${_destdir}/usr" -F System.map "${_kernver}"
+}
+
+do_configure() {
+	local target
+
+	case "$XBPS_TARGET_MACHINE" in
+		# for zero, 1
+		armv6l*) target=bcmrpi_defconfig ;;
+		# for 2
+		armv7l*) target=bcm2709_defconfig ;;
+		# for 3, 4, zero 2, 5
+		aarch64*) target=bcm2711_defconfig ;;
+	esac
+
+	_configure "$target"
+}
+
+do_build() {
+	make "${make_build_args[@]}" prepare
+	make "${make_build_args[@]}" "${_image_target}" modules dtbs
+}
+
+do_install() {
+	_install "$pkgname" "$DESTDIR"
 }
 
 subpackages="rpi-kernel-headers"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv7l*) subpackages+=" rpi2-kernel rpi2-kernel-headers" ;;
-	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers" ;;
+	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers rpi5-kernel rpi5-kernel-headers" ;;
 esac
 
 rpi-kernel-headers_package() {
@@ -264,9 +281,54 @@ rpi-kernel-headers_package() {
 	noverifyrdeps=yes
 	noshlibprovides=yes
 	short_desc="${short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi5-kernel-headers>=0"
 	pkg_install() {
 		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		vmove "usr/lib/modules/${_kernver}/build"
+	}
+}
+
+_rpi5_short_desc="Linux kernel for Raspberry Pi 5 (${version%.*} series)"
+
+rpi5-kernel_package() {
+	nodebug=yes
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	python_version=3
+	triggers="kernel-hooks"
+	# These files could be modified when an external module is built.
+	mutable_files="
+	 /usr/lib/modules/${_kernver}/modules.dep
+	 /usr/lib/modules/${_kernver}/modules.dep.bin
+	 /usr/lib/modules/${_kernver}/modules.symbols
+	 /usr/lib/modules/${_kernver}/modules.symbols.bin
+	 /usr/lib/modules/${_kernver}/modules.alias
+	 /usr/lib/modules/${_kernver}/modules.alias.bin
+	 /usr/lib/modules/${_kernver}/modules.devname"
+	short_desc="$_rpi5_short_desc"
+	provides="rpi-kernel-${version}_${revision}"
+	replaces="rpi-kernel>=0"
+	pkg_install() {
+		_configure "bcm2712_defconfig"
+		make "${make_build_args[@]}" prepare
+		make "${make_build_args[@]}" "${_image_target}" modules dtbs
+		_install "rpi5-kernel" "$PKGDESTDIR"
+	}
+}
+
+rpi5-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="${_rpi5_short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi-kernel-headers>=0"
+	pkg_install() {
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/src" "${PKGDESTDIR}"/usr/src
+		vmkdir "usr/lib/modules/${_kernver}"
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/lib/modules/${_kernver}/build" "${PKGDESTDIR}/usr/lib/modules/${_kernver}/build"
 	}
 }
 
diff --git a/srcpkgs/rpi5-kernel b/srcpkgs/rpi5-kernel
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi5-kernel-headers b/srcpkgs/rpi5-kernel-headers
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

From 3a24060c8125c160856645ebb15b874679e88848 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:05 -0500
Subject: [PATCH 2/4] rpi-firmware: update to 20231102.

add rpi5-specific firmware
---
 srcpkgs/rpi-firmware/template | 40 +++++++++++++----------------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/srcpkgs/rpi-firmware/template b/srcpkgs/rpi-firmware/template
index 0a2efa3b80db0..d251448948f95 100644
--- a/srcpkgs/rpi-firmware/template
+++ b/srcpkgs/rpi-firmware/template
@@ -1,12 +1,12 @@
 # Template file for 'rpi-firmware'
 pkgname=rpi-firmware
-version=20230925
+version=20231102
 revision=1
-_rpi_fw=6b37a457122714aa14b2c7df0926455173fd04f1
-_rpi_bt=9556b08ace2a1735127894642cc8ea6529c04c90
-_rpi_brcm=2c3a8701193ba23d0ef85cdf0d0c9e47baf03dfc
+_rpi_fw=83dafbc92c0e63f76ca2ecdd42462d56489d1c77
+_rpi_bt=d9d4741caba7314d6500f588b1eaa5ab387a4ff5
+_rpi_brcm=88aa085bfa1a4650e1ccd88896f8343c22a24055
 create_wrksrc=yes
-archs="armv6l* armv7l* aarch64*"
+archs="aarch64* armv6l* armv7l*"
 short_desc="Firmware files for the Raspberry Pi"
 maintainer="Piraty <mail@piraty.dev>"
 license="BSD-3-Clause, custom:Cypress"
@@ -14,26 +14,14 @@ homepage="https://github.com/raspberrypi/firmware"
 distfiles="
  https://github.com/raspberrypi/firmware/archive/${_rpi_fw}.tar.gz
  https://github.com/RPi-Distro/firmware-nonfree/archive/${_rpi_brcm}.tar.gz
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430A1.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430B0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C5.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430A1.hcd>BCM43430A1.raspberrypi,model-zero-2-w.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430B0.hcd>BCM43430B0.raspberrypi,model-zero-2-w.hcd
+ https://github.com/RPi-Distro/bluez-firmware/archive/${_rpi_bt}.tar.gz
  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/LICENCE.cypress>LICENCE.cypress"
-checksum="913986b1be22b8dc30a3e6a9b5a28316b1bbee7bec90040ddefff0d7512560f4
- 9156d90116b921d2e7938b52fad84fbe1d96df622a66c5db09569c735832387a
- c096ad4a5c3f06ed7d69eba246bf89ada9acba64a5b6f51b1e9c12f99bb1e1a7
- 51c45e77ddad91a19e96dc8fb75295b2087c279940df2634b23baf71b6dea42c
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
- fb9f4ec2df5301bd35f416384e103c012c5983024c49aa72fbbaf90177512caa
- 55071227c94d86369d04f9aff3bbfd4197a78a53dc350295123e1a8b048bba8f
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
+checksum="dd43e77ca1a8969cdb7f05dd72a57f90862071d5a93bdd6aea8246aba85689cf
+ bb3d8fed40546e03e29d9e635745433f8083391e62d6ff151c895b892776964a
+ ae076a08ece89624b0449ea2495b0dfe2ea1223f683f5b57f2b89966e6a093d6
  ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f"
 
-skip_extraction="BCM43430A1.hcd BCM4345C0.hcd BCM43430B0.hcd BCM4345C5.hcd
- BCM43430A1.raspberrypi,model-zero-2-w.hcd BCM43430B0.raspberrypi,model-zero-2-w.hcd
- LICENCE.cypress"
+skip_extraction="LICENCE.cypress"
 
 provides="linux-firmware-broadcom-${version}_${revision}"
 replaces="linux-firmware-broadcom>=0"
@@ -72,7 +60,9 @@ do_install() {
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43456"* usr/lib/firmware/brcm
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43436"* usr/lib/firmware/brcm
 
-	for file in "${XBPS_SRCDISTDIR}/${pkgname}-${version}/"*.hcd; do
-		vinstall "$file" 0644 usr/lib/firmware/brcm
-	done
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/broadcom/"*.hcd usr/lib/firmware/brcm
+
+	vmkdir usr/lib/firmware/synaptics
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/"*.hcd usr/lib/firmware/synaptics
+	vlicense "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/LICENSE.synaptics"
 }

From 4d8c9a915a481966d09bd74553f7860801c20773 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:48 -0500
Subject: [PATCH 3/4] New package: rpi-utils-20231105

replaces rpi-userland:
https://github.com/raspberrypi/userland/blob/master/README.md
---
 .../rpi-utils/patches/no-overlaycheck.patch   | 14 +++++++++++++
 srcpkgs/rpi-utils/template                    | 20 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 srcpkgs/rpi-utils/patches/no-overlaycheck.patch
 create mode 100644 srcpkgs/rpi-utils/template

diff --git a/srcpkgs/rpi-utils/patches/no-overlaycheck.patch b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
new file mode 100644
index 0000000000000..3e64958e238d2
--- /dev/null
+++ b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
@@ -0,0 +1,14 @@
+This program is not very useful as a downstream, it seems to be only intended
+for internal QA. It also has a lot of weird things like hardcoding the prefixed
+cpp to use and putting a text file in /usr/bin.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,6 @@
+ # List of subsidiary CMakeLists
+ add_subdirectory(dtmerge)
+ add_subdirectory(otpset)
+-add_subdirectory(overlaycheck)
+ add_subdirectory(ovmerge)
+ add_subdirectory(pinctrl)
+ add_subdirectory(raspinfo)
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
new file mode 100644
index 0000000000000..bbb7472b72a33
--- /dev/null
+++ b/srcpkgs/rpi-utils/template
@@ -0,0 +1,20 @@
+# Template file for 'rpi-utils'
+pkgname=rpi-utils
+version=20231105
+revision=1
+_commit=84b1831fe16b784fb3e5bfbacf76b42a821ae720
+archs="armv6l* armv7l* aarch64*"
+build_style=cmake
+makedepends="dtc-devel"
+depends="python3 perl bash"
+short_desc="Collection of utilities for Raspberry Pi"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="BSD-3-Clause"
+homepage="https://github.com/raspberrypi/utils"
+distfiles="https://github.com/raspberrypi/utils/archive/${_commit}.tar.gz"
+checksum=c97ad394e1694f41c2c6748b6e78621c74a51f20bf006c9579267f68d3157563
+python_version=3
+
+post_install() {
+	vlicense LICENCE
+}

From 2c1669a96945e0b0538d87dd544d3301309cf3aa Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:51:52 -0500
Subject: [PATCH 4/4] rpi-eeprom: update to 2023.11.09.

- install manpages (like is done in the debian rules)
- adds rpi5 firmware
---
 srcpkgs/rpi-eeprom/template | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/rpi-eeprom/template b/srcpkgs/rpi-eeprom/template
index fb017a50966cd..55b7d396efeb5 100644
--- a/srcpkgs/rpi-eeprom/template
+++ b/srcpkgs/rpi-eeprom/template
@@ -1,17 +1,18 @@
 # Template file for 'rpi-eeprom'
 pkgname=rpi-eeprom
-version=2023.09.29
+version=2023.11.09
 revision=1
-_githash="4f2d676b4e2a9c2d9ee1ab42015ce711fde97afa"
-archs="armv7* aarch64*"
+_githash="6b14e84a2fb2e1f7220a404f65e7e0985f07c9e5"
+archs="armv7l* aarch64*"
 conf_files="/etc/default/rpi-eeprom-update"
-depends="binutils pciutils python3 rpi-firmware rpi-userland"
-short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4"
+hostmakedepends="help2man python3"
+depends="binutils pciutils python3 rpi-firmware rpi-utils"
+short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4/5"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="BSD-3-Clause, custom:Proprietary"
 homepage="https://github.com/raspberrypi/rpi-eeprom/"
 distfiles="https://github.com/raspberrypi/rpi-eeprom/archive/${_githash}.tar.gz"
-checksum="189c5d37f3102247cec72619e3cb357d027ec526fa3c7373d3107bd6c9e30e29"
+checksum=3907711bb2ff78a0e9120709b72b04d6d010f93f79d525af0454d3d27a772aca
 python_version=3
 repository=nonfree
 
@@ -21,9 +22,20 @@ do_install() {
 	vbin rpi-eeprom-digest
 	vinstall rpi-eeprom-update-default 644 etc/default rpi-eeprom-update
 
-	vmkdir usr/lib/firmware/raspberrypi/bootloader
-	# need to figure out how to package both pi4 (2711) and pi5 (2712) fw
-	vcopy firmware-2711/* usr/lib/firmware/raspberrypi/bootloader/
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Checks whether the Raspberry Pi bootloader EEPROM is up-to-date and updates the EEPROM" \
+		--output=rpi-eeprom-update.1 ./rpi-eeprom-update
+	vman rpi-eeprom-update.1
+
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Bootloader EEPROM configuration tool for the Raspberry Pi 4/5" \
+		--output=rpi-eeprom-config.1 ./rpi-eeprom-config
+	vman rpi-eeprom-config.1
+
+	for soc in 2711 2712; do
+		vmkdir usr/lib/firmware/raspberrypi/bootloader-"$soc"
+		vcopy firmware-"$soc"/* usr/lib/firmware/raspberrypi/bootloader-"$soc"/
+	done
 
 	vlicense LICENSE
 }

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
  2023-11-18  4:02 ` [PR PATCH] [Updated] " classabbyamp
  2023-11-18 19:54 ` classabbyamp
@ 2023-11-19 19:19 ` classabbyamp
  2023-11-20  3:17 ` classabbyamp
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2023-11-19 19:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages rpi5
https://github.com/void-linux/void-packages/pull/47288

rpi-*: update and support rpi5
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES**
  - [ ] 1B+ (armv6l)
  - [ ] 0 (armv6l)
  - [ ] 1A+ (armv6l)
  - [ ] 2B (armv7l)
  - [ ] 3B (aarch64)
  - [ ] 02W (aarch64)
  - [x] 4B (aarch64)
  - [x] 5 (aarch64)

### Prebuilt packages and RPi5-compatible install images for testing

**packages:** https://files.placeviolette.net/rpi5

```
`https://files.placeviolette.net/rpi5' repository has been RSA signed by "classabbyamp"
Fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
```
**images:** https://files.placeviolette.net/rpi5-live

`rpi5-kernel` is not installed by default on these images, but can be seamlessly switched to by installing it. it will uninstall  `rpi-kernel` (and vice-versa). RPi5 is compatible with both, but `rpi5-kernel` may provide some performance benefits.

The images also include the changes from void-linux/void-mklive#361

[ci skip]

closes #46815 
closes #46522 

A patch file from https://github.com/void-linux/void-packages/pull/47288.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi5-47288.patch --]
[-- Type: text/x-diff, Size: 22009 bytes --]

From bfe5fabeec53b84b205459c14d7b83ebd917117a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:48:03 -0500
Subject: [PATCH 1/4] rpi-kernel: update to 6.1.62, adopt.

- add rpi5 support and optimised kernel
- add support for BTRFS root
- add /proc/config.gz by default
---
 srcpkgs/rpi-kernel/template | 225 +++++++++++++++++++++++-------------
 srcpkgs/rpi5-kernel         |   1 +
 srcpkgs/rpi5-kernel-headers |   1 +
 3 files changed, 146 insertions(+), 81 deletions(-)
 create mode 120000 srcpkgs/rpi5-kernel
 create mode 120000 srcpkgs/rpi5-kernel-headers

diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 2fa1bb54b683e..10246a3f61ee5 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -12,19 +12,21 @@
 #
 # Upstream documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html
 pkgname=rpi-kernel
-version=6.1.54
+version=6.1.62
 revision=1
-_githash=fad58933544bb2a7b7db92847c25c79a83171fa6
+_githash=3fdb0eb8be5803a16fc308b8441cdcdeafbb944e
 archs="armv6l* armv7l* aarch64*"
 hostmakedepends="perl kmod uboot-mkimage openssl-devel bc bison flex xz"
 makedepends="ncurses-devel"
 short_desc="Linux kernel for Raspberry Pi (${version%.*} series)"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="GPL-2.0-only"
 homepage="http://www.kernel.org"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
-checksum=1bd02902fae49351fb16ac0d5ccc3bf4d67aa0640006dbbf8846963519b01ab8
+checksum=a44b7d642fc2d80a8cfd05d0b461ecbff019680932754b3f9190bb22be9b8fe2
 python_version=3
+provides="rpi-kernel-${version}_${revision}"
+replaces="rpi5-kernel>=0"
 
 _kernver="${version}_${revision}"
 
@@ -51,28 +53,20 @@ case "$XBPS_TARGET_MACHINE" in
 	*) broken="No Raspberry Pi exists for this arch" ;;
 esac
 
+make_build_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+make_install_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+
 if [ "$CROSS_BUILD" ]; then
-	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
-else
-	_cross=
+	make_build_args+=("CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-")
 fi
 
-do_configure() {
-	local target defconfig
-
-	case "$XBPS_TARGET_MACHINE" in
-		# for zero, 1
-		armv6l*) target=bcmrpi_defconfig ;;
-		# for 2
-		armv7l*) target=bcm2709_defconfig ;;
-		# for 3, 4, zero 2
-		aarch64*) target=bcm2711_defconfig ;;
-	esac
+_configure() {
+	local target="$1" defconfig
 
 	defconfig="arch/${_arch}/configs/${target}"
 	cp "$defconfig" .config
 
-	cat <<-! > "foo"
+	cat <<-! > void.config
 	CONFIG_CONNECTOR=y
 	CONFIG_HID_STEAM=y
 	CONFIG_PROC_EVENTS=y
@@ -113,15 +107,21 @@ do_configure() {
 	CONFIG_LZ4_COMPRESS=y
 	CONFIG_CRYPTO_RNG=y
 	CONFIG_CRYPTO_RNG_DEFAULT=y
+	CONFIG_BTRFS_FS=y
+	CONFIG_BTRFS_POSIX_ACL=y
+	CONFIG_IKCONFIG=y
+	CONFIG_IKCONFIG_PROC=y
+	CONFIG_LEDS_TRIGGER_ACTIVITY=m
 	!
 
 	while read -r line; do
+		local option="" str="" cmd=""
 		# skip comments
 		case "$line" in
 			"#"*) continue;;
 		esac
-		local option=${line%%=*} str=
-		local cmd="$(echo "$line" | cut -d= -f2)"
+		option="${line%%=*}"
+		cmd="$(echo "$line" | cut -d= -f2)"
 		case "$cmd" in
 			y) cmd="enable";;
 			n) cmd="disable";;
@@ -135,31 +135,27 @@ do_configure() {
 		./scripts/config \
 			--file .config \
 			"--$cmd" "$option" "${str//\"/}"
-	done < foo
+	done < void.config
 
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" olddefconfig
+	make "${make_build_args[@]}" olddefconfig
 }
 
-do_build() {
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" prepare
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" "${_image_target}" modules dtbs
-}
-
-do_install() {
-	local hdrdest="${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}"
+_install() {
+	local _pkg="$1" _destdir="$2"
+	local hdrdest="usr/src/${_pkg}-headers-${_kernver}"
 
 	# Run depmod after compressing modules.
 	vsed -i -e '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
-	make "${makejobs}" ARCH="${_arch}" INSTALL_MOD_PATH="${DESTDIR}" modules_install
+	make "${make_install_args[@]}" INSTALL_MOD_PATH="${_destdir}" modules_install
 
 	# Install device tree blobs
-	make "${makejobs}" "ARCH=${_arch}" INSTALL_DTBS_PATH="${DESTDIR}/boot" dtbs_install
+	make "${make_install_args[@]}" INSTALL_DTBS_PATH="${_destdir}/boot" dtbs_install
 
 	# move dtbs that ended up in /boot/broadcom
-	if [ -d "${DESTDIR}/boot/broadcom" ]; then
-		mv "${DESTDIR}"/boot/broadcom/*dtb "${DESTDIR}/boot"
+	if [ -d "${_destdir}/boot/broadcom" ]; then
+		mv "${_destdir}"/boot/broadcom/*dtb "${_destdir}/boot"
 	fi
 
 	# Install kernel image
@@ -167,96 +163,118 @@ do_install() {
 
 	# Switch to /usr.
 	vmkdir usr
-	mv "${DESTDIR}/lib" "${DESTDIR}/usr"
+	mv "${_destdir}/lib" "${_destdir}/usr"
 
-	pushd "${DESTDIR}/usr/lib/modules/${_kernver}"
+	pushd "${_destdir}/usr/lib/modules/${_kernver}"
 	rm -f source build
-	ln -sf "../../../src/${sourcepkg}-headers-${_kernver}" build
+	ln -sf "../../../src/${_pkg}-headers-${_kernver}" build
 	popd
 
 	# Install required headers to build external modules
-	install -Dm644 Makefile "${hdrdest}/Makefile"
-	install -Dm644 Kbuild "${hdrdest}/Kbuild"
-	install -Dm644 kernel/Makefile "${hdrdest}/kernel/Makefile"
-	install -Dm644 .config "${hdrdest}/.config"
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname "$file")"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find . -name 'Kconfig*')
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname $file)"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform)
-	mkdir -p "${hdrdest}/include"
+	vinstall Makefile 644 "${hdrdest}"
+	vinstall Kbuild 644 "${hdrdest}"
+	vinstall kernel/Makefile 644 "${hdrdest}/kernel"
+	vinstall .config 644 "${hdrdest}"
+	find . -name 'Kconfig*' | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	vmkdir "${hdrdest}/include"
 
 	# Remove firmware stuff provided by the "linux-firmware" pkg.
-	rm -rf "${DESTDIR}/usr/lib/firmware"
+	rm -rf "${_destdir}/usr/lib/firmware"
 
-	for i in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
+	for d in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
 		math-emu media net pcmcia scsi sound trace uapi vdso video xen; do
-		[ -d include/$i ] && cp -a "include/$i" "${hdrdest}/include"
+		[ -d include/$d ] && vcopy "include/$d" "${hdrdest}/include"
 	done
 
 	# Remove helper binaries built for host,
 	# if generated files from the scripts/ directory need to be included,
 	# they need to be copied to ${hdrdest} before this step
 	if [ "$CROSS_BUILD" ]; then
-		make "${makejobs}" ARCH="${_arch}" _mrproper_scripts
+		make "${make_install_args[@]}" _mrproper_scripts
 		# remove host specific objects as well
 		find scripts -name '*.o' -delete
 	fi
 
 	# Copy files necessary for later builds.
-	cp Module.symvers "${hdrdest}"
-	cp -a scripts "${hdrdest}"
-	mkdir -p "${hdrdest}/security/selinux"
-	cp -a security/selinux/include "${hdrdest}/security/selinux"
-	mkdir -p "${hdrdest}/tools/include"
-	cp -a tools/include/tools "${hdrdest}/tools/include"
+	vinstall Module.symvers 644 "${hdrdest}"
+	vcopy scripts "${hdrdest}"
+	vmkdir "${hdrdest}/security/selinux"
+	vcopy security/selinux/include "${hdrdest}/security/selinux"
+	vmkdir "${hdrdest}/tools/include"
+	vcopy tools/include/tools "${hdrdest}/tools/include"
 	if [ -d "arch/${_arch}/tools" ]; then
-		cp -a "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
+		vcopy "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
 	fi
-	cp -a kernel/time/timeconst.bc "${hdrdest}/kernel/time"
-	cp -a kernel/bounds.c "${hdrdest}/kernel"
-	mkdir -p "${hdrdest}/arch/x86/entry/syscalls"
-	cp -a arch/x86/entry/syscalls/syscall_32.tbl "${hdrdest}/arch/x86/entry/syscalls"
+	vinstall kernel/time/timeconst.bc 644 "${hdrdest}/kernel/time"
+	vinstall kernel/bounds.c 644 "${hdrdest}/kernel"
+	vinstall arch/x86/entry/syscalls/syscall_32.tbl 644 "${hdrdest}/arch/x86/entry/syscalls"
 
 	# copy arch includes for external modules
-	mkdir -p "${hdrdest}/arch/${_arch}"
-	cp -a "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
+	vmkdir "${hdrdest}/arch/${_arch}"
+	vcopy "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
 
 	mkdir -p "${hdrdest}/arch/${_arch}/kernel"
-	cp "arch/${_arch}/Makefile" "${hdrdest}/arch/${_arch}"
-	cp "arch/${_arch}/kernel/asm-offsets.s" "${hdrdest}/arch/${_arch}/kernel"
+	vinstall "arch/${_arch}/Makefile" 644 "${hdrdest}/arch/${_arch}"
+	vinstall "arch/${_arch}/kernel/asm-offsets.s" 644 "${hdrdest}/arch/${_arch}/kernel"
 	if [ "$_arch" = "arm64" ] ; then
-		cp -a "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
+		vcopy "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
 	fi
 
 	# Add md headers
-	mkdir -p "${hdrdest}/drivers/md"
-	cp drivers/md/*.h "${hdrdest}/drivers/md"
+	vmkdir "${hdrdest}/drivers/md"
+	vcopy drivers/md/*.h "${hdrdest}/drivers/md"
 
 	# Add inotify.h
-	mkdir -p "${hdrdest}/include/linux"
-	cp include/linux/inotify.h "${hdrdest}/include/linux"
+	vinstall include/linux/inotify.h 644 "${hdrdest}/include/linux"
 
 	# Add wireless headers
-	mkdir -p "${hdrdest}/net/mac80211/"
-	cp net/mac80211/*.h "${hdrdest}/net/mac80211"
+	vmkdir "${hdrdest}/net/mac80211/"
+	vcopy net/mac80211/*.h "${hdrdest}/net/mac80211"
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
-	find "${DESTDIR}" -name '*.ko' | xargs -n1 -P0 gzip -9
+	msg_normal "$_pkg-$version: compressing kernel modules with gzip, please wait...\n"
+	find "${_destdir}" -name '*.ko' | xargs -n1 -P0 gzip -9
 
 	# ... and run depmod again.
-	depmod -b "${DESTDIR}/usr" -F System.map "${_kernver}"
+	depmod -b "${_destdir}/usr" -F System.map "${_kernver}"
+}
+
+do_configure() {
+	local target
+
+	case "$XBPS_TARGET_MACHINE" in
+		# for zero, 1
+		armv6l*) target=bcmrpi_defconfig ;;
+		# for 2
+		armv7l*) target=bcm2709_defconfig ;;
+		# for 3, 4, zero 2, 5
+		aarch64*) target=bcm2711_defconfig ;;
+	esac
+
+	_configure "$target"
+}
+
+do_build() {
+	make "${make_build_args[@]}" prepare
+	make "${make_build_args[@]}" "${_image_target}" modules dtbs
+}
+
+do_install() {
+	_install "$pkgname" "$DESTDIR"
 }
 
 subpackages="rpi-kernel-headers"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv7l*) subpackages+=" rpi2-kernel rpi2-kernel-headers" ;;
-	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers" ;;
+	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers rpi5-kernel rpi5-kernel-headers" ;;
 esac
 
 rpi-kernel-headers_package() {
@@ -264,9 +282,54 @@ rpi-kernel-headers_package() {
 	noverifyrdeps=yes
 	noshlibprovides=yes
 	short_desc="${short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi5-kernel-headers>=0"
 	pkg_install() {
 		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		vmove "usr/lib/modules/${_kernver}/build"
+	}
+}
+
+_rpi5_short_desc="Linux kernel for Raspberry Pi 5 (${version%.*} series)"
+
+rpi5-kernel_package() {
+	nodebug=yes
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	python_version=3
+	triggers="kernel-hooks"
+	# These files could be modified when an external module is built.
+	mutable_files="
+	 /usr/lib/modules/${_kernver}/modules.dep
+	 /usr/lib/modules/${_kernver}/modules.dep.bin
+	 /usr/lib/modules/${_kernver}/modules.symbols
+	 /usr/lib/modules/${_kernver}/modules.symbols.bin
+	 /usr/lib/modules/${_kernver}/modules.alias
+	 /usr/lib/modules/${_kernver}/modules.alias.bin
+	 /usr/lib/modules/${_kernver}/modules.devname"
+	short_desc="$_rpi5_short_desc"
+	provides="rpi-kernel-${version}_${revision}"
+	replaces="rpi-kernel>=0"
+	pkg_install() {
+		_configure "bcm2712_defconfig"
+		make "${make_build_args[@]}" prepare
+		make "${make_build_args[@]}" "${_image_target}" modules dtbs
+		_install "rpi5-kernel" "$PKGDESTDIR"
+	}
+}
+
+rpi5-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="${_rpi5_short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi-kernel-headers>=0"
+	pkg_install() {
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/src" "${PKGDESTDIR}"/usr/src
+		vmkdir "usr/lib/modules/${_kernver}"
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/lib/modules/${_kernver}/build" "${PKGDESTDIR}/usr/lib/modules/${_kernver}/build"
 	}
 }
 
diff --git a/srcpkgs/rpi5-kernel b/srcpkgs/rpi5-kernel
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi5-kernel-headers b/srcpkgs/rpi5-kernel-headers
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

From ab029a1f5907d926188b9a34f6132b4b98d93620 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:05 -0500
Subject: [PATCH 2/4] rpi-firmware: update to 20231102, adopt.

add rpi5-specific firmware
---
 srcpkgs/rpi-firmware/template | 42 +++++++++++++----------------------
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/srcpkgs/rpi-firmware/template b/srcpkgs/rpi-firmware/template
index 0a2efa3b80db0..606b010bda7e4 100644
--- a/srcpkgs/rpi-firmware/template
+++ b/srcpkgs/rpi-firmware/template
@@ -1,39 +1,27 @@
 # Template file for 'rpi-firmware'
 pkgname=rpi-firmware
-version=20230925
+version=20231102
 revision=1
-_rpi_fw=6b37a457122714aa14b2c7df0926455173fd04f1
-_rpi_bt=9556b08ace2a1735127894642cc8ea6529c04c90
-_rpi_brcm=2c3a8701193ba23d0ef85cdf0d0c9e47baf03dfc
+_rpi_fw=83dafbc92c0e63f76ca2ecdd42462d56489d1c77
+_rpi_bt=d9d4741caba7314d6500f588b1eaa5ab387a4ff5
+_rpi_brcm=88aa085bfa1a4650e1ccd88896f8343c22a24055
 create_wrksrc=yes
-archs="armv6l* armv7l* aarch64*"
+archs="aarch64* armv6l* armv7l*"
 short_desc="Firmware files for the Raspberry Pi"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="BSD-3-Clause, custom:Cypress"
 homepage="https://github.com/raspberrypi/firmware"
 distfiles="
  https://github.com/raspberrypi/firmware/archive/${_rpi_fw}.tar.gz
  https://github.com/RPi-Distro/firmware-nonfree/archive/${_rpi_brcm}.tar.gz
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430A1.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430B0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C5.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430A1.hcd>BCM43430A1.raspberrypi,model-zero-2-w.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430B0.hcd>BCM43430B0.raspberrypi,model-zero-2-w.hcd
+ https://github.com/RPi-Distro/bluez-firmware/archive/${_rpi_bt}.tar.gz
  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/LICENCE.cypress>LICENCE.cypress"
-checksum="913986b1be22b8dc30a3e6a9b5a28316b1bbee7bec90040ddefff0d7512560f4
- 9156d90116b921d2e7938b52fad84fbe1d96df622a66c5db09569c735832387a
- c096ad4a5c3f06ed7d69eba246bf89ada9acba64a5b6f51b1e9c12f99bb1e1a7
- 51c45e77ddad91a19e96dc8fb75295b2087c279940df2634b23baf71b6dea42c
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
- fb9f4ec2df5301bd35f416384e103c012c5983024c49aa72fbbaf90177512caa
- 55071227c94d86369d04f9aff3bbfd4197a78a53dc350295123e1a8b048bba8f
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
+checksum="dd43e77ca1a8969cdb7f05dd72a57f90862071d5a93bdd6aea8246aba85689cf
+ bb3d8fed40546e03e29d9e635745433f8083391e62d6ff151c895b892776964a
+ ae076a08ece89624b0449ea2495b0dfe2ea1223f683f5b57f2b89966e6a093d6
  ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f"
 
-skip_extraction="BCM43430A1.hcd BCM4345C0.hcd BCM43430B0.hcd BCM4345C5.hcd
- BCM43430A1.raspberrypi,model-zero-2-w.hcd BCM43430B0.raspberrypi,model-zero-2-w.hcd
- LICENCE.cypress"
+skip_extraction="LICENCE.cypress"
 
 provides="linux-firmware-broadcom-${version}_${revision}"
 replaces="linux-firmware-broadcom>=0"
@@ -72,7 +60,9 @@ do_install() {
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43456"* usr/lib/firmware/brcm
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43436"* usr/lib/firmware/brcm
 
-	for file in "${XBPS_SRCDISTDIR}/${pkgname}-${version}/"*.hcd; do
-		vinstall "$file" 0644 usr/lib/firmware/brcm
-	done
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/broadcom/"*.hcd usr/lib/firmware/brcm
+
+	vmkdir usr/lib/firmware/synaptics
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/"*.hcd usr/lib/firmware/synaptics
+	vlicense "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/LICENSE.synaptics"
 }

From 2aaafeb078ad2b653ee669bf94cccb829b2c7eb8 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:48 -0500
Subject: [PATCH 3/4] New package: rpi-utils-20231105

replaces rpi-userland:
https://github.com/raspberrypi/userland/blob/master/README.md
---
 .../rpi-utils/patches/no-overlaycheck.patch   | 14 +++++++++++++
 srcpkgs/rpi-utils/template                    | 20 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 srcpkgs/rpi-utils/patches/no-overlaycheck.patch
 create mode 100644 srcpkgs/rpi-utils/template

diff --git a/srcpkgs/rpi-utils/patches/no-overlaycheck.patch b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
new file mode 100644
index 0000000000000..3e64958e238d2
--- /dev/null
+++ b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
@@ -0,0 +1,14 @@
+This program is not very useful as a downstream, it seems to be only intended
+for internal QA. It also has a lot of weird things like hardcoding the prefixed
+cpp to use and putting a text file in /usr/bin.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,6 @@
+ # List of subsidiary CMakeLists
+ add_subdirectory(dtmerge)
+ add_subdirectory(otpset)
+-add_subdirectory(overlaycheck)
+ add_subdirectory(ovmerge)
+ add_subdirectory(pinctrl)
+ add_subdirectory(raspinfo)
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
new file mode 100644
index 0000000000000..bbb7472b72a33
--- /dev/null
+++ b/srcpkgs/rpi-utils/template
@@ -0,0 +1,20 @@
+# Template file for 'rpi-utils'
+pkgname=rpi-utils
+version=20231105
+revision=1
+_commit=84b1831fe16b784fb3e5bfbacf76b42a821ae720
+archs="armv6l* armv7l* aarch64*"
+build_style=cmake
+makedepends="dtc-devel"
+depends="python3 perl bash"
+short_desc="Collection of utilities for Raspberry Pi"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="BSD-3-Clause"
+homepage="https://github.com/raspberrypi/utils"
+distfiles="https://github.com/raspberrypi/utils/archive/${_commit}.tar.gz"
+checksum=c97ad394e1694f41c2c6748b6e78621c74a51f20bf006c9579267f68d3157563
+python_version=3
+
+post_install() {
+	vlicense LICENCE
+}

From d990a9bbf89181baef9e85e75743f663383ed019 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:51:52 -0500
Subject: [PATCH 4/4] rpi-eeprom: update to 2023.11.09.

- install manpages (like is done in the debian rules)
- adds rpi5 firmware
---
 srcpkgs/rpi-eeprom/template | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/rpi-eeprom/template b/srcpkgs/rpi-eeprom/template
index fb017a50966cd..55b7d396efeb5 100644
--- a/srcpkgs/rpi-eeprom/template
+++ b/srcpkgs/rpi-eeprom/template
@@ -1,17 +1,18 @@
 # Template file for 'rpi-eeprom'
 pkgname=rpi-eeprom
-version=2023.09.29
+version=2023.11.09
 revision=1
-_githash="4f2d676b4e2a9c2d9ee1ab42015ce711fde97afa"
-archs="armv7* aarch64*"
+_githash="6b14e84a2fb2e1f7220a404f65e7e0985f07c9e5"
+archs="armv7l* aarch64*"
 conf_files="/etc/default/rpi-eeprom-update"
-depends="binutils pciutils python3 rpi-firmware rpi-userland"
-short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4"
+hostmakedepends="help2man python3"
+depends="binutils pciutils python3 rpi-firmware rpi-utils"
+short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4/5"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="BSD-3-Clause, custom:Proprietary"
 homepage="https://github.com/raspberrypi/rpi-eeprom/"
 distfiles="https://github.com/raspberrypi/rpi-eeprom/archive/${_githash}.tar.gz"
-checksum="189c5d37f3102247cec72619e3cb357d027ec526fa3c7373d3107bd6c9e30e29"
+checksum=3907711bb2ff78a0e9120709b72b04d6d010f93f79d525af0454d3d27a772aca
 python_version=3
 repository=nonfree
 
@@ -21,9 +22,20 @@ do_install() {
 	vbin rpi-eeprom-digest
 	vinstall rpi-eeprom-update-default 644 etc/default rpi-eeprom-update
 
-	vmkdir usr/lib/firmware/raspberrypi/bootloader
-	# need to figure out how to package both pi4 (2711) and pi5 (2712) fw
-	vcopy firmware-2711/* usr/lib/firmware/raspberrypi/bootloader/
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Checks whether the Raspberry Pi bootloader EEPROM is up-to-date and updates the EEPROM" \
+		--output=rpi-eeprom-update.1 ./rpi-eeprom-update
+	vman rpi-eeprom-update.1
+
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Bootloader EEPROM configuration tool for the Raspberry Pi 4/5" \
+		--output=rpi-eeprom-config.1 ./rpi-eeprom-config
+	vman rpi-eeprom-config.1
+
+	for soc in 2711 2712; do
+		vmkdir usr/lib/firmware/raspberrypi/bootloader-"$soc"
+		vcopy firmware-"$soc"/* usr/lib/firmware/raspberrypi/bootloader-"$soc"/
+	done
 
 	vlicense LICENSE
 }

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (2 preceding siblings ...)
  2023-11-19 19:19 ` classabbyamp
@ 2023-11-20  3:17 ` classabbyamp
  2023-11-21 11:57 ` 0x5c
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2023-11-20  3:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages rpi5
https://github.com/void-linux/void-packages/pull/47288

rpi-*: update and support rpi5
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES**
  - [ ] 1B+ (armv6l)
  - [ ] 0 (armv6l)
  - [ ] 1A+ (armv6l)
  - [ ] 2B (armv7l)
  - [ ] 3B (aarch64)
  - [ ] 02W (aarch64)
  - [x] 4B (aarch64)
  - [x] 5 (aarch64)

### Prebuilt packages and RPi5-compatible install images for testing

**packages:** https://files.placeviolette.net/rpi5

```
`https://files.placeviolette.net/rpi5' repository has been RSA signed by "classabbyamp"
Fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
```
**images:** https://files.placeviolette.net/rpi5-live

`rpi5-kernel` is not installed by default on these images, but can be seamlessly switched to by installing it. it will uninstall  `rpi-kernel` (and vice-versa). RPi5 is compatible with both, but `rpi5-kernel` may provide some performance benefits.

The images also include the changes from void-linux/void-mklive#361

[ci skip]

closes #46815 
closes #46522 

A patch file from https://github.com/void-linux/void-packages/pull/47288.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi5-47288.patch --]
[-- Type: text/x-diff, Size: 22376 bytes --]

From baef55b297685589dcdbe611eda4207a5eb2cf87 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:48:03 -0500
Subject: [PATCH 1/4] rpi-kernel: update to 6.1.62, adopt.

- add rpi5 support and optimised kernel
- add support for BTRFS root
- add /proc/config.gz by default
---
 srcpkgs/rpi-kernel/template | 225 +++++++++++++++++++++++-------------
 srcpkgs/rpi-kernel/update   |   2 +
 srcpkgs/rpi5-kernel         |   1 +
 srcpkgs/rpi5-kernel-headers |   1 +
 4 files changed, 148 insertions(+), 81 deletions(-)
 create mode 100644 srcpkgs/rpi-kernel/update
 create mode 120000 srcpkgs/rpi5-kernel
 create mode 120000 srcpkgs/rpi5-kernel-headers

diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 2fa1bb54b683e..10246a3f61ee5 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -12,19 +12,21 @@
 #
 # Upstream documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html
 pkgname=rpi-kernel
-version=6.1.54
+version=6.1.62
 revision=1
-_githash=fad58933544bb2a7b7db92847c25c79a83171fa6
+_githash=3fdb0eb8be5803a16fc308b8441cdcdeafbb944e
 archs="armv6l* armv7l* aarch64*"
 hostmakedepends="perl kmod uboot-mkimage openssl-devel bc bison flex xz"
 makedepends="ncurses-devel"
 short_desc="Linux kernel for Raspberry Pi (${version%.*} series)"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="GPL-2.0-only"
 homepage="http://www.kernel.org"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
-checksum=1bd02902fae49351fb16ac0d5ccc3bf4d67aa0640006dbbf8846963519b01ab8
+checksum=a44b7d642fc2d80a8cfd05d0b461ecbff019680932754b3f9190bb22be9b8fe2
 python_version=3
+provides="rpi-kernel-${version}_${revision}"
+replaces="rpi5-kernel>=0"
 
 _kernver="${version}_${revision}"
 
@@ -51,28 +53,20 @@ case "$XBPS_TARGET_MACHINE" in
 	*) broken="No Raspberry Pi exists for this arch" ;;
 esac
 
+make_build_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+make_install_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+
 if [ "$CROSS_BUILD" ]; then
-	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
-else
-	_cross=
+	make_build_args+=("CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-")
 fi
 
-do_configure() {
-	local target defconfig
-
-	case "$XBPS_TARGET_MACHINE" in
-		# for zero, 1
-		armv6l*) target=bcmrpi_defconfig ;;
-		# for 2
-		armv7l*) target=bcm2709_defconfig ;;
-		# for 3, 4, zero 2
-		aarch64*) target=bcm2711_defconfig ;;
-	esac
+_configure() {
+	local target="$1" defconfig
 
 	defconfig="arch/${_arch}/configs/${target}"
 	cp "$defconfig" .config
 
-	cat <<-! > "foo"
+	cat <<-! > void.config
 	CONFIG_CONNECTOR=y
 	CONFIG_HID_STEAM=y
 	CONFIG_PROC_EVENTS=y
@@ -113,15 +107,21 @@ do_configure() {
 	CONFIG_LZ4_COMPRESS=y
 	CONFIG_CRYPTO_RNG=y
 	CONFIG_CRYPTO_RNG_DEFAULT=y
+	CONFIG_BTRFS_FS=y
+	CONFIG_BTRFS_POSIX_ACL=y
+	CONFIG_IKCONFIG=y
+	CONFIG_IKCONFIG_PROC=y
+	CONFIG_LEDS_TRIGGER_ACTIVITY=m
 	!
 
 	while read -r line; do
+		local option="" str="" cmd=""
 		# skip comments
 		case "$line" in
 			"#"*) continue;;
 		esac
-		local option=${line%%=*} str=
-		local cmd="$(echo "$line" | cut -d= -f2)"
+		option="${line%%=*}"
+		cmd="$(echo "$line" | cut -d= -f2)"
 		case "$cmd" in
 			y) cmd="enable";;
 			n) cmd="disable";;
@@ -135,31 +135,27 @@ do_configure() {
 		./scripts/config \
 			--file .config \
 			"--$cmd" "$option" "${str//\"/}"
-	done < foo
+	done < void.config
 
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" olddefconfig
+	make "${make_build_args[@]}" olddefconfig
 }
 
-do_build() {
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" prepare
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" "${_image_target}" modules dtbs
-}
-
-do_install() {
-	local hdrdest="${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}"
+_install() {
+	local _pkg="$1" _destdir="$2"
+	local hdrdest="usr/src/${_pkg}-headers-${_kernver}"
 
 	# Run depmod after compressing modules.
 	vsed -i -e '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
-	make "${makejobs}" ARCH="${_arch}" INSTALL_MOD_PATH="${DESTDIR}" modules_install
+	make "${make_install_args[@]}" INSTALL_MOD_PATH="${_destdir}" modules_install
 
 	# Install device tree blobs
-	make "${makejobs}" "ARCH=${_arch}" INSTALL_DTBS_PATH="${DESTDIR}/boot" dtbs_install
+	make "${make_install_args[@]}" INSTALL_DTBS_PATH="${_destdir}/boot" dtbs_install
 
 	# move dtbs that ended up in /boot/broadcom
-	if [ -d "${DESTDIR}/boot/broadcom" ]; then
-		mv "${DESTDIR}"/boot/broadcom/*dtb "${DESTDIR}/boot"
+	if [ -d "${_destdir}/boot/broadcom" ]; then
+		mv "${_destdir}"/boot/broadcom/*dtb "${_destdir}/boot"
 	fi
 
 	# Install kernel image
@@ -167,96 +163,118 @@ do_install() {
 
 	# Switch to /usr.
 	vmkdir usr
-	mv "${DESTDIR}/lib" "${DESTDIR}/usr"
+	mv "${_destdir}/lib" "${_destdir}/usr"
 
-	pushd "${DESTDIR}/usr/lib/modules/${_kernver}"
+	pushd "${_destdir}/usr/lib/modules/${_kernver}"
 	rm -f source build
-	ln -sf "../../../src/${sourcepkg}-headers-${_kernver}" build
+	ln -sf "../../../src/${_pkg}-headers-${_kernver}" build
 	popd
 
 	# Install required headers to build external modules
-	install -Dm644 Makefile "${hdrdest}/Makefile"
-	install -Dm644 Kbuild "${hdrdest}/Kbuild"
-	install -Dm644 kernel/Makefile "${hdrdest}/kernel/Makefile"
-	install -Dm644 .config "${hdrdest}/.config"
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname "$file")"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find . -name 'Kconfig*')
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname $file)"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform)
-	mkdir -p "${hdrdest}/include"
+	vinstall Makefile 644 "${hdrdest}"
+	vinstall Kbuild 644 "${hdrdest}"
+	vinstall kernel/Makefile 644 "${hdrdest}/kernel"
+	vinstall .config 644 "${hdrdest}"
+	find . -name 'Kconfig*' | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	vmkdir "${hdrdest}/include"
 
 	# Remove firmware stuff provided by the "linux-firmware" pkg.
-	rm -rf "${DESTDIR}/usr/lib/firmware"
+	rm -rf "${_destdir}/usr/lib/firmware"
 
-	for i in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
+	for d in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
 		math-emu media net pcmcia scsi sound trace uapi vdso video xen; do
-		[ -d include/$i ] && cp -a "include/$i" "${hdrdest}/include"
+		[ -d include/$d ] && vcopy "include/$d" "${hdrdest}/include"
 	done
 
 	# Remove helper binaries built for host,
 	# if generated files from the scripts/ directory need to be included,
 	# they need to be copied to ${hdrdest} before this step
 	if [ "$CROSS_BUILD" ]; then
-		make "${makejobs}" ARCH="${_arch}" _mrproper_scripts
+		make "${make_install_args[@]}" _mrproper_scripts
 		# remove host specific objects as well
 		find scripts -name '*.o' -delete
 	fi
 
 	# Copy files necessary for later builds.
-	cp Module.symvers "${hdrdest}"
-	cp -a scripts "${hdrdest}"
-	mkdir -p "${hdrdest}/security/selinux"
-	cp -a security/selinux/include "${hdrdest}/security/selinux"
-	mkdir -p "${hdrdest}/tools/include"
-	cp -a tools/include/tools "${hdrdest}/tools/include"
+	vinstall Module.symvers 644 "${hdrdest}"
+	vcopy scripts "${hdrdest}"
+	vmkdir "${hdrdest}/security/selinux"
+	vcopy security/selinux/include "${hdrdest}/security/selinux"
+	vmkdir "${hdrdest}/tools/include"
+	vcopy tools/include/tools "${hdrdest}/tools/include"
 	if [ -d "arch/${_arch}/tools" ]; then
-		cp -a "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
+		vcopy "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
 	fi
-	cp -a kernel/time/timeconst.bc "${hdrdest}/kernel/time"
-	cp -a kernel/bounds.c "${hdrdest}/kernel"
-	mkdir -p "${hdrdest}/arch/x86/entry/syscalls"
-	cp -a arch/x86/entry/syscalls/syscall_32.tbl "${hdrdest}/arch/x86/entry/syscalls"
+	vinstall kernel/time/timeconst.bc 644 "${hdrdest}/kernel/time"
+	vinstall kernel/bounds.c 644 "${hdrdest}/kernel"
+	vinstall arch/x86/entry/syscalls/syscall_32.tbl 644 "${hdrdest}/arch/x86/entry/syscalls"
 
 	# copy arch includes for external modules
-	mkdir -p "${hdrdest}/arch/${_arch}"
-	cp -a "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
+	vmkdir "${hdrdest}/arch/${_arch}"
+	vcopy "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
 
 	mkdir -p "${hdrdest}/arch/${_arch}/kernel"
-	cp "arch/${_arch}/Makefile" "${hdrdest}/arch/${_arch}"
-	cp "arch/${_arch}/kernel/asm-offsets.s" "${hdrdest}/arch/${_arch}/kernel"
+	vinstall "arch/${_arch}/Makefile" 644 "${hdrdest}/arch/${_arch}"
+	vinstall "arch/${_arch}/kernel/asm-offsets.s" 644 "${hdrdest}/arch/${_arch}/kernel"
 	if [ "$_arch" = "arm64" ] ; then
-		cp -a "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
+		vcopy "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
 	fi
 
 	# Add md headers
-	mkdir -p "${hdrdest}/drivers/md"
-	cp drivers/md/*.h "${hdrdest}/drivers/md"
+	vmkdir "${hdrdest}/drivers/md"
+	vcopy drivers/md/*.h "${hdrdest}/drivers/md"
 
 	# Add inotify.h
-	mkdir -p "${hdrdest}/include/linux"
-	cp include/linux/inotify.h "${hdrdest}/include/linux"
+	vinstall include/linux/inotify.h 644 "${hdrdest}/include/linux"
 
 	# Add wireless headers
-	mkdir -p "${hdrdest}/net/mac80211/"
-	cp net/mac80211/*.h "${hdrdest}/net/mac80211"
+	vmkdir "${hdrdest}/net/mac80211/"
+	vcopy net/mac80211/*.h "${hdrdest}/net/mac80211"
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
-	find "${DESTDIR}" -name '*.ko' | xargs -n1 -P0 gzip -9
+	msg_normal "$_pkg-$version: compressing kernel modules with gzip, please wait...\n"
+	find "${_destdir}" -name '*.ko' | xargs -n1 -P0 gzip -9
 
 	# ... and run depmod again.
-	depmod -b "${DESTDIR}/usr" -F System.map "${_kernver}"
+	depmod -b "${_destdir}/usr" -F System.map "${_kernver}"
+}
+
+do_configure() {
+	local target
+
+	case "$XBPS_TARGET_MACHINE" in
+		# for zero, 1
+		armv6l*) target=bcmrpi_defconfig ;;
+		# for 2
+		armv7l*) target=bcm2709_defconfig ;;
+		# for 3, 4, zero 2, 5
+		aarch64*) target=bcm2711_defconfig ;;
+	esac
+
+	_configure "$target"
+}
+
+do_build() {
+	make "${make_build_args[@]}" prepare
+	make "${make_build_args[@]}" "${_image_target}" modules dtbs
+}
+
+do_install() {
+	_install "$pkgname" "$DESTDIR"
 }
 
 subpackages="rpi-kernel-headers"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv7l*) subpackages+=" rpi2-kernel rpi2-kernel-headers" ;;
-	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers" ;;
+	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers rpi5-kernel rpi5-kernel-headers" ;;
 esac
 
 rpi-kernel-headers_package() {
@@ -264,9 +282,54 @@ rpi-kernel-headers_package() {
 	noverifyrdeps=yes
 	noshlibprovides=yes
 	short_desc="${short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi5-kernel-headers>=0"
 	pkg_install() {
 		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		vmove "usr/lib/modules/${_kernver}/build"
+	}
+}
+
+_rpi5_short_desc="Linux kernel for Raspberry Pi 5 (${version%.*} series)"
+
+rpi5-kernel_package() {
+	nodebug=yes
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	python_version=3
+	triggers="kernel-hooks"
+	# These files could be modified when an external module is built.
+	mutable_files="
+	 /usr/lib/modules/${_kernver}/modules.dep
+	 /usr/lib/modules/${_kernver}/modules.dep.bin
+	 /usr/lib/modules/${_kernver}/modules.symbols
+	 /usr/lib/modules/${_kernver}/modules.symbols.bin
+	 /usr/lib/modules/${_kernver}/modules.alias
+	 /usr/lib/modules/${_kernver}/modules.alias.bin
+	 /usr/lib/modules/${_kernver}/modules.devname"
+	short_desc="$_rpi5_short_desc"
+	provides="rpi-kernel-${version}_${revision}"
+	replaces="rpi-kernel>=0"
+	pkg_install() {
+		_configure "bcm2712_defconfig"
+		make "${make_build_args[@]}" prepare
+		make "${make_build_args[@]}" "${_image_target}" modules dtbs
+		_install "rpi5-kernel" "$PKGDESTDIR"
+	}
+}
+
+rpi5-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="${_rpi5_short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi-kernel-headers>=0"
+	pkg_install() {
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/src" "${PKGDESTDIR}"/usr/src
+		vmkdir "usr/lib/modules/${_kernver}"
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/lib/modules/${_kernver}/build" "${PKGDESTDIR}/usr/lib/modules/${_kernver}/build"
 	}
 }
 
diff --git a/srcpkgs/rpi-kernel/update b/srcpkgs/rpi-kernel/update
new file mode 100644
index 0000000000000..60c7b646ca64e
--- /dev/null
+++ b/srcpkgs/rpi-kernel/update
@@ -0,0 +1,2 @@
+site="https://github.com/raspberrypi/linux/commits/rpi-6.1.y/"
+pattern=">Linux \K[\d.]+(?=</a>)"
diff --git a/srcpkgs/rpi5-kernel b/srcpkgs/rpi5-kernel
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi5-kernel-headers b/srcpkgs/rpi5-kernel-headers
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

From 6499f791db82c6bb0aea4fb9cf2cc9900761f6fa Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:05 -0500
Subject: [PATCH 2/4] rpi-firmware: update to 20231102, adopt.

add rpi5-specific firmware
---
 srcpkgs/rpi-firmware/template | 42 +++++++++++++----------------------
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/srcpkgs/rpi-firmware/template b/srcpkgs/rpi-firmware/template
index 0a2efa3b80db0..606b010bda7e4 100644
--- a/srcpkgs/rpi-firmware/template
+++ b/srcpkgs/rpi-firmware/template
@@ -1,39 +1,27 @@
 # Template file for 'rpi-firmware'
 pkgname=rpi-firmware
-version=20230925
+version=20231102
 revision=1
-_rpi_fw=6b37a457122714aa14b2c7df0926455173fd04f1
-_rpi_bt=9556b08ace2a1735127894642cc8ea6529c04c90
-_rpi_brcm=2c3a8701193ba23d0ef85cdf0d0c9e47baf03dfc
+_rpi_fw=83dafbc92c0e63f76ca2ecdd42462d56489d1c77
+_rpi_bt=d9d4741caba7314d6500f588b1eaa5ab387a4ff5
+_rpi_brcm=88aa085bfa1a4650e1ccd88896f8343c22a24055
 create_wrksrc=yes
-archs="armv6l* armv7l* aarch64*"
+archs="aarch64* armv6l* armv7l*"
 short_desc="Firmware files for the Raspberry Pi"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="BSD-3-Clause, custom:Cypress"
 homepage="https://github.com/raspberrypi/firmware"
 distfiles="
  https://github.com/raspberrypi/firmware/archive/${_rpi_fw}.tar.gz
  https://github.com/RPi-Distro/firmware-nonfree/archive/${_rpi_brcm}.tar.gz
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430A1.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430B0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C5.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430A1.hcd>BCM43430A1.raspberrypi,model-zero-2-w.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430B0.hcd>BCM43430B0.raspberrypi,model-zero-2-w.hcd
+ https://github.com/RPi-Distro/bluez-firmware/archive/${_rpi_bt}.tar.gz
  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/LICENCE.cypress>LICENCE.cypress"
-checksum="913986b1be22b8dc30a3e6a9b5a28316b1bbee7bec90040ddefff0d7512560f4
- 9156d90116b921d2e7938b52fad84fbe1d96df622a66c5db09569c735832387a
- c096ad4a5c3f06ed7d69eba246bf89ada9acba64a5b6f51b1e9c12f99bb1e1a7
- 51c45e77ddad91a19e96dc8fb75295b2087c279940df2634b23baf71b6dea42c
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
- fb9f4ec2df5301bd35f416384e103c012c5983024c49aa72fbbaf90177512caa
- 55071227c94d86369d04f9aff3bbfd4197a78a53dc350295123e1a8b048bba8f
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
+checksum="dd43e77ca1a8969cdb7f05dd72a57f90862071d5a93bdd6aea8246aba85689cf
+ bb3d8fed40546e03e29d9e635745433f8083391e62d6ff151c895b892776964a
+ ae076a08ece89624b0449ea2495b0dfe2ea1223f683f5b57f2b89966e6a093d6
  ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f"
 
-skip_extraction="BCM43430A1.hcd BCM4345C0.hcd BCM43430B0.hcd BCM4345C5.hcd
- BCM43430A1.raspberrypi,model-zero-2-w.hcd BCM43430B0.raspberrypi,model-zero-2-w.hcd
- LICENCE.cypress"
+skip_extraction="LICENCE.cypress"
 
 provides="linux-firmware-broadcom-${version}_${revision}"
 replaces="linux-firmware-broadcom>=0"
@@ -72,7 +60,9 @@ do_install() {
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43456"* usr/lib/firmware/brcm
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43436"* usr/lib/firmware/brcm
 
-	for file in "${XBPS_SRCDISTDIR}/${pkgname}-${version}/"*.hcd; do
-		vinstall "$file" 0644 usr/lib/firmware/brcm
-	done
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/broadcom/"*.hcd usr/lib/firmware/brcm
+
+	vmkdir usr/lib/firmware/synaptics
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/"*.hcd usr/lib/firmware/synaptics
+	vlicense "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/LICENSE.synaptics"
 }

From 3bb27147b97a6a851dbacb00e948e3901c2962eb Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:48 -0500
Subject: [PATCH 3/4] New package: rpi-utils-20231105

replaces rpi-userland:
https://github.com/raspberrypi/userland/blob/master/README.md
---
 .../rpi-utils/patches/no-overlaycheck.patch   | 14 +++++++++++++
 srcpkgs/rpi-utils/template                    | 20 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 srcpkgs/rpi-utils/patches/no-overlaycheck.patch
 create mode 100644 srcpkgs/rpi-utils/template

diff --git a/srcpkgs/rpi-utils/patches/no-overlaycheck.patch b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
new file mode 100644
index 0000000000000..3e64958e238d2
--- /dev/null
+++ b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
@@ -0,0 +1,14 @@
+This program is not very useful as a downstream, it seems to be only intended
+for internal QA. It also has a lot of weird things like hardcoding the prefixed
+cpp to use and putting a text file in /usr/bin.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,6 @@
+ # List of subsidiary CMakeLists
+ add_subdirectory(dtmerge)
+ add_subdirectory(otpset)
+-add_subdirectory(overlaycheck)
+ add_subdirectory(ovmerge)
+ add_subdirectory(pinctrl)
+ add_subdirectory(raspinfo)
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
new file mode 100644
index 0000000000000..bbb7472b72a33
--- /dev/null
+++ b/srcpkgs/rpi-utils/template
@@ -0,0 +1,20 @@
+# Template file for 'rpi-utils'
+pkgname=rpi-utils
+version=20231105
+revision=1
+_commit=84b1831fe16b784fb3e5bfbacf76b42a821ae720
+archs="armv6l* armv7l* aarch64*"
+build_style=cmake
+makedepends="dtc-devel"
+depends="python3 perl bash"
+short_desc="Collection of utilities for Raspberry Pi"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="BSD-3-Clause"
+homepage="https://github.com/raspberrypi/utils"
+distfiles="https://github.com/raspberrypi/utils/archive/${_commit}.tar.gz"
+checksum=c97ad394e1694f41c2c6748b6e78621c74a51f20bf006c9579267f68d3157563
+python_version=3
+
+post_install() {
+	vlicense LICENCE
+}

From 7b24eaa3b7c3b5bcda2076a7aa262beee96cc9dd Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:51:52 -0500
Subject: [PATCH 4/4] rpi-eeprom: update to 2023.11.09.

- install manpages (like is done in the debian rules)
- adds rpi5 firmware
---
 srcpkgs/rpi-eeprom/template | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/rpi-eeprom/template b/srcpkgs/rpi-eeprom/template
index fb017a50966cd..55b7d396efeb5 100644
--- a/srcpkgs/rpi-eeprom/template
+++ b/srcpkgs/rpi-eeprom/template
@@ -1,17 +1,18 @@
 # Template file for 'rpi-eeprom'
 pkgname=rpi-eeprom
-version=2023.09.29
+version=2023.11.09
 revision=1
-_githash="4f2d676b4e2a9c2d9ee1ab42015ce711fde97afa"
-archs="armv7* aarch64*"
+_githash="6b14e84a2fb2e1f7220a404f65e7e0985f07c9e5"
+archs="armv7l* aarch64*"
 conf_files="/etc/default/rpi-eeprom-update"
-depends="binutils pciutils python3 rpi-firmware rpi-userland"
-short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4"
+hostmakedepends="help2man python3"
+depends="binutils pciutils python3 rpi-firmware rpi-utils"
+short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4/5"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="BSD-3-Clause, custom:Proprietary"
 homepage="https://github.com/raspberrypi/rpi-eeprom/"
 distfiles="https://github.com/raspberrypi/rpi-eeprom/archive/${_githash}.tar.gz"
-checksum="189c5d37f3102247cec72619e3cb357d027ec526fa3c7373d3107bd6c9e30e29"
+checksum=3907711bb2ff78a0e9120709b72b04d6d010f93f79d525af0454d3d27a772aca
 python_version=3
 repository=nonfree
 
@@ -21,9 +22,20 @@ do_install() {
 	vbin rpi-eeprom-digest
 	vinstall rpi-eeprom-update-default 644 etc/default rpi-eeprom-update
 
-	vmkdir usr/lib/firmware/raspberrypi/bootloader
-	# need to figure out how to package both pi4 (2711) and pi5 (2712) fw
-	vcopy firmware-2711/* usr/lib/firmware/raspberrypi/bootloader/
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Checks whether the Raspberry Pi bootloader EEPROM is up-to-date and updates the EEPROM" \
+		--output=rpi-eeprom-update.1 ./rpi-eeprom-update
+	vman rpi-eeprom-update.1
+
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Bootloader EEPROM configuration tool for the Raspberry Pi 4/5" \
+		--output=rpi-eeprom-config.1 ./rpi-eeprom-config
+	vman rpi-eeprom-config.1
+
+	for soc in 2711 2712; do
+		vmkdir usr/lib/firmware/raspberrypi/bootloader-"$soc"
+		vcopy firmware-"$soc"/* usr/lib/firmware/raspberrypi/bootloader-"$soc"/
+	done
 
 	vlicense LICENSE
 }

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (3 preceding siblings ...)
  2023-11-20  3:17 ` classabbyamp
@ 2023-11-21 11:57 ` 0x5c
  2023-11-22 22:39 ` moabeat-berlin
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: 0x5c @ 2023-11-21 11:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

New comment by 0x5c on void-packages repository

https://github.com/void-linux/void-packages/pull/47288#issuecomment-1820779426

Comment:
New arm64 generic kernel successfully tested on both a 3B and a 5B (8GB).
Also successful test of the aarch64 image and rpi5-kernel on 5B.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (4 preceding siblings ...)
  2023-11-21 11:57 ` 0x5c
@ 2023-11-22 22:39 ` moabeat-berlin
  2023-12-23 18:09 ` [PR PATCH] [Updated] " classabbyamp
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: moabeat-berlin @ 2023-11-22 22:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

New comment by moabeat-berlin on void-packages repository

https://github.com/void-linux/void-packages/pull/47288#issuecomment-1823592833

Comment:
The kernel is working fine on a 02W (aarch64-musl). Also a dkms module got compiled properly. I was able to successfully use the new live image on an RPi5.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (5 preceding siblings ...)
  2023-11-22 22:39 ` moabeat-berlin
@ 2023-12-23 18:09 ` classabbyamp
  2023-12-23 18:10 ` classabbyamp
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2023-12-23 18:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages rpi5
https://github.com/void-linux/void-packages/pull/47288

rpi-*: update and support rpi5
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES**
  - [x] 1B+ (armv6l)
  - [ ] 0 (armv6l)
  - [ ] 1A+ (armv6l)
  - [ ] 2B (armv7l)
  - [x] 3B (aarch64)
  - [x] 02W (aarch64)
  - [x] 4B (aarch64)
  - [x] 5 (aarch64)

### Prebuilt packages and RPi5-compatible install images for testing

**packages:** https://files.placeviolette.net/rpi5

```
`https://files.placeviolette.net/rpi5' repository has been RSA signed by "classabbyamp"
Fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
```
**images:** https://files.placeviolette.net/rpi5-live

`rpi5-kernel` is not installed by default on these images, but can be seamlessly switched to by installing it. it will uninstall  `rpi-kernel` (and vice-versa). RPi5 is compatible with both, but `rpi5-kernel` may provide some performance benefits.

The images also include the changes from void-linux/void-mklive#361

[ci skip]

closes #46815 
closes #46522 

A patch file from https://github.com/void-linux/void-packages/pull/47288.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi5-47288.patch --]
[-- Type: text/x-diff, Size: 26721 bytes --]

From a0f51ceffa5bca8f106e82ef5b449bdb9ae62e79 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:48:03 -0500
Subject: [PATCH 1/4] rpi-kernel: update to 6.1.69, adopt.

- add rpi5 support and optimised kernel
- add support for BTRFS root
- add /proc/config.gz by default
---
 .../rpi-kernel/patches/irqsoff-tracer.patch   |  91 +++++++
 srcpkgs/rpi-kernel/template                   | 225 +++++++++++-------
 srcpkgs/rpi-kernel/update                     |   2 +
 srcpkgs/rpi5-kernel                           |   1 +
 srcpkgs/rpi5-kernel-headers                   |   1 +
 5 files changed, 239 insertions(+), 81 deletions(-)
 create mode 100644 srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
 create mode 100644 srcpkgs/rpi-kernel/update
 create mode 120000 srcpkgs/rpi5-kernel
 create mode 120000 srcpkgs/rpi5-kernel-headers

diff --git a/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch b/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
new file mode 100644
index 0000000000000..09501632fd8dc
--- /dev/null
+++ b/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
@@ -0,0 +1,91 @@
+From 342c7ee49e862edc30c893f141f55b9211b7a43b Mon Sep 17 00:00:00 2001
+From: Yangyu Chen <cyy@cyyself.name>
+Date: Mon, 18 Dec 2023 23:26:59 +0800
+Subject: [PATCH] configs: rpi: Disable CONFIG_IRQSOFF_TRACER by default
+
+This configuration hindered performance by ~74% measured from RPI 4B
+from ~680Mbps to ~390Mbps when benchmarking wireguard locally using
+netns and iperf3. Remove it by default for better performance.
+
+Signed-off-by: Yangyu Chen <cyy@cyyself.name>
+---
+ arch/arm/configs/bcm2709_defconfig   | 1 -
+ arch/arm/configs/bcm2711_defconfig   | 1 -
+ arch/arm/configs/bcmrpi_defconfig    | 1 -
+ arch/arm64/configs/bcm2711_defconfig | 1 -
+ arch/arm64/configs/bcm2712_defconfig | 1 -
+ arch/arm64/configs/bcmrpi3_defconfig | 1 -
+ 6 files changed, 6 deletions(-)
+
+diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
+index 980e70d0178fa..c8aa65e82d8bb 100644
+--- a/arch/arm/configs/bcm2709_defconfig
++++ b/arch/arm/configs/bcm2709_defconfig
+@@ -1586,7 +1586,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm/configs/bcm2711_defconfig b/arch/arm/configs/bcm2711_defconfig
+index 806c6d81590a6..2578d23b1886e 100644
+--- a/arch/arm/configs/bcm2711_defconfig
++++ b/arch/arm/configs/bcm2711_defconfig
+@@ -1613,7 +1613,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
+index fad465fe4c70e..a2519b5abb6d6 100644
+--- a/arch/arm/configs/bcmrpi_defconfig
++++ b/arch/arm/configs/bcmrpi_defconfig
+@@ -1580,7 +1580,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcm2711_defconfig b/arch/arm64/configs/bcm2711_defconfig
+index 819c442e5acfe..afbd8ef3e8d3b 100644
+--- a/arch/arm64/configs/bcm2711_defconfig
++++ b/arch/arm64/configs/bcm2711_defconfig
+@@ -1675,7 +1675,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcm2712_defconfig b/arch/arm64/configs/bcm2712_defconfig
+index 15a0aa6c77137..76effcbc199b5 100644
+--- a/arch/arm64/configs/bcm2712_defconfig
++++ b/arch/arm64/configs/bcm2712_defconfig
+@@ -1678,7 +1678,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig
+index d3d879d03ff45..6fca561ba4084 100644
+--- a/arch/arm64/configs/bcmrpi3_defconfig
++++ b/arch/arm64/configs/bcmrpi3_defconfig
+@@ -1561,7 +1561,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 2fa1bb54b683e..704cc1f6646ce 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -12,19 +12,21 @@
 #
 # Upstream documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html
 pkgname=rpi-kernel
-version=6.1.54
+version=6.1.69
 revision=1
-_githash=fad58933544bb2a7b7db92847c25c79a83171fa6
+_githash=aabc6f6d0b13ac177f9b383e59a542ddb6c32e59
 archs="armv6l* armv7l* aarch64*"
 hostmakedepends="perl kmod uboot-mkimage openssl-devel bc bison flex xz"
 makedepends="ncurses-devel"
 short_desc="Linux kernel for Raspberry Pi (${version%.*} series)"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="GPL-2.0-only"
 homepage="http://www.kernel.org"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
-checksum=1bd02902fae49351fb16ac0d5ccc3bf4d67aa0640006dbbf8846963519b01ab8
+checksum=31a39457e4f3075bf7a1113aae17f9a17241b425aa194639c886bc639cf1da5d
 python_version=3
+provides="rpi-kernel-${version}_${revision}"
+replaces="rpi5-kernel>=0"
 
 _kernver="${version}_${revision}"
 
@@ -51,28 +53,20 @@ case "$XBPS_TARGET_MACHINE" in
 	*) broken="No Raspberry Pi exists for this arch" ;;
 esac
 
+make_build_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+make_install_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+
 if [ "$CROSS_BUILD" ]; then
-	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
-else
-	_cross=
+	make_build_args+=("CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-")
 fi
 
-do_configure() {
-	local target defconfig
-
-	case "$XBPS_TARGET_MACHINE" in
-		# for zero, 1
-		armv6l*) target=bcmrpi_defconfig ;;
-		# for 2
-		armv7l*) target=bcm2709_defconfig ;;
-		# for 3, 4, zero 2
-		aarch64*) target=bcm2711_defconfig ;;
-	esac
+_configure() {
+	local target="$1" defconfig
 
 	defconfig="arch/${_arch}/configs/${target}"
 	cp "$defconfig" .config
 
-	cat <<-! > "foo"
+	cat <<-! > void.config
 	CONFIG_CONNECTOR=y
 	CONFIG_HID_STEAM=y
 	CONFIG_PROC_EVENTS=y
@@ -113,15 +107,21 @@ do_configure() {
 	CONFIG_LZ4_COMPRESS=y
 	CONFIG_CRYPTO_RNG=y
 	CONFIG_CRYPTO_RNG_DEFAULT=y
+	CONFIG_BTRFS_FS=y
+	CONFIG_BTRFS_POSIX_ACL=y
+	CONFIG_IKCONFIG=y
+	CONFIG_IKCONFIG_PROC=y
+	CONFIG_LEDS_TRIGGER_ACTIVITY=m
 	!
 
 	while read -r line; do
+		local option="" str="" cmd=""
 		# skip comments
 		case "$line" in
 			"#"*) continue;;
 		esac
-		local option=${line%%=*} str=
-		local cmd="$(echo "$line" | cut -d= -f2)"
+		option="${line%%=*}"
+		cmd="$(echo "$line" | cut -d= -f2)"
 		case "$cmd" in
 			y) cmd="enable";;
 			n) cmd="disable";;
@@ -135,31 +135,27 @@ do_configure() {
 		./scripts/config \
 			--file .config \
 			"--$cmd" "$option" "${str//\"/}"
-	done < foo
+	done < void.config
 
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" olddefconfig
+	make "${make_build_args[@]}" olddefconfig
 }
 
-do_build() {
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" prepare
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" "${_image_target}" modules dtbs
-}
-
-do_install() {
-	local hdrdest="${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}"
+_install() {
+	local _pkg="$1" _destdir="$2"
+	local hdrdest="usr/src/${_pkg}-headers-${_kernver}"
 
 	# Run depmod after compressing modules.
 	vsed -i -e '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
-	make "${makejobs}" ARCH="${_arch}" INSTALL_MOD_PATH="${DESTDIR}" modules_install
+	make "${make_install_args[@]}" INSTALL_MOD_PATH="${_destdir}" modules_install
 
 	# Install device tree blobs
-	make "${makejobs}" "ARCH=${_arch}" INSTALL_DTBS_PATH="${DESTDIR}/boot" dtbs_install
+	make "${make_install_args[@]}" INSTALL_DTBS_PATH="${_destdir}/boot" dtbs_install
 
 	# move dtbs that ended up in /boot/broadcom
-	if [ -d "${DESTDIR}/boot/broadcom" ]; then
-		mv "${DESTDIR}"/boot/broadcom/*dtb "${DESTDIR}/boot"
+	if [ -d "${_destdir}/boot/broadcom" ]; then
+		mv "${_destdir}"/boot/broadcom/*dtb "${_destdir}/boot"
 	fi
 
 	# Install kernel image
@@ -167,96 +163,118 @@ do_install() {
 
 	# Switch to /usr.
 	vmkdir usr
-	mv "${DESTDIR}/lib" "${DESTDIR}/usr"
+	mv "${_destdir}/lib" "${_destdir}/usr"
 
-	pushd "${DESTDIR}/usr/lib/modules/${_kernver}"
+	pushd "${_destdir}/usr/lib/modules/${_kernver}"
 	rm -f source build
-	ln -sf "../../../src/${sourcepkg}-headers-${_kernver}" build
+	ln -sf "../../../src/${_pkg}-headers-${_kernver}" build
 	popd
 
 	# Install required headers to build external modules
-	install -Dm644 Makefile "${hdrdest}/Makefile"
-	install -Dm644 Kbuild "${hdrdest}/Kbuild"
-	install -Dm644 kernel/Makefile "${hdrdest}/kernel/Makefile"
-	install -Dm644 .config "${hdrdest}/.config"
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname "$file")"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find . -name 'Kconfig*')
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname $file)"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform)
-	mkdir -p "${hdrdest}/include"
+	vinstall Makefile 644 "${hdrdest}"
+	vinstall Kbuild 644 "${hdrdest}"
+	vinstall kernel/Makefile 644 "${hdrdest}/kernel"
+	vinstall .config 644 "${hdrdest}"
+	find . -name 'Kconfig*' | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	vmkdir "${hdrdest}/include"
 
 	# Remove firmware stuff provided by the "linux-firmware" pkg.
-	rm -rf "${DESTDIR}/usr/lib/firmware"
+	rm -rf "${_destdir}/usr/lib/firmware"
 
-	for i in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
+	for d in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
 		math-emu media net pcmcia scsi sound trace uapi vdso video xen; do
-		[ -d include/$i ] && cp -a "include/$i" "${hdrdest}/include"
+		[ -d include/$d ] && vcopy "include/$d" "${hdrdest}/include"
 	done
 
 	# Remove helper binaries built for host,
 	# if generated files from the scripts/ directory need to be included,
 	# they need to be copied to ${hdrdest} before this step
 	if [ "$CROSS_BUILD" ]; then
-		make "${makejobs}" ARCH="${_arch}" _mrproper_scripts
+		make "${make_install_args[@]}" _mrproper_scripts
 		# remove host specific objects as well
 		find scripts -name '*.o' -delete
 	fi
 
 	# Copy files necessary for later builds.
-	cp Module.symvers "${hdrdest}"
-	cp -a scripts "${hdrdest}"
-	mkdir -p "${hdrdest}/security/selinux"
-	cp -a security/selinux/include "${hdrdest}/security/selinux"
-	mkdir -p "${hdrdest}/tools/include"
-	cp -a tools/include/tools "${hdrdest}/tools/include"
+	vinstall Module.symvers 644 "${hdrdest}"
+	vcopy scripts "${hdrdest}"
+	vmkdir "${hdrdest}/security/selinux"
+	vcopy security/selinux/include "${hdrdest}/security/selinux"
+	vmkdir "${hdrdest}/tools/include"
+	vcopy tools/include/tools "${hdrdest}/tools/include"
 	if [ -d "arch/${_arch}/tools" ]; then
-		cp -a "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
+		vcopy "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
 	fi
-	cp -a kernel/time/timeconst.bc "${hdrdest}/kernel/time"
-	cp -a kernel/bounds.c "${hdrdest}/kernel"
-	mkdir -p "${hdrdest}/arch/x86/entry/syscalls"
-	cp -a arch/x86/entry/syscalls/syscall_32.tbl "${hdrdest}/arch/x86/entry/syscalls"
+	vinstall kernel/time/timeconst.bc 644 "${hdrdest}/kernel/time"
+	vinstall kernel/bounds.c 644 "${hdrdest}/kernel"
+	vinstall arch/x86/entry/syscalls/syscall_32.tbl 644 "${hdrdest}/arch/x86/entry/syscalls"
 
 	# copy arch includes for external modules
-	mkdir -p "${hdrdest}/arch/${_arch}"
-	cp -a "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
+	vmkdir "${hdrdest}/arch/${_arch}"
+	vcopy "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
 
 	mkdir -p "${hdrdest}/arch/${_arch}/kernel"
-	cp "arch/${_arch}/Makefile" "${hdrdest}/arch/${_arch}"
-	cp "arch/${_arch}/kernel/asm-offsets.s" "${hdrdest}/arch/${_arch}/kernel"
+	vinstall "arch/${_arch}/Makefile" 644 "${hdrdest}/arch/${_arch}"
+	vinstall "arch/${_arch}/kernel/asm-offsets.s" 644 "${hdrdest}/arch/${_arch}/kernel"
 	if [ "$_arch" = "arm64" ] ; then
-		cp -a "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
+		vcopy "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
 	fi
 
 	# Add md headers
-	mkdir -p "${hdrdest}/drivers/md"
-	cp drivers/md/*.h "${hdrdest}/drivers/md"
+	vmkdir "${hdrdest}/drivers/md"
+	vcopy drivers/md/*.h "${hdrdest}/drivers/md"
 
 	# Add inotify.h
-	mkdir -p "${hdrdest}/include/linux"
-	cp include/linux/inotify.h "${hdrdest}/include/linux"
+	vinstall include/linux/inotify.h 644 "${hdrdest}/include/linux"
 
 	# Add wireless headers
-	mkdir -p "${hdrdest}/net/mac80211/"
-	cp net/mac80211/*.h "${hdrdest}/net/mac80211"
+	vmkdir "${hdrdest}/net/mac80211/"
+	vcopy net/mac80211/*.h "${hdrdest}/net/mac80211"
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
-	find "${DESTDIR}" -name '*.ko' | xargs -n1 -P0 gzip -9
+	msg_normal "$_pkg-$version: compressing kernel modules with gzip, please wait...\n"
+	find "${_destdir}" -name '*.ko' | xargs -n1 -P0 gzip -9
 
 	# ... and run depmod again.
-	depmod -b "${DESTDIR}/usr" -F System.map "${_kernver}"
+	depmod -b "${_destdir}/usr" -F System.map "${_kernver}"
+}
+
+do_configure() {
+	local target
+
+	case "$XBPS_TARGET_MACHINE" in
+		# for zero, 1
+		armv6l*) target=bcmrpi_defconfig ;;
+		# for 2
+		armv7l*) target=bcm2709_defconfig ;;
+		# for 3, 4, zero 2, 5
+		aarch64*) target=bcm2711_defconfig ;;
+	esac
+
+	_configure "$target"
+}
+
+do_build() {
+	make "${make_build_args[@]}" prepare
+	make "${make_build_args[@]}" "${_image_target}" modules dtbs
+}
+
+do_install() {
+	_install "$pkgname" "$DESTDIR"
 }
 
 subpackages="rpi-kernel-headers"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv7l*) subpackages+=" rpi2-kernel rpi2-kernel-headers" ;;
-	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers" ;;
+	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers rpi5-kernel rpi5-kernel-headers" ;;
 esac
 
 rpi-kernel-headers_package() {
@@ -264,9 +282,54 @@ rpi-kernel-headers_package() {
 	noverifyrdeps=yes
 	noshlibprovides=yes
 	short_desc="${short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi5-kernel-headers>=0"
 	pkg_install() {
 		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		vmove "usr/lib/modules/${_kernver}/build"
+	}
+}
+
+_rpi5_short_desc="Linux kernel for Raspberry Pi 5 (${version%.*} series)"
+
+rpi5-kernel_package() {
+	nodebug=yes
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	python_version=3
+	triggers="kernel-hooks"
+	# These files could be modified when an external module is built.
+	mutable_files="
+	 /usr/lib/modules/${_kernver}/modules.dep
+	 /usr/lib/modules/${_kernver}/modules.dep.bin
+	 /usr/lib/modules/${_kernver}/modules.symbols
+	 /usr/lib/modules/${_kernver}/modules.symbols.bin
+	 /usr/lib/modules/${_kernver}/modules.alias
+	 /usr/lib/modules/${_kernver}/modules.alias.bin
+	 /usr/lib/modules/${_kernver}/modules.devname"
+	short_desc="$_rpi5_short_desc"
+	provides="rpi-kernel-${version}_${revision}"
+	replaces="rpi-kernel>=0"
+	pkg_install() {
+		_configure "bcm2712_defconfig"
+		make "${make_build_args[@]}" prepare
+		make "${make_build_args[@]}" "${_image_target}" modules dtbs
+		_install "rpi5-kernel" "$PKGDESTDIR"
+	}
+}
+
+rpi5-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="${_rpi5_short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi-kernel-headers>=0"
+	pkg_install() {
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/src" "${PKGDESTDIR}"/usr/src
+		vmkdir "usr/lib/modules/${_kernver}"
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/lib/modules/${_kernver}/build" "${PKGDESTDIR}/usr/lib/modules/${_kernver}/build"
 	}
 }
 
diff --git a/srcpkgs/rpi-kernel/update b/srcpkgs/rpi-kernel/update
new file mode 100644
index 0000000000000..60c7b646ca64e
--- /dev/null
+++ b/srcpkgs/rpi-kernel/update
@@ -0,0 +1,2 @@
+site="https://github.com/raspberrypi/linux/commits/rpi-6.1.y/"
+pattern=">Linux \K[\d.]+(?=</a>)"
diff --git a/srcpkgs/rpi5-kernel b/srcpkgs/rpi5-kernel
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi5-kernel-headers b/srcpkgs/rpi5-kernel-headers
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

From 7ab3a26d90d32722a1f2895ae91f6edf6bda15b0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:05 -0500
Subject: [PATCH 2/4] rpi-firmware: update to 20231221, adopt.

add rpi5-specific firmware
---
 srcpkgs/rpi-firmware/template | 42 +++++++++++++----------------------
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/srcpkgs/rpi-firmware/template b/srcpkgs/rpi-firmware/template
index 0a2efa3b80db0..4838c305ed34b 100644
--- a/srcpkgs/rpi-firmware/template
+++ b/srcpkgs/rpi-firmware/template
@@ -1,39 +1,27 @@
 # Template file for 'rpi-firmware'
 pkgname=rpi-firmware
-version=20230925
+version=20231221
 revision=1
-_rpi_fw=6b37a457122714aa14b2c7df0926455173fd04f1
-_rpi_bt=9556b08ace2a1735127894642cc8ea6529c04c90
-_rpi_brcm=2c3a8701193ba23d0ef85cdf0d0c9e47baf03dfc
+_rpi_fw=0da53ed7928f20b5f4e9e36a3a63fb80b700d908
+_rpi_brcm=88aa085bfa1a4650e1ccd88896f8343c22a24055
+_rpi_bt=d9d4741caba7314d6500f588b1eaa5ab387a4ff5
 create_wrksrc=yes
-archs="armv6l* armv7l* aarch64*"
+archs="aarch64* armv6l* armv7l*"
 short_desc="Firmware files for the Raspberry Pi"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="BSD-3-Clause, custom:Cypress"
 homepage="https://github.com/raspberrypi/firmware"
 distfiles="
  https://github.com/raspberrypi/firmware/archive/${_rpi_fw}.tar.gz
  https://github.com/RPi-Distro/firmware-nonfree/archive/${_rpi_brcm}.tar.gz
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430A1.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430B0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C5.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430A1.hcd>BCM43430A1.raspberrypi,model-zero-2-w.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430B0.hcd>BCM43430B0.raspberrypi,model-zero-2-w.hcd
+ https://github.com/RPi-Distro/bluez-firmware/archive/${_rpi_bt}.tar.gz
  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/LICENCE.cypress>LICENCE.cypress"
-checksum="913986b1be22b8dc30a3e6a9b5a28316b1bbee7bec90040ddefff0d7512560f4
- 9156d90116b921d2e7938b52fad84fbe1d96df622a66c5db09569c735832387a
- c096ad4a5c3f06ed7d69eba246bf89ada9acba64a5b6f51b1e9c12f99bb1e1a7
- 51c45e77ddad91a19e96dc8fb75295b2087c279940df2634b23baf71b6dea42c
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
- fb9f4ec2df5301bd35f416384e103c012c5983024c49aa72fbbaf90177512caa
- 55071227c94d86369d04f9aff3bbfd4197a78a53dc350295123e1a8b048bba8f
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
+checksum="c9288ecc2d314f12517b05378634d4fd73408245100e0cfae4c11ccaa84fcadd
+ bb3d8fed40546e03e29d9e635745433f8083391e62d6ff151c895b892776964a
+ ae076a08ece89624b0449ea2495b0dfe2ea1223f683f5b57f2b89966e6a093d6
  ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f"
 
-skip_extraction="BCM43430A1.hcd BCM4345C0.hcd BCM43430B0.hcd BCM4345C5.hcd
- BCM43430A1.raspberrypi,model-zero-2-w.hcd BCM43430B0.raspberrypi,model-zero-2-w.hcd
- LICENCE.cypress"
+skip_extraction="LICENCE.cypress"
 
 provides="linux-firmware-broadcom-${version}_${revision}"
 replaces="linux-firmware-broadcom>=0"
@@ -72,7 +60,9 @@ do_install() {
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43456"* usr/lib/firmware/brcm
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43436"* usr/lib/firmware/brcm
 
-	for file in "${XBPS_SRCDISTDIR}/${pkgname}-${version}/"*.hcd; do
-		vinstall "$file" 0644 usr/lib/firmware/brcm
-	done
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/broadcom/"*.hcd usr/lib/firmware/brcm
+
+	vmkdir usr/lib/firmware/synaptics
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/"*.hcd usr/lib/firmware/synaptics
+	vlicense "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/LICENSE.synaptics"
 }

From 00b9653ca42d49bebc8882e69c8cc14486ba7915 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:48 -0500
Subject: [PATCH 3/4] New package: rpi-utils-20231221

replaces rpi-userland:
https://github.com/raspberrypi/userland/blob/master/README.md
---
 .../rpi-utils/patches/no-overlaycheck.patch   | 14 +++++++++++++
 srcpkgs/rpi-utils/template                    | 20 +++++++++++++++++++
 srcpkgs/rpi-utils/update                      |  1 +
 3 files changed, 35 insertions(+)
 create mode 100644 srcpkgs/rpi-utils/patches/no-overlaycheck.patch
 create mode 100644 srcpkgs/rpi-utils/template
 create mode 100644 srcpkgs/rpi-utils/update

diff --git a/srcpkgs/rpi-utils/patches/no-overlaycheck.patch b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
new file mode 100644
index 0000000000000..3e64958e238d2
--- /dev/null
+++ b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
@@ -0,0 +1,14 @@
+This program is not very useful as a downstream, it seems to be only intended
+for internal QA. It also has a lot of weird things like hardcoding the prefixed
+cpp to use and putting a text file in /usr/bin.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,6 @@
+ # List of subsidiary CMakeLists
+ add_subdirectory(dtmerge)
+ add_subdirectory(otpset)
+-add_subdirectory(overlaycheck)
+ add_subdirectory(ovmerge)
+ add_subdirectory(pinctrl)
+ add_subdirectory(raspinfo)
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
new file mode 100644
index 0000000000000..4ba633ed47ab6
--- /dev/null
+++ b/srcpkgs/rpi-utils/template
@@ -0,0 +1,20 @@
+# Template file for 'rpi-utils'
+pkgname=rpi-utils
+version=20231221
+revision=1
+_commit=2cc103f4531a005cadaa8a9d09d6c85523c166bb
+archs="armv6l* armv7l* aarch64*"
+build_style=cmake
+makedepends="dtc-devel"
+depends="python3 perl bash"
+short_desc="Collection of utilities for Raspberry Pi"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="BSD-3-Clause"
+homepage="https://github.com/raspberrypi/utils"
+distfiles="https://github.com/raspberrypi/utils/archive/${_commit}.tar.gz"
+checksum=32e128d437052c66c744f24d75b0835a80a98627e33c48a37172a457024d9275
+python_version=3
+
+post_install() {
+	vlicense LICENCE
+}
diff --git a/srcpkgs/rpi-utils/update b/srcpkgs/rpi-utils/update
new file mode 100644
index 0000000000000..0d9505a5537ba
--- /dev/null
+++ b/srcpkgs/rpi-utils/update
@@ -0,0 +1 @@
+disabled="just following master"

From 982911cc1c4c546e7e985dc102386384662fea00 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:51:52 -0500
Subject: [PATCH 4/4] rpi-eeprom: update to 2023.12.14.

- install manpages (like is done in the debian rules)
- adds rpi5 firmware
---
 srcpkgs/rpi-eeprom/template | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/rpi-eeprom/template b/srcpkgs/rpi-eeprom/template
index fb017a50966cd..38fba116a9486 100644
--- a/srcpkgs/rpi-eeprom/template
+++ b/srcpkgs/rpi-eeprom/template
@@ -1,17 +1,18 @@
 # Template file for 'rpi-eeprom'
 pkgname=rpi-eeprom
-version=2023.09.29
+version=2023.12.14
 revision=1
-_githash="4f2d676b4e2a9c2d9ee1ab42015ce711fde97afa"
-archs="armv7* aarch64*"
+_githash=72cedfe5eea64bb8509b7d0fec68f5df5dd22f9e
+archs="armv7l* aarch64*"
 conf_files="/etc/default/rpi-eeprom-update"
-depends="binutils pciutils python3 rpi-firmware rpi-userland"
-short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4"
+hostmakedepends="help2man python3"
+depends="binutils pciutils python3 rpi-firmware rpi-utils"
+short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4/5"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="BSD-3-Clause, custom:Proprietary"
 homepage="https://github.com/raspberrypi/rpi-eeprom/"
 distfiles="https://github.com/raspberrypi/rpi-eeprom/archive/${_githash}.tar.gz"
-checksum="189c5d37f3102247cec72619e3cb357d027ec526fa3c7373d3107bd6c9e30e29"
+checksum=542365a644b3d8e987bda8e0a7dc9d4c9c234ab97b11fa902798a21a08743c30
 python_version=3
 repository=nonfree
 
@@ -21,9 +22,21 @@ do_install() {
 	vbin rpi-eeprom-digest
 	vinstall rpi-eeprom-update-default 644 etc/default rpi-eeprom-update
 
-	vmkdir usr/lib/firmware/raspberrypi/bootloader
-	# need to figure out how to package both pi4 (2711) and pi5 (2712) fw
-	vcopy firmware-2711/* usr/lib/firmware/raspberrypi/bootloader/
+	# from https://github.com/raspberrypi/rpi-eeprom/blob/debian/bookworm/debian/rules
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Checks whether the Raspberry Pi bootloader EEPROM is up-to-date and updates the EEPROM" \
+		--output=rpi-eeprom-update.1 ./rpi-eeprom-update
+	vman rpi-eeprom-update.1
+
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Bootloader EEPROM configuration tool for the Raspberry Pi 4/5" \
+		--output=rpi-eeprom-config.1 ./rpi-eeprom-config
+	vman rpi-eeprom-config.1
+
+	for soc in 2711 2712; do
+		vmkdir usr/lib/firmware/raspberrypi/bootloader-"$soc"
+		vcopy firmware-"$soc"/* usr/lib/firmware/raspberrypi/bootloader-"$soc"/
+	done
 
 	vlicense LICENSE
 }

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (6 preceding siblings ...)
  2023-12-23 18:09 ` [PR PATCH] [Updated] " classabbyamp
@ 2023-12-23 18:10 ` classabbyamp
  2023-12-23 18:13 ` classabbyamp
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2023-12-23 18:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/47288#issuecomment-1868344109

Comment:
updated things because this has sat for a bit

new versions should be available at https://files.placeviolette.net/rpi5 for testing

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (7 preceding siblings ...)
  2023-12-23 18:10 ` classabbyamp
@ 2023-12-23 18:13 ` classabbyamp
  2023-12-23 22:24 ` [PR PATCH] [Updated] " classabbyamp
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2023-12-23 18:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/47288#issuecomment-1868344109

Comment:
updated things because this has sat for a bit

new versions should be available at https://files.placeviolette.net/rpi5 for testing

TODOs left:
- [ ] give everything a quick test
- [ ] deconflict `linux-firmware-broadcom` and `rpi-firmware` (probably simple)
- [ ] figure out #47290
- [ ] rpi5-kernel pagesize gives issues with jemalloc

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (8 preceding siblings ...)
  2023-12-23 18:13 ` classabbyamp
@ 2023-12-23 22:24 ` classabbyamp
  2023-12-23 22:26 ` classabbyamp
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2023-12-23 22:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages rpi5
https://github.com/void-linux/void-packages/pull/47288

rpi-*: update and support rpi5
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES**
  - [x] 1B+ (armv6l)
  - [ ] 0 (armv6l)
  - [ ] 1A+ (armv6l)
  - [ ] 2B (armv7l)
  - [x] 3B (aarch64)
  - [x] 02W (aarch64)
  - [x] 4B (aarch64)
  - [x] 5 (aarch64)

### Prebuilt packages and RPi5-compatible install images for testing

**packages:** https://files.placeviolette.net/rpi5

```
`https://files.placeviolette.net/rpi5' repository has been RSA signed by "classabbyamp"
Fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
```
**images:** https://files.placeviolette.net/rpi5-live

`rpi5-kernel` is not installed by default on these images, but can be seamlessly switched to by installing it. it will uninstall  `rpi-kernel` (and vice-versa). RPi5 is compatible with both, but `rpi5-kernel` may provide some performance benefits.

The images also include the changes from void-linux/void-mklive#361

[ci skip]

closes #46815 
closes #46522 

A patch file from https://github.com/void-linux/void-packages/pull/47288.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi5-47288.patch --]
[-- Type: text/x-diff, Size: 28498 bytes --]

From a0f51ceffa5bca8f106e82ef5b449bdb9ae62e79 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:48:03 -0500
Subject: [PATCH 1/5] rpi-kernel: update to 6.1.69, adopt.

- add rpi5 support and optimised kernel
- add support for BTRFS root
- add /proc/config.gz by default
---
 .../rpi-kernel/patches/irqsoff-tracer.patch   |  91 +++++++
 srcpkgs/rpi-kernel/template                   | 225 +++++++++++-------
 srcpkgs/rpi-kernel/update                     |   2 +
 srcpkgs/rpi5-kernel                           |   1 +
 srcpkgs/rpi5-kernel-headers                   |   1 +
 5 files changed, 239 insertions(+), 81 deletions(-)
 create mode 100644 srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
 create mode 100644 srcpkgs/rpi-kernel/update
 create mode 120000 srcpkgs/rpi5-kernel
 create mode 120000 srcpkgs/rpi5-kernel-headers

diff --git a/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch b/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
new file mode 100644
index 0000000000000..09501632fd8dc
--- /dev/null
+++ b/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
@@ -0,0 +1,91 @@
+From 342c7ee49e862edc30c893f141f55b9211b7a43b Mon Sep 17 00:00:00 2001
+From: Yangyu Chen <cyy@cyyself.name>
+Date: Mon, 18 Dec 2023 23:26:59 +0800
+Subject: [PATCH] configs: rpi: Disable CONFIG_IRQSOFF_TRACER by default
+
+This configuration hindered performance by ~74% measured from RPI 4B
+from ~680Mbps to ~390Mbps when benchmarking wireguard locally using
+netns and iperf3. Remove it by default for better performance.
+
+Signed-off-by: Yangyu Chen <cyy@cyyself.name>
+---
+ arch/arm/configs/bcm2709_defconfig   | 1 -
+ arch/arm/configs/bcm2711_defconfig   | 1 -
+ arch/arm/configs/bcmrpi_defconfig    | 1 -
+ arch/arm64/configs/bcm2711_defconfig | 1 -
+ arch/arm64/configs/bcm2712_defconfig | 1 -
+ arch/arm64/configs/bcmrpi3_defconfig | 1 -
+ 6 files changed, 6 deletions(-)
+
+diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
+index 980e70d0178fa..c8aa65e82d8bb 100644
+--- a/arch/arm/configs/bcm2709_defconfig
++++ b/arch/arm/configs/bcm2709_defconfig
+@@ -1586,7 +1586,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm/configs/bcm2711_defconfig b/arch/arm/configs/bcm2711_defconfig
+index 806c6d81590a6..2578d23b1886e 100644
+--- a/arch/arm/configs/bcm2711_defconfig
++++ b/arch/arm/configs/bcm2711_defconfig
+@@ -1613,7 +1613,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
+index fad465fe4c70e..a2519b5abb6d6 100644
+--- a/arch/arm/configs/bcmrpi_defconfig
++++ b/arch/arm/configs/bcmrpi_defconfig
+@@ -1580,7 +1580,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcm2711_defconfig b/arch/arm64/configs/bcm2711_defconfig
+index 819c442e5acfe..afbd8ef3e8d3b 100644
+--- a/arch/arm64/configs/bcm2711_defconfig
++++ b/arch/arm64/configs/bcm2711_defconfig
+@@ -1675,7 +1675,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcm2712_defconfig b/arch/arm64/configs/bcm2712_defconfig
+index 15a0aa6c77137..76effcbc199b5 100644
+--- a/arch/arm64/configs/bcm2712_defconfig
++++ b/arch/arm64/configs/bcm2712_defconfig
+@@ -1678,7 +1678,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig
+index d3d879d03ff45..6fca561ba4084 100644
+--- a/arch/arm64/configs/bcmrpi3_defconfig
++++ b/arch/arm64/configs/bcmrpi3_defconfig
+@@ -1561,7 +1561,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 2fa1bb54b683e..704cc1f6646ce 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -12,19 +12,21 @@
 #
 # Upstream documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html
 pkgname=rpi-kernel
-version=6.1.54
+version=6.1.69
 revision=1
-_githash=fad58933544bb2a7b7db92847c25c79a83171fa6
+_githash=aabc6f6d0b13ac177f9b383e59a542ddb6c32e59
 archs="armv6l* armv7l* aarch64*"
 hostmakedepends="perl kmod uboot-mkimage openssl-devel bc bison flex xz"
 makedepends="ncurses-devel"
 short_desc="Linux kernel for Raspberry Pi (${version%.*} series)"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="GPL-2.0-only"
 homepage="http://www.kernel.org"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
-checksum=1bd02902fae49351fb16ac0d5ccc3bf4d67aa0640006dbbf8846963519b01ab8
+checksum=31a39457e4f3075bf7a1113aae17f9a17241b425aa194639c886bc639cf1da5d
 python_version=3
+provides="rpi-kernel-${version}_${revision}"
+replaces="rpi5-kernel>=0"
 
 _kernver="${version}_${revision}"
 
@@ -51,28 +53,20 @@ case "$XBPS_TARGET_MACHINE" in
 	*) broken="No Raspberry Pi exists for this arch" ;;
 esac
 
+make_build_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+make_install_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+
 if [ "$CROSS_BUILD" ]; then
-	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
-else
-	_cross=
+	make_build_args+=("CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-")
 fi
 
-do_configure() {
-	local target defconfig
-
-	case "$XBPS_TARGET_MACHINE" in
-		# for zero, 1
-		armv6l*) target=bcmrpi_defconfig ;;
-		# for 2
-		armv7l*) target=bcm2709_defconfig ;;
-		# for 3, 4, zero 2
-		aarch64*) target=bcm2711_defconfig ;;
-	esac
+_configure() {
+	local target="$1" defconfig
 
 	defconfig="arch/${_arch}/configs/${target}"
 	cp "$defconfig" .config
 
-	cat <<-! > "foo"
+	cat <<-! > void.config
 	CONFIG_CONNECTOR=y
 	CONFIG_HID_STEAM=y
 	CONFIG_PROC_EVENTS=y
@@ -113,15 +107,21 @@ do_configure() {
 	CONFIG_LZ4_COMPRESS=y
 	CONFIG_CRYPTO_RNG=y
 	CONFIG_CRYPTO_RNG_DEFAULT=y
+	CONFIG_BTRFS_FS=y
+	CONFIG_BTRFS_POSIX_ACL=y
+	CONFIG_IKCONFIG=y
+	CONFIG_IKCONFIG_PROC=y
+	CONFIG_LEDS_TRIGGER_ACTIVITY=m
 	!
 
 	while read -r line; do
+		local option="" str="" cmd=""
 		# skip comments
 		case "$line" in
 			"#"*) continue;;
 		esac
-		local option=${line%%=*} str=
-		local cmd="$(echo "$line" | cut -d= -f2)"
+		option="${line%%=*}"
+		cmd="$(echo "$line" | cut -d= -f2)"
 		case "$cmd" in
 			y) cmd="enable";;
 			n) cmd="disable";;
@@ -135,31 +135,27 @@ do_configure() {
 		./scripts/config \
 			--file .config \
 			"--$cmd" "$option" "${str//\"/}"
-	done < foo
+	done < void.config
 
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" olddefconfig
+	make "${make_build_args[@]}" olddefconfig
 }
 
-do_build() {
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" prepare
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" "${_image_target}" modules dtbs
-}
-
-do_install() {
-	local hdrdest="${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}"
+_install() {
+	local _pkg="$1" _destdir="$2"
+	local hdrdest="usr/src/${_pkg}-headers-${_kernver}"
 
 	# Run depmod after compressing modules.
 	vsed -i -e '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
-	make "${makejobs}" ARCH="${_arch}" INSTALL_MOD_PATH="${DESTDIR}" modules_install
+	make "${make_install_args[@]}" INSTALL_MOD_PATH="${_destdir}" modules_install
 
 	# Install device tree blobs
-	make "${makejobs}" "ARCH=${_arch}" INSTALL_DTBS_PATH="${DESTDIR}/boot" dtbs_install
+	make "${make_install_args[@]}" INSTALL_DTBS_PATH="${_destdir}/boot" dtbs_install
 
 	# move dtbs that ended up in /boot/broadcom
-	if [ -d "${DESTDIR}/boot/broadcom" ]; then
-		mv "${DESTDIR}"/boot/broadcom/*dtb "${DESTDIR}/boot"
+	if [ -d "${_destdir}/boot/broadcom" ]; then
+		mv "${_destdir}"/boot/broadcom/*dtb "${_destdir}/boot"
 	fi
 
 	# Install kernel image
@@ -167,96 +163,118 @@ do_install() {
 
 	# Switch to /usr.
 	vmkdir usr
-	mv "${DESTDIR}/lib" "${DESTDIR}/usr"
+	mv "${_destdir}/lib" "${_destdir}/usr"
 
-	pushd "${DESTDIR}/usr/lib/modules/${_kernver}"
+	pushd "${_destdir}/usr/lib/modules/${_kernver}"
 	rm -f source build
-	ln -sf "../../../src/${sourcepkg}-headers-${_kernver}" build
+	ln -sf "../../../src/${_pkg}-headers-${_kernver}" build
 	popd
 
 	# Install required headers to build external modules
-	install -Dm644 Makefile "${hdrdest}/Makefile"
-	install -Dm644 Kbuild "${hdrdest}/Kbuild"
-	install -Dm644 kernel/Makefile "${hdrdest}/kernel/Makefile"
-	install -Dm644 .config "${hdrdest}/.config"
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname "$file")"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find . -name 'Kconfig*')
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname $file)"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform)
-	mkdir -p "${hdrdest}/include"
+	vinstall Makefile 644 "${hdrdest}"
+	vinstall Kbuild 644 "${hdrdest}"
+	vinstall kernel/Makefile 644 "${hdrdest}/kernel"
+	vinstall .config 644 "${hdrdest}"
+	find . -name 'Kconfig*' | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	vmkdir "${hdrdest}/include"
 
 	# Remove firmware stuff provided by the "linux-firmware" pkg.
-	rm -rf "${DESTDIR}/usr/lib/firmware"
+	rm -rf "${_destdir}/usr/lib/firmware"
 
-	for i in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
+	for d in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
 		math-emu media net pcmcia scsi sound trace uapi vdso video xen; do
-		[ -d include/$i ] && cp -a "include/$i" "${hdrdest}/include"
+		[ -d include/$d ] && vcopy "include/$d" "${hdrdest}/include"
 	done
 
 	# Remove helper binaries built for host,
 	# if generated files from the scripts/ directory need to be included,
 	# they need to be copied to ${hdrdest} before this step
 	if [ "$CROSS_BUILD" ]; then
-		make "${makejobs}" ARCH="${_arch}" _mrproper_scripts
+		make "${make_install_args[@]}" _mrproper_scripts
 		# remove host specific objects as well
 		find scripts -name '*.o' -delete
 	fi
 
 	# Copy files necessary for later builds.
-	cp Module.symvers "${hdrdest}"
-	cp -a scripts "${hdrdest}"
-	mkdir -p "${hdrdest}/security/selinux"
-	cp -a security/selinux/include "${hdrdest}/security/selinux"
-	mkdir -p "${hdrdest}/tools/include"
-	cp -a tools/include/tools "${hdrdest}/tools/include"
+	vinstall Module.symvers 644 "${hdrdest}"
+	vcopy scripts "${hdrdest}"
+	vmkdir "${hdrdest}/security/selinux"
+	vcopy security/selinux/include "${hdrdest}/security/selinux"
+	vmkdir "${hdrdest}/tools/include"
+	vcopy tools/include/tools "${hdrdest}/tools/include"
 	if [ -d "arch/${_arch}/tools" ]; then
-		cp -a "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
+		vcopy "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
 	fi
-	cp -a kernel/time/timeconst.bc "${hdrdest}/kernel/time"
-	cp -a kernel/bounds.c "${hdrdest}/kernel"
-	mkdir -p "${hdrdest}/arch/x86/entry/syscalls"
-	cp -a arch/x86/entry/syscalls/syscall_32.tbl "${hdrdest}/arch/x86/entry/syscalls"
+	vinstall kernel/time/timeconst.bc 644 "${hdrdest}/kernel/time"
+	vinstall kernel/bounds.c 644 "${hdrdest}/kernel"
+	vinstall arch/x86/entry/syscalls/syscall_32.tbl 644 "${hdrdest}/arch/x86/entry/syscalls"
 
 	# copy arch includes for external modules
-	mkdir -p "${hdrdest}/arch/${_arch}"
-	cp -a "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
+	vmkdir "${hdrdest}/arch/${_arch}"
+	vcopy "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
 
 	mkdir -p "${hdrdest}/arch/${_arch}/kernel"
-	cp "arch/${_arch}/Makefile" "${hdrdest}/arch/${_arch}"
-	cp "arch/${_arch}/kernel/asm-offsets.s" "${hdrdest}/arch/${_arch}/kernel"
+	vinstall "arch/${_arch}/Makefile" 644 "${hdrdest}/arch/${_arch}"
+	vinstall "arch/${_arch}/kernel/asm-offsets.s" 644 "${hdrdest}/arch/${_arch}/kernel"
 	if [ "$_arch" = "arm64" ] ; then
-		cp -a "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
+		vcopy "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
 	fi
 
 	# Add md headers
-	mkdir -p "${hdrdest}/drivers/md"
-	cp drivers/md/*.h "${hdrdest}/drivers/md"
+	vmkdir "${hdrdest}/drivers/md"
+	vcopy drivers/md/*.h "${hdrdest}/drivers/md"
 
 	# Add inotify.h
-	mkdir -p "${hdrdest}/include/linux"
-	cp include/linux/inotify.h "${hdrdest}/include/linux"
+	vinstall include/linux/inotify.h 644 "${hdrdest}/include/linux"
 
 	# Add wireless headers
-	mkdir -p "${hdrdest}/net/mac80211/"
-	cp net/mac80211/*.h "${hdrdest}/net/mac80211"
+	vmkdir "${hdrdest}/net/mac80211/"
+	vcopy net/mac80211/*.h "${hdrdest}/net/mac80211"
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
-	find "${DESTDIR}" -name '*.ko' | xargs -n1 -P0 gzip -9
+	msg_normal "$_pkg-$version: compressing kernel modules with gzip, please wait...\n"
+	find "${_destdir}" -name '*.ko' | xargs -n1 -P0 gzip -9
 
 	# ... and run depmod again.
-	depmod -b "${DESTDIR}/usr" -F System.map "${_kernver}"
+	depmod -b "${_destdir}/usr" -F System.map "${_kernver}"
+}
+
+do_configure() {
+	local target
+
+	case "$XBPS_TARGET_MACHINE" in
+		# for zero, 1
+		armv6l*) target=bcmrpi_defconfig ;;
+		# for 2
+		armv7l*) target=bcm2709_defconfig ;;
+		# for 3, 4, zero 2, 5
+		aarch64*) target=bcm2711_defconfig ;;
+	esac
+
+	_configure "$target"
+}
+
+do_build() {
+	make "${make_build_args[@]}" prepare
+	make "${make_build_args[@]}" "${_image_target}" modules dtbs
+}
+
+do_install() {
+	_install "$pkgname" "$DESTDIR"
 }
 
 subpackages="rpi-kernel-headers"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv7l*) subpackages+=" rpi2-kernel rpi2-kernel-headers" ;;
-	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers" ;;
+	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers rpi5-kernel rpi5-kernel-headers" ;;
 esac
 
 rpi-kernel-headers_package() {
@@ -264,9 +282,54 @@ rpi-kernel-headers_package() {
 	noverifyrdeps=yes
 	noshlibprovides=yes
 	short_desc="${short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi5-kernel-headers>=0"
 	pkg_install() {
 		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		vmove "usr/lib/modules/${_kernver}/build"
+	}
+}
+
+_rpi5_short_desc="Linux kernel for Raspberry Pi 5 (${version%.*} series)"
+
+rpi5-kernel_package() {
+	nodebug=yes
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	python_version=3
+	triggers="kernel-hooks"
+	# These files could be modified when an external module is built.
+	mutable_files="
+	 /usr/lib/modules/${_kernver}/modules.dep
+	 /usr/lib/modules/${_kernver}/modules.dep.bin
+	 /usr/lib/modules/${_kernver}/modules.symbols
+	 /usr/lib/modules/${_kernver}/modules.symbols.bin
+	 /usr/lib/modules/${_kernver}/modules.alias
+	 /usr/lib/modules/${_kernver}/modules.alias.bin
+	 /usr/lib/modules/${_kernver}/modules.devname"
+	short_desc="$_rpi5_short_desc"
+	provides="rpi-kernel-${version}_${revision}"
+	replaces="rpi-kernel>=0"
+	pkg_install() {
+		_configure "bcm2712_defconfig"
+		make "${make_build_args[@]}" prepare
+		make "${make_build_args[@]}" "${_image_target}" modules dtbs
+		_install "rpi5-kernel" "$PKGDESTDIR"
+	}
+}
+
+rpi5-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="${_rpi5_short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi-kernel-headers>=0"
+	pkg_install() {
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/src" "${PKGDESTDIR}"/usr/src
+		vmkdir "usr/lib/modules/${_kernver}"
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/lib/modules/${_kernver}/build" "${PKGDESTDIR}/usr/lib/modules/${_kernver}/build"
 	}
 }
 
diff --git a/srcpkgs/rpi-kernel/update b/srcpkgs/rpi-kernel/update
new file mode 100644
index 0000000000000..60c7b646ca64e
--- /dev/null
+++ b/srcpkgs/rpi-kernel/update
@@ -0,0 +1,2 @@
+site="https://github.com/raspberrypi/linux/commits/rpi-6.1.y/"
+pattern=">Linux \K[\d.]+(?=</a>)"
diff --git a/srcpkgs/rpi5-kernel b/srcpkgs/rpi5-kernel
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi5-kernel-headers b/srcpkgs/rpi5-kernel-headers
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

From 8c3d44b2fe012b3fe667762e394a935ef0f07595 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:05 -0500
Subject: [PATCH 2/5] rpi-firmware: update to 20231221, adopt.

add rpi5-specific firmware
---
 srcpkgs/rpi-firmware/template | 48 +++++++++++++----------------------
 1 file changed, 17 insertions(+), 31 deletions(-)

diff --git a/srcpkgs/rpi-firmware/template b/srcpkgs/rpi-firmware/template
index 0a2efa3b80db0..3f38c0f6f68d1 100644
--- a/srcpkgs/rpi-firmware/template
+++ b/srcpkgs/rpi-firmware/template
@@ -1,45 +1,29 @@
 # Template file for 'rpi-firmware'
 pkgname=rpi-firmware
-version=20230925
+version=20231221
 revision=1
-_rpi_fw=6b37a457122714aa14b2c7df0926455173fd04f1
-_rpi_bt=9556b08ace2a1735127894642cc8ea6529c04c90
-_rpi_brcm=2c3a8701193ba23d0ef85cdf0d0c9e47baf03dfc
+_rpi_fw=0da53ed7928f20b5f4e9e36a3a63fb80b700d908
+_rpi_brcm=88aa085bfa1a4650e1ccd88896f8343c22a24055
+_rpi_bt=d9d4741caba7314d6500f588b1eaa5ab387a4ff5
 create_wrksrc=yes
-archs="armv6l* armv7l* aarch64*"
+archs="aarch64* armv6l* armv7l*"
 short_desc="Firmware files for the Raspberry Pi"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="BSD-3-Clause, custom:Cypress"
 homepage="https://github.com/raspberrypi/firmware"
 distfiles="
  https://github.com/raspberrypi/firmware/archive/${_rpi_fw}.tar.gz
  https://github.com/RPi-Distro/firmware-nonfree/archive/${_rpi_brcm}.tar.gz
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430A1.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430B0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C5.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430A1.hcd>BCM43430A1.raspberrypi,model-zero-2-w.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430B0.hcd>BCM43430B0.raspberrypi,model-zero-2-w.hcd
+ https://github.com/RPi-Distro/bluez-firmware/archive/${_rpi_bt}.tar.gz
  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/LICENCE.cypress>LICENCE.cypress"
-checksum="913986b1be22b8dc30a3e6a9b5a28316b1bbee7bec90040ddefff0d7512560f4
- 9156d90116b921d2e7938b52fad84fbe1d96df622a66c5db09569c735832387a
- c096ad4a5c3f06ed7d69eba246bf89ada9acba64a5b6f51b1e9c12f99bb1e1a7
- 51c45e77ddad91a19e96dc8fb75295b2087c279940df2634b23baf71b6dea42c
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
- fb9f4ec2df5301bd35f416384e103c012c5983024c49aa72fbbaf90177512caa
- 55071227c94d86369d04f9aff3bbfd4197a78a53dc350295123e1a8b048bba8f
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
+checksum="c9288ecc2d314f12517b05378634d4fd73408245100e0cfae4c11ccaa84fcadd
+ bb3d8fed40546e03e29d9e635745433f8083391e62d6ff151c895b892776964a
+ ae076a08ece89624b0449ea2495b0dfe2ea1223f683f5b57f2b89966e6a093d6
  ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f"
-
-skip_extraction="BCM43430A1.hcd BCM4345C0.hcd BCM43430B0.hcd BCM4345C5.hcd
- BCM43430A1.raspberrypi,model-zero-2-w.hcd BCM43430B0.raspberrypi,model-zero-2-w.hcd
- LICENCE.cypress"
-
-provides="linux-firmware-broadcom-${version}_${revision}"
-replaces="linux-firmware-broadcom>=0"
-
+skip_extraction="LICENCE.cypress"
 conf_files="/boot/cmdline.txt /boot/config.txt"
 nostrip=yes
+replaces="rpi-firmware-network>=0"
 
 do_install() {
 	# bootloader
@@ -72,7 +56,9 @@ do_install() {
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43456"* usr/lib/firmware/brcm
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43436"* usr/lib/firmware/brcm
 
-	for file in "${XBPS_SRCDISTDIR}/${pkgname}-${version}/"*.hcd; do
-		vinstall "$file" 0644 usr/lib/firmware/brcm
-	done
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/broadcom/"*.hcd usr/lib/firmware/brcm
+
+	vmkdir usr/lib/firmware/synaptics
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/"*.hcd usr/lib/firmware/synaptics
+	vlicense "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/LICENSE.synaptics"
 }

From 25ed415d7c050c004a9b0c296c51a024fb0ccaa4 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:48 -0500
Subject: [PATCH 3/5] New package: rpi-utils-20231221

replaces rpi-userland:
https://github.com/raspberrypi/userland/blob/master/README.md
---
 .../rpi-utils/patches/no-overlaycheck.patch   | 14 +++++++++++++
 srcpkgs/rpi-utils/template                    | 20 +++++++++++++++++++
 srcpkgs/rpi-utils/update                      |  1 +
 3 files changed, 35 insertions(+)
 create mode 100644 srcpkgs/rpi-utils/patches/no-overlaycheck.patch
 create mode 100644 srcpkgs/rpi-utils/template
 create mode 100644 srcpkgs/rpi-utils/update

diff --git a/srcpkgs/rpi-utils/patches/no-overlaycheck.patch b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
new file mode 100644
index 0000000000000..3e64958e238d2
--- /dev/null
+++ b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
@@ -0,0 +1,14 @@
+This program is not very useful as a downstream, it seems to be only intended
+for internal QA. It also has a lot of weird things like hardcoding the prefixed
+cpp to use and putting a text file in /usr/bin.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,6 @@
+ # List of subsidiary CMakeLists
+ add_subdirectory(dtmerge)
+ add_subdirectory(otpset)
+-add_subdirectory(overlaycheck)
+ add_subdirectory(ovmerge)
+ add_subdirectory(pinctrl)
+ add_subdirectory(raspinfo)
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
new file mode 100644
index 0000000000000..4ba633ed47ab6
--- /dev/null
+++ b/srcpkgs/rpi-utils/template
@@ -0,0 +1,20 @@
+# Template file for 'rpi-utils'
+pkgname=rpi-utils
+version=20231221
+revision=1
+_commit=2cc103f4531a005cadaa8a9d09d6c85523c166bb
+archs="armv6l* armv7l* aarch64*"
+build_style=cmake
+makedepends="dtc-devel"
+depends="python3 perl bash"
+short_desc="Collection of utilities for Raspberry Pi"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="BSD-3-Clause"
+homepage="https://github.com/raspberrypi/utils"
+distfiles="https://github.com/raspberrypi/utils/archive/${_commit}.tar.gz"
+checksum=32e128d437052c66c744f24d75b0835a80a98627e33c48a37172a457024d9275
+python_version=3
+
+post_install() {
+	vlicense LICENCE
+}
diff --git a/srcpkgs/rpi-utils/update b/srcpkgs/rpi-utils/update
new file mode 100644
index 0000000000000..0d9505a5537ba
--- /dev/null
+++ b/srcpkgs/rpi-utils/update
@@ -0,0 +1 @@
+disabled="just following master"

From d0784bc9736ea5d6f510c94f6260ad0b5f5b1ba2 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:51:52 -0500
Subject: [PATCH 4/5] rpi-eeprom: update to 2023.12.14.

- install manpages (like is done in the debian rules)
- adds rpi5 firmware
---
 srcpkgs/rpi-eeprom/template | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/rpi-eeprom/template b/srcpkgs/rpi-eeprom/template
index fb017a50966cd..38fba116a9486 100644
--- a/srcpkgs/rpi-eeprom/template
+++ b/srcpkgs/rpi-eeprom/template
@@ -1,17 +1,18 @@
 # Template file for 'rpi-eeprom'
 pkgname=rpi-eeprom
-version=2023.09.29
+version=2023.12.14
 revision=1
-_githash="4f2d676b4e2a9c2d9ee1ab42015ce711fde97afa"
-archs="armv7* aarch64*"
+_githash=72cedfe5eea64bb8509b7d0fec68f5df5dd22f9e
+archs="armv7l* aarch64*"
 conf_files="/etc/default/rpi-eeprom-update"
-depends="binutils pciutils python3 rpi-firmware rpi-userland"
-short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4"
+hostmakedepends="help2man python3"
+depends="binutils pciutils python3 rpi-firmware rpi-utils"
+short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4/5"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="BSD-3-Clause, custom:Proprietary"
 homepage="https://github.com/raspberrypi/rpi-eeprom/"
 distfiles="https://github.com/raspberrypi/rpi-eeprom/archive/${_githash}.tar.gz"
-checksum="189c5d37f3102247cec72619e3cb357d027ec526fa3c7373d3107bd6c9e30e29"
+checksum=542365a644b3d8e987bda8e0a7dc9d4c9c234ab97b11fa902798a21a08743c30
 python_version=3
 repository=nonfree
 
@@ -21,9 +22,21 @@ do_install() {
 	vbin rpi-eeprom-digest
 	vinstall rpi-eeprom-update-default 644 etc/default rpi-eeprom-update
 
-	vmkdir usr/lib/firmware/raspberrypi/bootloader
-	# need to figure out how to package both pi4 (2711) and pi5 (2712) fw
-	vcopy firmware-2711/* usr/lib/firmware/raspberrypi/bootloader/
+	# from https://github.com/raspberrypi/rpi-eeprom/blob/debian/bookworm/debian/rules
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Checks whether the Raspberry Pi bootloader EEPROM is up-to-date and updates the EEPROM" \
+		--output=rpi-eeprom-update.1 ./rpi-eeprom-update
+	vman rpi-eeprom-update.1
+
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Bootloader EEPROM configuration tool for the Raspberry Pi 4/5" \
+		--output=rpi-eeprom-config.1 ./rpi-eeprom-config
+	vman rpi-eeprom-config.1
+
+	for soc in 2711 2712; do
+		vmkdir usr/lib/firmware/raspberrypi/bootloader-"$soc"
+		vcopy firmware-"$soc"/* usr/lib/firmware/raspberrypi/bootloader-"$soc"/
+	done
 
 	vlicense LICENSE
 }

From a7c13047120351db4612a20fde257b56921fef0f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 23 Dec 2023 16:36:25 -0500
Subject: [PATCH 5/5] linux-firmware: remove conflict between -broadcom and
 rpi-firmware

these files differ between linux-firmware-broadcom and rpi-firmware, but
they should only ever be necessary for raspberry pi users, and the
rpi-firmware version is probably the one that is more likely to work and
work better.
---
 srcpkgs/linux-firmware/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/linux-firmware/template b/srcpkgs/linux-firmware/template
index 786d6d5566d38..e84008531b2f6 100644
--- a/srcpkgs/linux-firmware/template
+++ b/srcpkgs/linux-firmware/template
@@ -1,7 +1,7 @@
 # Template file for 'linux-firmware'
 pkgname=linux-firmware
 version=20231211
-revision=1
+revision=2
 hostmakedepends="rdfind which"
 depends="linux-firmware-amd>=${version}_${revision} linux-firmware-network>=${version}_${revision}"
 short_desc="Binary firmware blobs for the Linux kernel"
@@ -43,13 +43,14 @@ linux-firmware-amd_package() {
 linux-firmware-broadcom_package() {
 	short_desc+=" - Broadcom network blobs"
 	nostrip=yes
-	replaces="rpi-firmware-network>=0"
 	pkg_install() {
 		vmove usr/lib/firmware/brcm
 		vmove usr/share/licenses/linux-firmware/LICENCE.broadcom_bcm43xx
 		# firmware/brcm contains multiple symlinks to ../cypress/
 		vmove usr/lib/firmware/cypress
 		vmove usr/share/licenses/linux-firmware/LICENCE.cypress
+		# provided by rpi-firmware
+		find "${PKGDESTDIR}"/usr/lib/firmware/brcm -iname '*raspberry*.txt' -delete
 	}
 }
 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (9 preceding siblings ...)
  2023-12-23 22:24 ` [PR PATCH] [Updated] " classabbyamp
@ 2023-12-23 22:26 ` classabbyamp
  2024-01-05 19:46 ` [PR PATCH] [Updated] " classabbyamp
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2023-12-23 22:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/47288#issuecomment-1868344109

Comment:
updated things because this has sat for a bit

new versions should be available at https://files.placeviolette.net/rpi5 for testing

TODOs left:
- [ ] give everything a quick test
- [x] deconflict `linux-firmware-broadcom` and `rpi-firmware` (probably simple)
- [ ] figure out #47290
- [ ] rpi5-kernel pagesize gives issues with jemalloc

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (10 preceding siblings ...)
  2023-12-23 22:26 ` classabbyamp
@ 2024-01-05 19:46 ` classabbyamp
  2024-01-05 21:26 ` classabbyamp
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2024-01-05 19:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages rpi5
https://github.com/void-linux/void-packages/pull/47288

rpi-*: update and support rpi5
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES**
  - [x] 1B+ (armv6l)
  - [ ] 0 (armv6l)
  - [ ] 1A+ (armv6l)
  - [ ] 2B (armv7l)
  - [x] 3B (aarch64)
  - [x] 02W (aarch64)
  - [x] 4B (aarch64)
  - [x] 5 (aarch64)

### Prebuilt packages and RPi5-compatible install images for testing

**packages:** https://files.placeviolette.net/rpi5

```
`https://files.placeviolette.net/rpi5' repository has been RSA signed by "classabbyamp"
Fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
```
**images:** https://files.placeviolette.net/rpi5-live

`rpi5-kernel` is not installed by default on these images, but can be seamlessly switched to by installing it. it will uninstall  `rpi-kernel` (and vice-versa). RPi5 is compatible with both, but `rpi5-kernel` may provide some performance benefits.

The images also include the changes from void-linux/void-mklive#361

[ci skip]

closes #46815 
closes #46522 

A patch file from https://github.com/void-linux/void-packages/pull/47288.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi5-47288.patch --]
[-- Type: text/x-diff, Size: 28498 bytes --]

From bd0c7ca0cabb0f1a4c6659dfd6901447bb8bc260 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:48:03 -0500
Subject: [PATCH 1/5] rpi-kernel: update to 6.1.69, adopt.

- add rpi5 support and optimised kernel
- add support for BTRFS root
- add /proc/config.gz by default
---
 .../rpi-kernel/patches/irqsoff-tracer.patch   |  91 +++++++
 srcpkgs/rpi-kernel/template                   | 225 +++++++++++-------
 srcpkgs/rpi-kernel/update                     |   2 +
 srcpkgs/rpi5-kernel                           |   1 +
 srcpkgs/rpi5-kernel-headers                   |   1 +
 5 files changed, 239 insertions(+), 81 deletions(-)
 create mode 100644 srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
 create mode 100644 srcpkgs/rpi-kernel/update
 create mode 120000 srcpkgs/rpi5-kernel
 create mode 120000 srcpkgs/rpi5-kernel-headers

diff --git a/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch b/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
new file mode 100644
index 0000000000000..09501632fd8dc
--- /dev/null
+++ b/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
@@ -0,0 +1,91 @@
+From 342c7ee49e862edc30c893f141f55b9211b7a43b Mon Sep 17 00:00:00 2001
+From: Yangyu Chen <cyy@cyyself.name>
+Date: Mon, 18 Dec 2023 23:26:59 +0800
+Subject: [PATCH] configs: rpi: Disable CONFIG_IRQSOFF_TRACER by default
+
+This configuration hindered performance by ~74% measured from RPI 4B
+from ~680Mbps to ~390Mbps when benchmarking wireguard locally using
+netns and iperf3. Remove it by default for better performance.
+
+Signed-off-by: Yangyu Chen <cyy@cyyself.name>
+---
+ arch/arm/configs/bcm2709_defconfig   | 1 -
+ arch/arm/configs/bcm2711_defconfig   | 1 -
+ arch/arm/configs/bcmrpi_defconfig    | 1 -
+ arch/arm64/configs/bcm2711_defconfig | 1 -
+ arch/arm64/configs/bcm2712_defconfig | 1 -
+ arch/arm64/configs/bcmrpi3_defconfig | 1 -
+ 6 files changed, 6 deletions(-)
+
+diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
+index 980e70d0178fa..c8aa65e82d8bb 100644
+--- a/arch/arm/configs/bcm2709_defconfig
++++ b/arch/arm/configs/bcm2709_defconfig
+@@ -1586,7 +1586,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm/configs/bcm2711_defconfig b/arch/arm/configs/bcm2711_defconfig
+index 806c6d81590a6..2578d23b1886e 100644
+--- a/arch/arm/configs/bcm2711_defconfig
++++ b/arch/arm/configs/bcm2711_defconfig
+@@ -1613,7 +1613,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
+index fad465fe4c70e..a2519b5abb6d6 100644
+--- a/arch/arm/configs/bcmrpi_defconfig
++++ b/arch/arm/configs/bcmrpi_defconfig
+@@ -1580,7 +1580,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcm2711_defconfig b/arch/arm64/configs/bcm2711_defconfig
+index 819c442e5acfe..afbd8ef3e8d3b 100644
+--- a/arch/arm64/configs/bcm2711_defconfig
++++ b/arch/arm64/configs/bcm2711_defconfig
+@@ -1675,7 +1675,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcm2712_defconfig b/arch/arm64/configs/bcm2712_defconfig
+index 15a0aa6c77137..76effcbc199b5 100644
+--- a/arch/arm64/configs/bcm2712_defconfig
++++ b/arch/arm64/configs/bcm2712_defconfig
+@@ -1678,7 +1678,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig
+index d3d879d03ff45..6fca561ba4084 100644
+--- a/arch/arm64/configs/bcmrpi3_defconfig
++++ b/arch/arm64/configs/bcmrpi3_defconfig
+@@ -1561,7 +1561,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 2fa1bb54b683e..704cc1f6646ce 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -12,19 +12,21 @@
 #
 # Upstream documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html
 pkgname=rpi-kernel
-version=6.1.54
+version=6.1.69
 revision=1
-_githash=fad58933544bb2a7b7db92847c25c79a83171fa6
+_githash=aabc6f6d0b13ac177f9b383e59a542ddb6c32e59
 archs="armv6l* armv7l* aarch64*"
 hostmakedepends="perl kmod uboot-mkimage openssl-devel bc bison flex xz"
 makedepends="ncurses-devel"
 short_desc="Linux kernel for Raspberry Pi (${version%.*} series)"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="GPL-2.0-only"
 homepage="http://www.kernel.org"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
-checksum=1bd02902fae49351fb16ac0d5ccc3bf4d67aa0640006dbbf8846963519b01ab8
+checksum=31a39457e4f3075bf7a1113aae17f9a17241b425aa194639c886bc639cf1da5d
 python_version=3
+provides="rpi-kernel-${version}_${revision}"
+replaces="rpi5-kernel>=0"
 
 _kernver="${version}_${revision}"
 
@@ -51,28 +53,20 @@ case "$XBPS_TARGET_MACHINE" in
 	*) broken="No Raspberry Pi exists for this arch" ;;
 esac
 
+make_build_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+make_install_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+
 if [ "$CROSS_BUILD" ]; then
-	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
-else
-	_cross=
+	make_build_args+=("CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-")
 fi
 
-do_configure() {
-	local target defconfig
-
-	case "$XBPS_TARGET_MACHINE" in
-		# for zero, 1
-		armv6l*) target=bcmrpi_defconfig ;;
-		# for 2
-		armv7l*) target=bcm2709_defconfig ;;
-		# for 3, 4, zero 2
-		aarch64*) target=bcm2711_defconfig ;;
-	esac
+_configure() {
+	local target="$1" defconfig
 
 	defconfig="arch/${_arch}/configs/${target}"
 	cp "$defconfig" .config
 
-	cat <<-! > "foo"
+	cat <<-! > void.config
 	CONFIG_CONNECTOR=y
 	CONFIG_HID_STEAM=y
 	CONFIG_PROC_EVENTS=y
@@ -113,15 +107,21 @@ do_configure() {
 	CONFIG_LZ4_COMPRESS=y
 	CONFIG_CRYPTO_RNG=y
 	CONFIG_CRYPTO_RNG_DEFAULT=y
+	CONFIG_BTRFS_FS=y
+	CONFIG_BTRFS_POSIX_ACL=y
+	CONFIG_IKCONFIG=y
+	CONFIG_IKCONFIG_PROC=y
+	CONFIG_LEDS_TRIGGER_ACTIVITY=m
 	!
 
 	while read -r line; do
+		local option="" str="" cmd=""
 		# skip comments
 		case "$line" in
 			"#"*) continue;;
 		esac
-		local option=${line%%=*} str=
-		local cmd="$(echo "$line" | cut -d= -f2)"
+		option="${line%%=*}"
+		cmd="$(echo "$line" | cut -d= -f2)"
 		case "$cmd" in
 			y) cmd="enable";;
 			n) cmd="disable";;
@@ -135,31 +135,27 @@ do_configure() {
 		./scripts/config \
 			--file .config \
 			"--$cmd" "$option" "${str//\"/}"
-	done < foo
+	done < void.config
 
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" olddefconfig
+	make "${make_build_args[@]}" olddefconfig
 }
 
-do_build() {
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" prepare
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" "${_image_target}" modules dtbs
-}
-
-do_install() {
-	local hdrdest="${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}"
+_install() {
+	local _pkg="$1" _destdir="$2"
+	local hdrdest="usr/src/${_pkg}-headers-${_kernver}"
 
 	# Run depmod after compressing modules.
 	vsed -i -e '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
-	make "${makejobs}" ARCH="${_arch}" INSTALL_MOD_PATH="${DESTDIR}" modules_install
+	make "${make_install_args[@]}" INSTALL_MOD_PATH="${_destdir}" modules_install
 
 	# Install device tree blobs
-	make "${makejobs}" "ARCH=${_arch}" INSTALL_DTBS_PATH="${DESTDIR}/boot" dtbs_install
+	make "${make_install_args[@]}" INSTALL_DTBS_PATH="${_destdir}/boot" dtbs_install
 
 	# move dtbs that ended up in /boot/broadcom
-	if [ -d "${DESTDIR}/boot/broadcom" ]; then
-		mv "${DESTDIR}"/boot/broadcom/*dtb "${DESTDIR}/boot"
+	if [ -d "${_destdir}/boot/broadcom" ]; then
+		mv "${_destdir}"/boot/broadcom/*dtb "${_destdir}/boot"
 	fi
 
 	# Install kernel image
@@ -167,96 +163,118 @@ do_install() {
 
 	# Switch to /usr.
 	vmkdir usr
-	mv "${DESTDIR}/lib" "${DESTDIR}/usr"
+	mv "${_destdir}/lib" "${_destdir}/usr"
 
-	pushd "${DESTDIR}/usr/lib/modules/${_kernver}"
+	pushd "${_destdir}/usr/lib/modules/${_kernver}"
 	rm -f source build
-	ln -sf "../../../src/${sourcepkg}-headers-${_kernver}" build
+	ln -sf "../../../src/${_pkg}-headers-${_kernver}" build
 	popd
 
 	# Install required headers to build external modules
-	install -Dm644 Makefile "${hdrdest}/Makefile"
-	install -Dm644 Kbuild "${hdrdest}/Kbuild"
-	install -Dm644 kernel/Makefile "${hdrdest}/kernel/Makefile"
-	install -Dm644 .config "${hdrdest}/.config"
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname "$file")"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find . -name 'Kconfig*')
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname $file)"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform)
-	mkdir -p "${hdrdest}/include"
+	vinstall Makefile 644 "${hdrdest}"
+	vinstall Kbuild 644 "${hdrdest}"
+	vinstall kernel/Makefile 644 "${hdrdest}/kernel"
+	vinstall .config 644 "${hdrdest}"
+	find . -name 'Kconfig*' | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	vmkdir "${hdrdest}/include"
 
 	# Remove firmware stuff provided by the "linux-firmware" pkg.
-	rm -rf "${DESTDIR}/usr/lib/firmware"
+	rm -rf "${_destdir}/usr/lib/firmware"
 
-	for i in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
+	for d in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
 		math-emu media net pcmcia scsi sound trace uapi vdso video xen; do
-		[ -d include/$i ] && cp -a "include/$i" "${hdrdest}/include"
+		[ -d include/$d ] && vcopy "include/$d" "${hdrdest}/include"
 	done
 
 	# Remove helper binaries built for host,
 	# if generated files from the scripts/ directory need to be included,
 	# they need to be copied to ${hdrdest} before this step
 	if [ "$CROSS_BUILD" ]; then
-		make "${makejobs}" ARCH="${_arch}" _mrproper_scripts
+		make "${make_install_args[@]}" _mrproper_scripts
 		# remove host specific objects as well
 		find scripts -name '*.o' -delete
 	fi
 
 	# Copy files necessary for later builds.
-	cp Module.symvers "${hdrdest}"
-	cp -a scripts "${hdrdest}"
-	mkdir -p "${hdrdest}/security/selinux"
-	cp -a security/selinux/include "${hdrdest}/security/selinux"
-	mkdir -p "${hdrdest}/tools/include"
-	cp -a tools/include/tools "${hdrdest}/tools/include"
+	vinstall Module.symvers 644 "${hdrdest}"
+	vcopy scripts "${hdrdest}"
+	vmkdir "${hdrdest}/security/selinux"
+	vcopy security/selinux/include "${hdrdest}/security/selinux"
+	vmkdir "${hdrdest}/tools/include"
+	vcopy tools/include/tools "${hdrdest}/tools/include"
 	if [ -d "arch/${_arch}/tools" ]; then
-		cp -a "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
+		vcopy "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
 	fi
-	cp -a kernel/time/timeconst.bc "${hdrdest}/kernel/time"
-	cp -a kernel/bounds.c "${hdrdest}/kernel"
-	mkdir -p "${hdrdest}/arch/x86/entry/syscalls"
-	cp -a arch/x86/entry/syscalls/syscall_32.tbl "${hdrdest}/arch/x86/entry/syscalls"
+	vinstall kernel/time/timeconst.bc 644 "${hdrdest}/kernel/time"
+	vinstall kernel/bounds.c 644 "${hdrdest}/kernel"
+	vinstall arch/x86/entry/syscalls/syscall_32.tbl 644 "${hdrdest}/arch/x86/entry/syscalls"
 
 	# copy arch includes for external modules
-	mkdir -p "${hdrdest}/arch/${_arch}"
-	cp -a "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
+	vmkdir "${hdrdest}/arch/${_arch}"
+	vcopy "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
 
 	mkdir -p "${hdrdest}/arch/${_arch}/kernel"
-	cp "arch/${_arch}/Makefile" "${hdrdest}/arch/${_arch}"
-	cp "arch/${_arch}/kernel/asm-offsets.s" "${hdrdest}/arch/${_arch}/kernel"
+	vinstall "arch/${_arch}/Makefile" 644 "${hdrdest}/arch/${_arch}"
+	vinstall "arch/${_arch}/kernel/asm-offsets.s" 644 "${hdrdest}/arch/${_arch}/kernel"
 	if [ "$_arch" = "arm64" ] ; then
-		cp -a "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
+		vcopy "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
 	fi
 
 	# Add md headers
-	mkdir -p "${hdrdest}/drivers/md"
-	cp drivers/md/*.h "${hdrdest}/drivers/md"
+	vmkdir "${hdrdest}/drivers/md"
+	vcopy drivers/md/*.h "${hdrdest}/drivers/md"
 
 	# Add inotify.h
-	mkdir -p "${hdrdest}/include/linux"
-	cp include/linux/inotify.h "${hdrdest}/include/linux"
+	vinstall include/linux/inotify.h 644 "${hdrdest}/include/linux"
 
 	# Add wireless headers
-	mkdir -p "${hdrdest}/net/mac80211/"
-	cp net/mac80211/*.h "${hdrdest}/net/mac80211"
+	vmkdir "${hdrdest}/net/mac80211/"
+	vcopy net/mac80211/*.h "${hdrdest}/net/mac80211"
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
-	find "${DESTDIR}" -name '*.ko' | xargs -n1 -P0 gzip -9
+	msg_normal "$_pkg-$version: compressing kernel modules with gzip, please wait...\n"
+	find "${_destdir}" -name '*.ko' | xargs -n1 -P0 gzip -9
 
 	# ... and run depmod again.
-	depmod -b "${DESTDIR}/usr" -F System.map "${_kernver}"
+	depmod -b "${_destdir}/usr" -F System.map "${_kernver}"
+}
+
+do_configure() {
+	local target
+
+	case "$XBPS_TARGET_MACHINE" in
+		# for zero, 1
+		armv6l*) target=bcmrpi_defconfig ;;
+		# for 2
+		armv7l*) target=bcm2709_defconfig ;;
+		# for 3, 4, zero 2, 5
+		aarch64*) target=bcm2711_defconfig ;;
+	esac
+
+	_configure "$target"
+}
+
+do_build() {
+	make "${make_build_args[@]}" prepare
+	make "${make_build_args[@]}" "${_image_target}" modules dtbs
+}
+
+do_install() {
+	_install "$pkgname" "$DESTDIR"
 }
 
 subpackages="rpi-kernel-headers"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv7l*) subpackages+=" rpi2-kernel rpi2-kernel-headers" ;;
-	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers" ;;
+	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers rpi5-kernel rpi5-kernel-headers" ;;
 esac
 
 rpi-kernel-headers_package() {
@@ -264,9 +282,54 @@ rpi-kernel-headers_package() {
 	noverifyrdeps=yes
 	noshlibprovides=yes
 	short_desc="${short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi5-kernel-headers>=0"
 	pkg_install() {
 		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		vmove "usr/lib/modules/${_kernver}/build"
+	}
+}
+
+_rpi5_short_desc="Linux kernel for Raspberry Pi 5 (${version%.*} series)"
+
+rpi5-kernel_package() {
+	nodebug=yes
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	python_version=3
+	triggers="kernel-hooks"
+	# These files could be modified when an external module is built.
+	mutable_files="
+	 /usr/lib/modules/${_kernver}/modules.dep
+	 /usr/lib/modules/${_kernver}/modules.dep.bin
+	 /usr/lib/modules/${_kernver}/modules.symbols
+	 /usr/lib/modules/${_kernver}/modules.symbols.bin
+	 /usr/lib/modules/${_kernver}/modules.alias
+	 /usr/lib/modules/${_kernver}/modules.alias.bin
+	 /usr/lib/modules/${_kernver}/modules.devname"
+	short_desc="$_rpi5_short_desc"
+	provides="rpi-kernel-${version}_${revision}"
+	replaces="rpi-kernel>=0"
+	pkg_install() {
+		_configure "bcm2712_defconfig"
+		make "${make_build_args[@]}" prepare
+		make "${make_build_args[@]}" "${_image_target}" modules dtbs
+		_install "rpi5-kernel" "$PKGDESTDIR"
+	}
+}
+
+rpi5-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="${_rpi5_short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi-kernel-headers>=0"
+	pkg_install() {
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/src" "${PKGDESTDIR}"/usr/src
+		vmkdir "usr/lib/modules/${_kernver}"
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/lib/modules/${_kernver}/build" "${PKGDESTDIR}/usr/lib/modules/${_kernver}/build"
 	}
 }
 
diff --git a/srcpkgs/rpi-kernel/update b/srcpkgs/rpi-kernel/update
new file mode 100644
index 0000000000000..60c7b646ca64e
--- /dev/null
+++ b/srcpkgs/rpi-kernel/update
@@ -0,0 +1,2 @@
+site="https://github.com/raspberrypi/linux/commits/rpi-6.1.y/"
+pattern=">Linux \K[\d.]+(?=</a>)"
diff --git a/srcpkgs/rpi5-kernel b/srcpkgs/rpi5-kernel
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi5-kernel-headers b/srcpkgs/rpi5-kernel-headers
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

From c13e5ce5b87a07b1325dbcadbd301ad57074d611 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:05 -0500
Subject: [PATCH 2/5] rpi-firmware: update to 20231221, adopt.

add rpi5-specific firmware
---
 srcpkgs/rpi-firmware/template | 48 +++++++++++++----------------------
 1 file changed, 17 insertions(+), 31 deletions(-)

diff --git a/srcpkgs/rpi-firmware/template b/srcpkgs/rpi-firmware/template
index 0a2efa3b80db0..3f38c0f6f68d1 100644
--- a/srcpkgs/rpi-firmware/template
+++ b/srcpkgs/rpi-firmware/template
@@ -1,45 +1,29 @@
 # Template file for 'rpi-firmware'
 pkgname=rpi-firmware
-version=20230925
+version=20231221
 revision=1
-_rpi_fw=6b37a457122714aa14b2c7df0926455173fd04f1
-_rpi_bt=9556b08ace2a1735127894642cc8ea6529c04c90
-_rpi_brcm=2c3a8701193ba23d0ef85cdf0d0c9e47baf03dfc
+_rpi_fw=0da53ed7928f20b5f4e9e36a3a63fb80b700d908
+_rpi_brcm=88aa085bfa1a4650e1ccd88896f8343c22a24055
+_rpi_bt=d9d4741caba7314d6500f588b1eaa5ab387a4ff5
 create_wrksrc=yes
-archs="armv6l* armv7l* aarch64*"
+archs="aarch64* armv6l* armv7l*"
 short_desc="Firmware files for the Raspberry Pi"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="BSD-3-Clause, custom:Cypress"
 homepage="https://github.com/raspberrypi/firmware"
 distfiles="
  https://github.com/raspberrypi/firmware/archive/${_rpi_fw}.tar.gz
  https://github.com/RPi-Distro/firmware-nonfree/archive/${_rpi_brcm}.tar.gz
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430A1.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430B0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C5.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430A1.hcd>BCM43430A1.raspberrypi,model-zero-2-w.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430B0.hcd>BCM43430B0.raspberrypi,model-zero-2-w.hcd
+ https://github.com/RPi-Distro/bluez-firmware/archive/${_rpi_bt}.tar.gz
  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/LICENCE.cypress>LICENCE.cypress"
-checksum="913986b1be22b8dc30a3e6a9b5a28316b1bbee7bec90040ddefff0d7512560f4
- 9156d90116b921d2e7938b52fad84fbe1d96df622a66c5db09569c735832387a
- c096ad4a5c3f06ed7d69eba246bf89ada9acba64a5b6f51b1e9c12f99bb1e1a7
- 51c45e77ddad91a19e96dc8fb75295b2087c279940df2634b23baf71b6dea42c
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
- fb9f4ec2df5301bd35f416384e103c012c5983024c49aa72fbbaf90177512caa
- 55071227c94d86369d04f9aff3bbfd4197a78a53dc350295123e1a8b048bba8f
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
+checksum="c9288ecc2d314f12517b05378634d4fd73408245100e0cfae4c11ccaa84fcadd
+ bb3d8fed40546e03e29d9e635745433f8083391e62d6ff151c895b892776964a
+ ae076a08ece89624b0449ea2495b0dfe2ea1223f683f5b57f2b89966e6a093d6
  ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f"
-
-skip_extraction="BCM43430A1.hcd BCM4345C0.hcd BCM43430B0.hcd BCM4345C5.hcd
- BCM43430A1.raspberrypi,model-zero-2-w.hcd BCM43430B0.raspberrypi,model-zero-2-w.hcd
- LICENCE.cypress"
-
-provides="linux-firmware-broadcom-${version}_${revision}"
-replaces="linux-firmware-broadcom>=0"
-
+skip_extraction="LICENCE.cypress"
 conf_files="/boot/cmdline.txt /boot/config.txt"
 nostrip=yes
+replaces="rpi-firmware-network>=0"
 
 do_install() {
 	# bootloader
@@ -72,7 +56,9 @@ do_install() {
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43456"* usr/lib/firmware/brcm
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43436"* usr/lib/firmware/brcm
 
-	for file in "${XBPS_SRCDISTDIR}/${pkgname}-${version}/"*.hcd; do
-		vinstall "$file" 0644 usr/lib/firmware/brcm
-	done
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/broadcom/"*.hcd usr/lib/firmware/brcm
+
+	vmkdir usr/lib/firmware/synaptics
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/"*.hcd usr/lib/firmware/synaptics
+	vlicense "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/LICENSE.synaptics"
 }

From 607a956670922a7bb8894b7cd615c9a1d8712460 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:48 -0500
Subject: [PATCH 3/5] New package: rpi-utils-20231221

replaces rpi-userland:
https://github.com/raspberrypi/userland/blob/master/README.md
---
 .../rpi-utils/patches/no-overlaycheck.patch   | 14 +++++++++++++
 srcpkgs/rpi-utils/template                    | 20 +++++++++++++++++++
 srcpkgs/rpi-utils/update                      |  1 +
 3 files changed, 35 insertions(+)
 create mode 100644 srcpkgs/rpi-utils/patches/no-overlaycheck.patch
 create mode 100644 srcpkgs/rpi-utils/template
 create mode 100644 srcpkgs/rpi-utils/update

diff --git a/srcpkgs/rpi-utils/patches/no-overlaycheck.patch b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
new file mode 100644
index 0000000000000..3e64958e238d2
--- /dev/null
+++ b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
@@ -0,0 +1,14 @@
+This program is not very useful as a downstream, it seems to be only intended
+for internal QA. It also has a lot of weird things like hardcoding the prefixed
+cpp to use and putting a text file in /usr/bin.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,6 @@
+ # List of subsidiary CMakeLists
+ add_subdirectory(dtmerge)
+ add_subdirectory(otpset)
+-add_subdirectory(overlaycheck)
+ add_subdirectory(ovmerge)
+ add_subdirectory(pinctrl)
+ add_subdirectory(raspinfo)
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
new file mode 100644
index 0000000000000..4ba633ed47ab6
--- /dev/null
+++ b/srcpkgs/rpi-utils/template
@@ -0,0 +1,20 @@
+# Template file for 'rpi-utils'
+pkgname=rpi-utils
+version=20231221
+revision=1
+_commit=2cc103f4531a005cadaa8a9d09d6c85523c166bb
+archs="armv6l* armv7l* aarch64*"
+build_style=cmake
+makedepends="dtc-devel"
+depends="python3 perl bash"
+short_desc="Collection of utilities for Raspberry Pi"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="BSD-3-Clause"
+homepage="https://github.com/raspberrypi/utils"
+distfiles="https://github.com/raspberrypi/utils/archive/${_commit}.tar.gz"
+checksum=32e128d437052c66c744f24d75b0835a80a98627e33c48a37172a457024d9275
+python_version=3
+
+post_install() {
+	vlicense LICENCE
+}
diff --git a/srcpkgs/rpi-utils/update b/srcpkgs/rpi-utils/update
new file mode 100644
index 0000000000000..0d9505a5537ba
--- /dev/null
+++ b/srcpkgs/rpi-utils/update
@@ -0,0 +1 @@
+disabled="just following master"

From fdf66f329ee4d6d0ebcd9bce94b56e95bf134c67 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:51:52 -0500
Subject: [PATCH 4/5] rpi-eeprom: update to 2023.12.14.

- install manpages (like is done in the debian rules)
- adds rpi5 firmware
---
 srcpkgs/rpi-eeprom/template | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/rpi-eeprom/template b/srcpkgs/rpi-eeprom/template
index fb017a50966cd..38fba116a9486 100644
--- a/srcpkgs/rpi-eeprom/template
+++ b/srcpkgs/rpi-eeprom/template
@@ -1,17 +1,18 @@
 # Template file for 'rpi-eeprom'
 pkgname=rpi-eeprom
-version=2023.09.29
+version=2023.12.14
 revision=1
-_githash="4f2d676b4e2a9c2d9ee1ab42015ce711fde97afa"
-archs="armv7* aarch64*"
+_githash=72cedfe5eea64bb8509b7d0fec68f5df5dd22f9e
+archs="armv7l* aarch64*"
 conf_files="/etc/default/rpi-eeprom-update"
-depends="binutils pciutils python3 rpi-firmware rpi-userland"
-short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4"
+hostmakedepends="help2man python3"
+depends="binutils pciutils python3 rpi-firmware rpi-utils"
+short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4/5"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="BSD-3-Clause, custom:Proprietary"
 homepage="https://github.com/raspberrypi/rpi-eeprom/"
 distfiles="https://github.com/raspberrypi/rpi-eeprom/archive/${_githash}.tar.gz"
-checksum="189c5d37f3102247cec72619e3cb357d027ec526fa3c7373d3107bd6c9e30e29"
+checksum=542365a644b3d8e987bda8e0a7dc9d4c9c234ab97b11fa902798a21a08743c30
 python_version=3
 repository=nonfree
 
@@ -21,9 +22,21 @@ do_install() {
 	vbin rpi-eeprom-digest
 	vinstall rpi-eeprom-update-default 644 etc/default rpi-eeprom-update
 
-	vmkdir usr/lib/firmware/raspberrypi/bootloader
-	# need to figure out how to package both pi4 (2711) and pi5 (2712) fw
-	vcopy firmware-2711/* usr/lib/firmware/raspberrypi/bootloader/
+	# from https://github.com/raspberrypi/rpi-eeprom/blob/debian/bookworm/debian/rules
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Checks whether the Raspberry Pi bootloader EEPROM is up-to-date and updates the EEPROM" \
+		--output=rpi-eeprom-update.1 ./rpi-eeprom-update
+	vman rpi-eeprom-update.1
+
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Bootloader EEPROM configuration tool for the Raspberry Pi 4/5" \
+		--output=rpi-eeprom-config.1 ./rpi-eeprom-config
+	vman rpi-eeprom-config.1
+
+	for soc in 2711 2712; do
+		vmkdir usr/lib/firmware/raspberrypi/bootloader-"$soc"
+		vcopy firmware-"$soc"/* usr/lib/firmware/raspberrypi/bootloader-"$soc"/
+	done
 
 	vlicense LICENSE
 }

From 983cb1c0ca3fcd9d0bf911c13e12a42b4977558c Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 23 Dec 2023 16:36:25 -0500
Subject: [PATCH 5/5] linux-firmware: remove conflict between -broadcom and
 rpi-firmware

these files differ between linux-firmware-broadcom and rpi-firmware, but
they should only ever be necessary for raspberry pi users, and the
rpi-firmware version is probably the one that is more likely to work and
work better.
---
 srcpkgs/linux-firmware/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/linux-firmware/template b/srcpkgs/linux-firmware/template
index 786d6d5566d38..e84008531b2f6 100644
--- a/srcpkgs/linux-firmware/template
+++ b/srcpkgs/linux-firmware/template
@@ -1,7 +1,7 @@
 # Template file for 'linux-firmware'
 pkgname=linux-firmware
 version=20231211
-revision=1
+revision=2
 hostmakedepends="rdfind which"
 depends="linux-firmware-amd>=${version}_${revision} linux-firmware-network>=${version}_${revision}"
 short_desc="Binary firmware blobs for the Linux kernel"
@@ -43,13 +43,14 @@ linux-firmware-amd_package() {
 linux-firmware-broadcom_package() {
 	short_desc+=" - Broadcom network blobs"
 	nostrip=yes
-	replaces="rpi-firmware-network>=0"
 	pkg_install() {
 		vmove usr/lib/firmware/brcm
 		vmove usr/share/licenses/linux-firmware/LICENCE.broadcom_bcm43xx
 		# firmware/brcm contains multiple symlinks to ../cypress/
 		vmove usr/lib/firmware/cypress
 		vmove usr/share/licenses/linux-firmware/LICENCE.cypress
+		# provided by rpi-firmware
+		find "${PKGDESTDIR}"/usr/lib/firmware/brcm -iname '*raspberry*.txt' -delete
 	}
 }
 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (11 preceding siblings ...)
  2024-01-05 19:46 ` [PR PATCH] [Updated] " classabbyamp
@ 2024-01-05 21:26 ` classabbyamp
  2024-01-05 21:28 ` classabbyamp
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2024-01-05 21:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages rpi5
https://github.com/void-linux/void-packages/pull/47288

rpi-*: update and support rpi5
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES**
  - [x] 1B+ (armv6l)
  - [ ] 0 (armv6l)
  - [ ] 1A+ (armv6l)
  - [ ] 2B (armv7l)
  - [x] 3B (aarch64)
  - [x] 02W (aarch64)
  - [x] 4B (aarch64)
  - [x] 5 (aarch64)

### Prebuilt packages and RPi5-compatible install images for testing

**packages:** https://files.placeviolette.net/rpi5

```
`https://files.placeviolette.net/rpi5' repository has been RSA signed by "classabbyamp"
Fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
```
**images:** https://files.placeviolette.net/rpi5-live

`rpi5-kernel` is not installed by default on these images, but can be seamlessly switched to by installing it. it will uninstall  `rpi-kernel` (and vice-versa). RPi5 is compatible with both, but `rpi5-kernel` may provide some performance benefits.

The images also include the changes from void-linux/void-mklive#361

[ci skip]

closes #46815 
closes #46522 

A patch file from https://github.com/void-linux/void-packages/pull/47288.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi5-47288.patch --]
[-- Type: text/x-diff, Size: 53803 bytes --]

From bd0c7ca0cabb0f1a4c6659dfd6901447bb8bc260 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:48:03 -0500
Subject: [PATCH 01/11] rpi-kernel: update to 6.1.69, adopt.

- add rpi5 support and optimised kernel
- add support for BTRFS root
- add /proc/config.gz by default
---
 .../rpi-kernel/patches/irqsoff-tracer.patch   |  91 +++++++
 srcpkgs/rpi-kernel/template                   | 225 +++++++++++-------
 srcpkgs/rpi-kernel/update                     |   2 +
 srcpkgs/rpi5-kernel                           |   1 +
 srcpkgs/rpi5-kernel-headers                   |   1 +
 5 files changed, 239 insertions(+), 81 deletions(-)
 create mode 100644 srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
 create mode 100644 srcpkgs/rpi-kernel/update
 create mode 120000 srcpkgs/rpi5-kernel
 create mode 120000 srcpkgs/rpi5-kernel-headers

diff --git a/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch b/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
new file mode 100644
index 0000000000000..09501632fd8dc
--- /dev/null
+++ b/srcpkgs/rpi-kernel/patches/irqsoff-tracer.patch
@@ -0,0 +1,91 @@
+From 342c7ee49e862edc30c893f141f55b9211b7a43b Mon Sep 17 00:00:00 2001
+From: Yangyu Chen <cyy@cyyself.name>
+Date: Mon, 18 Dec 2023 23:26:59 +0800
+Subject: [PATCH] configs: rpi: Disable CONFIG_IRQSOFF_TRACER by default
+
+This configuration hindered performance by ~74% measured from RPI 4B
+from ~680Mbps to ~390Mbps when benchmarking wireguard locally using
+netns and iperf3. Remove it by default for better performance.
+
+Signed-off-by: Yangyu Chen <cyy@cyyself.name>
+---
+ arch/arm/configs/bcm2709_defconfig   | 1 -
+ arch/arm/configs/bcm2711_defconfig   | 1 -
+ arch/arm/configs/bcmrpi_defconfig    | 1 -
+ arch/arm64/configs/bcm2711_defconfig | 1 -
+ arch/arm64/configs/bcm2712_defconfig | 1 -
+ arch/arm64/configs/bcmrpi3_defconfig | 1 -
+ 6 files changed, 6 deletions(-)
+
+diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
+index 980e70d0178fa..c8aa65e82d8bb 100644
+--- a/arch/arm/configs/bcm2709_defconfig
++++ b/arch/arm/configs/bcm2709_defconfig
+@@ -1586,7 +1586,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm/configs/bcm2711_defconfig b/arch/arm/configs/bcm2711_defconfig
+index 806c6d81590a6..2578d23b1886e 100644
+--- a/arch/arm/configs/bcm2711_defconfig
++++ b/arch/arm/configs/bcm2711_defconfig
+@@ -1613,7 +1613,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
+index fad465fe4c70e..a2519b5abb6d6 100644
+--- a/arch/arm/configs/bcmrpi_defconfig
++++ b/arch/arm/configs/bcmrpi_defconfig
+@@ -1580,7 +1580,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcm2711_defconfig b/arch/arm64/configs/bcm2711_defconfig
+index 819c442e5acfe..afbd8ef3e8d3b 100644
+--- a/arch/arm64/configs/bcm2711_defconfig
++++ b/arch/arm64/configs/bcm2711_defconfig
+@@ -1675,7 +1675,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcm2712_defconfig b/arch/arm64/configs/bcm2712_defconfig
+index 15a0aa6c77137..76effcbc199b5 100644
+--- a/arch/arm64/configs/bcm2712_defconfig
++++ b/arch/arm64/configs/bcm2712_defconfig
+@@ -1678,7 +1678,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
+diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig
+index d3d879d03ff45..6fca561ba4084 100644
+--- a/arch/arm64/configs/bcmrpi3_defconfig
++++ b/arch/arm64/configs/bcmrpi3_defconfig
+@@ -1561,7 +1561,6 @@ CONFIG_DETECT_HUNG_TASK=y
+ CONFIG_LATENCYTOP=y
+ CONFIG_FUNCTION_PROFILER=y
+ CONFIG_STACK_TRACER=y
+-CONFIG_IRQSOFF_TRACER=y
+ CONFIG_SCHED_TRACER=y
+ CONFIG_BLK_DEV_IO_TRACE=y
+ # CONFIG_UPROBE_EVENTS is not set
diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 2fa1bb54b683e..704cc1f6646ce 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -12,19 +12,21 @@
 #
 # Upstream documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html
 pkgname=rpi-kernel
-version=6.1.54
+version=6.1.69
 revision=1
-_githash=fad58933544bb2a7b7db92847c25c79a83171fa6
+_githash=aabc6f6d0b13ac177f9b383e59a542ddb6c32e59
 archs="armv6l* armv7l* aarch64*"
 hostmakedepends="perl kmod uboot-mkimage openssl-devel bc bison flex xz"
 makedepends="ncurses-devel"
 short_desc="Linux kernel for Raspberry Pi (${version%.*} series)"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="GPL-2.0-only"
 homepage="http://www.kernel.org"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
-checksum=1bd02902fae49351fb16ac0d5ccc3bf4d67aa0640006dbbf8846963519b01ab8
+checksum=31a39457e4f3075bf7a1113aae17f9a17241b425aa194639c886bc639cf1da5d
 python_version=3
+provides="rpi-kernel-${version}_${revision}"
+replaces="rpi5-kernel>=0"
 
 _kernver="${version}_${revision}"
 
@@ -51,28 +53,20 @@ case "$XBPS_TARGET_MACHINE" in
 	*) broken="No Raspberry Pi exists for this arch" ;;
 esac
 
+make_build_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+make_install_args=("-j$XBPS_MAKEJOBS" "ARCH=$_arch")
+
 if [ "$CROSS_BUILD" ]; then
-	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
-else
-	_cross=
+	make_build_args+=("CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-")
 fi
 
-do_configure() {
-	local target defconfig
-
-	case "$XBPS_TARGET_MACHINE" in
-		# for zero, 1
-		armv6l*) target=bcmrpi_defconfig ;;
-		# for 2
-		armv7l*) target=bcm2709_defconfig ;;
-		# for 3, 4, zero 2
-		aarch64*) target=bcm2711_defconfig ;;
-	esac
+_configure() {
+	local target="$1" defconfig
 
 	defconfig="arch/${_arch}/configs/${target}"
 	cp "$defconfig" .config
 
-	cat <<-! > "foo"
+	cat <<-! > void.config
 	CONFIG_CONNECTOR=y
 	CONFIG_HID_STEAM=y
 	CONFIG_PROC_EVENTS=y
@@ -113,15 +107,21 @@ do_configure() {
 	CONFIG_LZ4_COMPRESS=y
 	CONFIG_CRYPTO_RNG=y
 	CONFIG_CRYPTO_RNG_DEFAULT=y
+	CONFIG_BTRFS_FS=y
+	CONFIG_BTRFS_POSIX_ACL=y
+	CONFIG_IKCONFIG=y
+	CONFIG_IKCONFIG_PROC=y
+	CONFIG_LEDS_TRIGGER_ACTIVITY=m
 	!
 
 	while read -r line; do
+		local option="" str="" cmd=""
 		# skip comments
 		case "$line" in
 			"#"*) continue;;
 		esac
-		local option=${line%%=*} str=
-		local cmd="$(echo "$line" | cut -d= -f2)"
+		option="${line%%=*}"
+		cmd="$(echo "$line" | cut -d= -f2)"
 		case "$cmd" in
 			y) cmd="enable";;
 			n) cmd="disable";;
@@ -135,31 +135,27 @@ do_configure() {
 		./scripts/config \
 			--file .config \
 			"--$cmd" "$option" "${str//\"/}"
-	done < foo
+	done < void.config
 
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" olddefconfig
+	make "${make_build_args[@]}" olddefconfig
 }
 
-do_build() {
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" prepare
-	make "${makejobs}" "${_cross}" ARCH="${_arch}" "${_image_target}" modules dtbs
-}
-
-do_install() {
-	local hdrdest="${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}"
+_install() {
+	local _pkg="$1" _destdir="$2"
+	local hdrdest="usr/src/${_pkg}-headers-${_kernver}"
 
 	# Run depmod after compressing modules.
 	vsed -i -e '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
-	make "${makejobs}" ARCH="${_arch}" INSTALL_MOD_PATH="${DESTDIR}" modules_install
+	make "${make_install_args[@]}" INSTALL_MOD_PATH="${_destdir}" modules_install
 
 	# Install device tree blobs
-	make "${makejobs}" "ARCH=${_arch}" INSTALL_DTBS_PATH="${DESTDIR}/boot" dtbs_install
+	make "${make_install_args[@]}" INSTALL_DTBS_PATH="${_destdir}/boot" dtbs_install
 
 	# move dtbs that ended up in /boot/broadcom
-	if [ -d "${DESTDIR}/boot/broadcom" ]; then
-		mv "${DESTDIR}"/boot/broadcom/*dtb "${DESTDIR}/boot"
+	if [ -d "${_destdir}/boot/broadcom" ]; then
+		mv "${_destdir}"/boot/broadcom/*dtb "${_destdir}/boot"
 	fi
 
 	# Install kernel image
@@ -167,96 +163,118 @@ do_install() {
 
 	# Switch to /usr.
 	vmkdir usr
-	mv "${DESTDIR}/lib" "${DESTDIR}/usr"
+	mv "${_destdir}/lib" "${_destdir}/usr"
 
-	pushd "${DESTDIR}/usr/lib/modules/${_kernver}"
+	pushd "${_destdir}/usr/lib/modules/${_kernver}"
 	rm -f source build
-	ln -sf "../../../src/${sourcepkg}-headers-${_kernver}" build
+	ln -sf "../../../src/${_pkg}-headers-${_kernver}" build
 	popd
 
 	# Install required headers to build external modules
-	install -Dm644 Makefile "${hdrdest}/Makefile"
-	install -Dm644 Kbuild "${hdrdest}/Kbuild"
-	install -Dm644 kernel/Makefile "${hdrdest}/kernel/Makefile"
-	install -Dm644 .config "${hdrdest}/.config"
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname "$file")"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find . -name 'Kconfig*')
-	while read -r file; do
-		mkdir -p "${hdrdest}/$(dirname $file)"
-		install -Dm644 "$file" "${hdrdest}/${file}"
-	done < <(find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform)
-	mkdir -p "${hdrdest}/include"
+	vinstall Makefile 644 "${hdrdest}"
+	vinstall Kbuild 644 "${hdrdest}"
+	vinstall kernel/Makefile 644 "${hdrdest}/kernel"
+	vinstall .config 644 "${hdrdest}"
+	find . -name 'Kconfig*' | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	find "arch/${_arch}" scripts -name module.lds -o -name Kbuild.platforms -o -name Platform | \
+		while read -r file; do
+		vinstall "$file" 644 "${hdrdest}/$(dirname "$file")"
+	done
+	vmkdir "${hdrdest}/include"
 
 	# Remove firmware stuff provided by the "linux-firmware" pkg.
-	rm -rf "${DESTDIR}/usr/lib/firmware"
+	rm -rf "${_destdir}/usr/lib/firmware"
 
-	for i in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
+	for d in acpi asm-generic clocksource config crypto drm dt-bindings generated linux \
 		math-emu media net pcmcia scsi sound trace uapi vdso video xen; do
-		[ -d include/$i ] && cp -a "include/$i" "${hdrdest}/include"
+		[ -d include/$d ] && vcopy "include/$d" "${hdrdest}/include"
 	done
 
 	# Remove helper binaries built for host,
 	# if generated files from the scripts/ directory need to be included,
 	# they need to be copied to ${hdrdest} before this step
 	if [ "$CROSS_BUILD" ]; then
-		make "${makejobs}" ARCH="${_arch}" _mrproper_scripts
+		make "${make_install_args[@]}" _mrproper_scripts
 		# remove host specific objects as well
 		find scripts -name '*.o' -delete
 	fi
 
 	# Copy files necessary for later builds.
-	cp Module.symvers "${hdrdest}"
-	cp -a scripts "${hdrdest}"
-	mkdir -p "${hdrdest}/security/selinux"
-	cp -a security/selinux/include "${hdrdest}/security/selinux"
-	mkdir -p "${hdrdest}/tools/include"
-	cp -a tools/include/tools "${hdrdest}/tools/include"
+	vinstall Module.symvers 644 "${hdrdest}"
+	vcopy scripts "${hdrdest}"
+	vmkdir "${hdrdest}/security/selinux"
+	vcopy security/selinux/include "${hdrdest}/security/selinux"
+	vmkdir "${hdrdest}/tools/include"
+	vcopy tools/include/tools "${hdrdest}/tools/include"
 	if [ -d "arch/${_arch}/tools" ]; then
-		cp -a "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
+		vcopy "arch/${_arch}/tools" "${hdrdest}/arch/${_arch}"
 	fi
-	cp -a kernel/time/timeconst.bc "${hdrdest}/kernel/time"
-	cp -a kernel/bounds.c "${hdrdest}/kernel"
-	mkdir -p "${hdrdest}/arch/x86/entry/syscalls"
-	cp -a arch/x86/entry/syscalls/syscall_32.tbl "${hdrdest}/arch/x86/entry/syscalls"
+	vinstall kernel/time/timeconst.bc 644 "${hdrdest}/kernel/time"
+	vinstall kernel/bounds.c 644 "${hdrdest}/kernel"
+	vinstall arch/x86/entry/syscalls/syscall_32.tbl 644 "${hdrdest}/arch/x86/entry/syscalls"
 
 	# copy arch includes for external modules
-	mkdir -p "${hdrdest}/arch/${_arch}"
-	cp -a "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
+	vmkdir "${hdrdest}/arch/${_arch}"
+	vcopy "arch/${_arch}/include" "${hdrdest}/arch/${_arch}"
 
 	mkdir -p "${hdrdest}/arch/${_arch}/kernel"
-	cp "arch/${_arch}/Makefile" "${hdrdest}/arch/${_arch}"
-	cp "arch/${_arch}/kernel/asm-offsets.s" "${hdrdest}/arch/${_arch}/kernel"
+	vinstall "arch/${_arch}/Makefile" 644 "${hdrdest}/arch/${_arch}"
+	vinstall "arch/${_arch}/kernel/asm-offsets.s" 644 "${hdrdest}/arch/${_arch}/kernel"
 	if [ "$_arch" = "arm64" ] ; then
-		cp -a "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
+		vcopy "arch/${_arch}/kernel/vdso" "${hdrdest}/arch/${_arch}/kernel/"
 	fi
 
 	# Add md headers
-	mkdir -p "${hdrdest}/drivers/md"
-	cp drivers/md/*.h "${hdrdest}/drivers/md"
+	vmkdir "${hdrdest}/drivers/md"
+	vcopy drivers/md/*.h "${hdrdest}/drivers/md"
 
 	# Add inotify.h
-	mkdir -p "${hdrdest}/include/linux"
-	cp include/linux/inotify.h "${hdrdest}/include/linux"
+	vinstall include/linux/inotify.h 644 "${hdrdest}/include/linux"
 
 	# Add wireless headers
-	mkdir -p "${hdrdest}/net/mac80211/"
-	cp net/mac80211/*.h "${hdrdest}/net/mac80211"
+	vmkdir "${hdrdest}/net/mac80211/"
+	vcopy net/mac80211/*.h "${hdrdest}/net/mac80211"
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
-	find "${DESTDIR}" -name '*.ko' | xargs -n1 -P0 gzip -9
+	msg_normal "$_pkg-$version: compressing kernel modules with gzip, please wait...\n"
+	find "${_destdir}" -name '*.ko' | xargs -n1 -P0 gzip -9
 
 	# ... and run depmod again.
-	depmod -b "${DESTDIR}/usr" -F System.map "${_kernver}"
+	depmod -b "${_destdir}/usr" -F System.map "${_kernver}"
+}
+
+do_configure() {
+	local target
+
+	case "$XBPS_TARGET_MACHINE" in
+		# for zero, 1
+		armv6l*) target=bcmrpi_defconfig ;;
+		# for 2
+		armv7l*) target=bcm2709_defconfig ;;
+		# for 3, 4, zero 2, 5
+		aarch64*) target=bcm2711_defconfig ;;
+	esac
+
+	_configure "$target"
+}
+
+do_build() {
+	make "${make_build_args[@]}" prepare
+	make "${make_build_args[@]}" "${_image_target}" modules dtbs
+}
+
+do_install() {
+	_install "$pkgname" "$DESTDIR"
 }
 
 subpackages="rpi-kernel-headers"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv7l*) subpackages+=" rpi2-kernel rpi2-kernel-headers" ;;
-	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers" ;;
+	aarch64*) subpackages+=" rpi3-kernel rpi3-kernel-headers rpi4-kernel rpi4-kernel-headers rpi5-kernel rpi5-kernel-headers" ;;
 esac
 
 rpi-kernel-headers_package() {
@@ -264,9 +282,54 @@ rpi-kernel-headers_package() {
 	noverifyrdeps=yes
 	noshlibprovides=yes
 	short_desc="${short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi5-kernel-headers>=0"
 	pkg_install() {
 		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		vmove "usr/lib/modules/${_kernver}/build"
+	}
+}
+
+_rpi5_short_desc="Linux kernel for Raspberry Pi 5 (${version%.*} series)"
+
+rpi5-kernel_package() {
+	nodebug=yes
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	python_version=3
+	triggers="kernel-hooks"
+	# These files could be modified when an external module is built.
+	mutable_files="
+	 /usr/lib/modules/${_kernver}/modules.dep
+	 /usr/lib/modules/${_kernver}/modules.dep.bin
+	 /usr/lib/modules/${_kernver}/modules.symbols
+	 /usr/lib/modules/${_kernver}/modules.symbols.bin
+	 /usr/lib/modules/${_kernver}/modules.alias
+	 /usr/lib/modules/${_kernver}/modules.alias.bin
+	 /usr/lib/modules/${_kernver}/modules.devname"
+	short_desc="$_rpi5_short_desc"
+	provides="rpi-kernel-${version}_${revision}"
+	replaces="rpi-kernel>=0"
+	pkg_install() {
+		_configure "bcm2712_defconfig"
+		make "${make_build_args[@]}" prepare
+		make "${make_build_args[@]}" "${_image_target}" modules dtbs
+		_install "rpi5-kernel" "$PKGDESTDIR"
+	}
+}
+
+rpi5-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="${_rpi5_short_desc/kernel/kernel headers}"
+	provides="rpi-kernel-headers-${version}_${revision}"
+	replaces="rpi-kernel-headers>=0"
+	pkg_install() {
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/src" "${PKGDESTDIR}"/usr/src
+		vmkdir "usr/lib/modules/${_kernver}"
+		mv "${PKGDESTDIR}/../rpi5-kernel-${version}/usr/lib/modules/${_kernver}/build" "${PKGDESTDIR}/usr/lib/modules/${_kernver}/build"
 	}
 }
 
diff --git a/srcpkgs/rpi-kernel/update b/srcpkgs/rpi-kernel/update
new file mode 100644
index 0000000000000..60c7b646ca64e
--- /dev/null
+++ b/srcpkgs/rpi-kernel/update
@@ -0,0 +1,2 @@
+site="https://github.com/raspberrypi/linux/commits/rpi-6.1.y/"
+pattern=">Linux \K[\d.]+(?=</a>)"
diff --git a/srcpkgs/rpi5-kernel b/srcpkgs/rpi5-kernel
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi5-kernel-headers b/srcpkgs/rpi5-kernel-headers
new file mode 120000
index 0000000000000..3b4ec073331b8
--- /dev/null
+++ b/srcpkgs/rpi5-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

From c13e5ce5b87a07b1325dbcadbd301ad57074d611 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:05 -0500
Subject: [PATCH 02/11] rpi-firmware: update to 20231221, adopt.

add rpi5-specific firmware
---
 srcpkgs/rpi-firmware/template | 48 +++++++++++++----------------------
 1 file changed, 17 insertions(+), 31 deletions(-)

diff --git a/srcpkgs/rpi-firmware/template b/srcpkgs/rpi-firmware/template
index 0a2efa3b80db0..3f38c0f6f68d1 100644
--- a/srcpkgs/rpi-firmware/template
+++ b/srcpkgs/rpi-firmware/template
@@ -1,45 +1,29 @@
 # Template file for 'rpi-firmware'
 pkgname=rpi-firmware
-version=20230925
+version=20231221
 revision=1
-_rpi_fw=6b37a457122714aa14b2c7df0926455173fd04f1
-_rpi_bt=9556b08ace2a1735127894642cc8ea6529c04c90
-_rpi_brcm=2c3a8701193ba23d0ef85cdf0d0c9e47baf03dfc
+_rpi_fw=0da53ed7928f20b5f4e9e36a3a63fb80b700d908
+_rpi_brcm=88aa085bfa1a4650e1ccd88896f8343c22a24055
+_rpi_bt=d9d4741caba7314d6500f588b1eaa5ab387a4ff5
 create_wrksrc=yes
-archs="armv6l* armv7l* aarch64*"
+archs="aarch64* armv6l* armv7l*"
 short_desc="Firmware files for the Raspberry Pi"
-maintainer="Piraty <mail@piraty.dev>"
+maintainer="classabbyamp <void@placeviolette.net>"
 license="BSD-3-Clause, custom:Cypress"
 homepage="https://github.com/raspberrypi/firmware"
 distfiles="
  https://github.com/raspberrypi/firmware/archive/${_rpi_fw}.tar.gz
  https://github.com/RPi-Distro/firmware-nonfree/archive/${_rpi_brcm}.tar.gz
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430A1.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM43430B0.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/broadcom/BCM4345C5.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430A1.hcd>BCM43430A1.raspberrypi,model-zero-2-w.hcd
- https://github.com/RPi-Distro/bluez-firmware/raw/${_rpi_bt}/synaptics/SYN43430B0.hcd>BCM43430B0.raspberrypi,model-zero-2-w.hcd
+ https://github.com/RPi-Distro/bluez-firmware/archive/${_rpi_bt}.tar.gz
  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/LICENCE.cypress>LICENCE.cypress"
-checksum="913986b1be22b8dc30a3e6a9b5a28316b1bbee7bec90040ddefff0d7512560f4
- 9156d90116b921d2e7938b52fad84fbe1d96df622a66c5db09569c735832387a
- c096ad4a5c3f06ed7d69eba246bf89ada9acba64a5b6f51b1e9c12f99bb1e1a7
- 51c45e77ddad91a19e96dc8fb75295b2087c279940df2634b23baf71b6dea42c
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
- fb9f4ec2df5301bd35f416384e103c012c5983024c49aa72fbbaf90177512caa
- 55071227c94d86369d04f9aff3bbfd4197a78a53dc350295123e1a8b048bba8f
- 338c2c6631131f516bfc7e64ef0872bd0402e1f98ef9d0c900eef0c814d90a25
+checksum="c9288ecc2d314f12517b05378634d4fd73408245100e0cfae4c11ccaa84fcadd
+ bb3d8fed40546e03e29d9e635745433f8083391e62d6ff151c895b892776964a
+ ae076a08ece89624b0449ea2495b0dfe2ea1223f683f5b57f2b89966e6a093d6
  ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f"
-
-skip_extraction="BCM43430A1.hcd BCM4345C0.hcd BCM43430B0.hcd BCM4345C5.hcd
- BCM43430A1.raspberrypi,model-zero-2-w.hcd BCM43430B0.raspberrypi,model-zero-2-w.hcd
- LICENCE.cypress"
-
-provides="linux-firmware-broadcom-${version}_${revision}"
-replaces="linux-firmware-broadcom>=0"
-
+skip_extraction="LICENCE.cypress"
 conf_files="/boot/cmdline.txt /boot/config.txt"
 nostrip=yes
+replaces="rpi-firmware-network>=0"
 
 do_install() {
 	# bootloader
@@ -72,7 +56,9 @@ do_install() {
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43456"* usr/lib/firmware/brcm
 	vcopy "firmware-nonfree-${_rpi_brcm}/debian/config/brcm80211/brcm/brcmfmac43436"* usr/lib/firmware/brcm
 
-	for file in "${XBPS_SRCDISTDIR}/${pkgname}-${version}/"*.hcd; do
-		vinstall "$file" 0644 usr/lib/firmware/brcm
-	done
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/broadcom/"*.hcd usr/lib/firmware/brcm
+
+	vmkdir usr/lib/firmware/synaptics
+	vcopy "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/"*.hcd usr/lib/firmware/synaptics
+	vlicense "bluez-firmware-${_rpi_bt}/debian/firmware/synaptics/LICENSE.synaptics"
 }

From 607a956670922a7bb8894b7cd615c9a1d8712460 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:50:48 -0500
Subject: [PATCH 03/11] New package: rpi-utils-20231221

replaces rpi-userland:
https://github.com/raspberrypi/userland/blob/master/README.md
---
 .../rpi-utils/patches/no-overlaycheck.patch   | 14 +++++++++++++
 srcpkgs/rpi-utils/template                    | 20 +++++++++++++++++++
 srcpkgs/rpi-utils/update                      |  1 +
 3 files changed, 35 insertions(+)
 create mode 100644 srcpkgs/rpi-utils/patches/no-overlaycheck.patch
 create mode 100644 srcpkgs/rpi-utils/template
 create mode 100644 srcpkgs/rpi-utils/update

diff --git a/srcpkgs/rpi-utils/patches/no-overlaycheck.patch b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
new file mode 100644
index 0000000000000..3e64958e238d2
--- /dev/null
+++ b/srcpkgs/rpi-utils/patches/no-overlaycheck.patch
@@ -0,0 +1,14 @@
+This program is not very useful as a downstream, it seems to be only intended
+for internal QA. It also has a lot of weird things like hardcoding the prefixed
+cpp to use and putting a text file in /usr/bin.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,6 @@
+ # List of subsidiary CMakeLists
+ add_subdirectory(dtmerge)
+ add_subdirectory(otpset)
+-add_subdirectory(overlaycheck)
+ add_subdirectory(ovmerge)
+ add_subdirectory(pinctrl)
+ add_subdirectory(raspinfo)
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
new file mode 100644
index 0000000000000..4ba633ed47ab6
--- /dev/null
+++ b/srcpkgs/rpi-utils/template
@@ -0,0 +1,20 @@
+# Template file for 'rpi-utils'
+pkgname=rpi-utils
+version=20231221
+revision=1
+_commit=2cc103f4531a005cadaa8a9d09d6c85523c166bb
+archs="armv6l* armv7l* aarch64*"
+build_style=cmake
+makedepends="dtc-devel"
+depends="python3 perl bash"
+short_desc="Collection of utilities for Raspberry Pi"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="BSD-3-Clause"
+homepage="https://github.com/raspberrypi/utils"
+distfiles="https://github.com/raspberrypi/utils/archive/${_commit}.tar.gz"
+checksum=32e128d437052c66c744f24d75b0835a80a98627e33c48a37172a457024d9275
+python_version=3
+
+post_install() {
+	vlicense LICENCE
+}
diff --git a/srcpkgs/rpi-utils/update b/srcpkgs/rpi-utils/update
new file mode 100644
index 0000000000000..0d9505a5537ba
--- /dev/null
+++ b/srcpkgs/rpi-utils/update
@@ -0,0 +1 @@
+disabled="just following master"

From fdf66f329ee4d6d0ebcd9bce94b56e95bf134c67 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 13:51:52 -0500
Subject: [PATCH 04/11] rpi-eeprom: update to 2023.12.14.

- install manpages (like is done in the debian rules)
- adds rpi5 firmware
---
 srcpkgs/rpi-eeprom/template | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/rpi-eeprom/template b/srcpkgs/rpi-eeprom/template
index fb017a50966cd..38fba116a9486 100644
--- a/srcpkgs/rpi-eeprom/template
+++ b/srcpkgs/rpi-eeprom/template
@@ -1,17 +1,18 @@
 # Template file for 'rpi-eeprom'
 pkgname=rpi-eeprom
-version=2023.09.29
+version=2023.12.14
 revision=1
-_githash="4f2d676b4e2a9c2d9ee1ab42015ce711fde97afa"
-archs="armv7* aarch64*"
+_githash=72cedfe5eea64bb8509b7d0fec68f5df5dd22f9e
+archs="armv7l* aarch64*"
 conf_files="/etc/default/rpi-eeprom-update"
-depends="binutils pciutils python3 rpi-firmware rpi-userland"
-short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4"
+hostmakedepends="help2man python3"
+depends="binutils pciutils python3 rpi-firmware rpi-utils"
+short_desc="Bootloader and VL805 USB controller EEPROM update tool for RPi4/5"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="BSD-3-Clause, custom:Proprietary"
 homepage="https://github.com/raspberrypi/rpi-eeprom/"
 distfiles="https://github.com/raspberrypi/rpi-eeprom/archive/${_githash}.tar.gz"
-checksum="189c5d37f3102247cec72619e3cb357d027ec526fa3c7373d3107bd6c9e30e29"
+checksum=542365a644b3d8e987bda8e0a7dc9d4c9c234ab97b11fa902798a21a08743c30
 python_version=3
 repository=nonfree
 
@@ -21,9 +22,21 @@ do_install() {
 	vbin rpi-eeprom-digest
 	vinstall rpi-eeprom-update-default 644 etc/default rpi-eeprom-update
 
-	vmkdir usr/lib/firmware/raspberrypi/bootloader
-	# need to figure out how to package both pi4 (2711) and pi5 (2712) fw
-	vcopy firmware-2711/* usr/lib/firmware/raspberrypi/bootloader/
+	# from https://github.com/raspberrypi/rpi-eeprom/blob/debian/bookworm/debian/rules
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Checks whether the Raspberry Pi bootloader EEPROM is up-to-date and updates the EEPROM" \
+		--output=rpi-eeprom-update.1 ./rpi-eeprom-update
+	vman rpi-eeprom-update.1
+
+	help2man -N --version-string="${version}" --help-option="-h" \
+		--name="Bootloader EEPROM configuration tool for the Raspberry Pi 4/5" \
+		--output=rpi-eeprom-config.1 ./rpi-eeprom-config
+	vman rpi-eeprom-config.1
+
+	for soc in 2711 2712; do
+		vmkdir usr/lib/firmware/raspberrypi/bootloader-"$soc"
+		vcopy firmware-"$soc"/* usr/lib/firmware/raspberrypi/bootloader-"$soc"/
+	done
 
 	vlicense LICENSE
 }

From 983cb1c0ca3fcd9d0bf911c13e12a42b4977558c Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 23 Dec 2023 16:36:25 -0500
Subject: [PATCH 05/11] linux-firmware: remove conflict between -broadcom and
 rpi-firmware

these files differ between linux-firmware-broadcom and rpi-firmware, but
they should only ever be necessary for raspberry pi users, and the
rpi-firmware version is probably the one that is more likely to work and
work better.
---
 srcpkgs/linux-firmware/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/linux-firmware/template b/srcpkgs/linux-firmware/template
index 786d6d5566d38..e84008531b2f6 100644
--- a/srcpkgs/linux-firmware/template
+++ b/srcpkgs/linux-firmware/template
@@ -1,7 +1,7 @@
 # Template file for 'linux-firmware'
 pkgname=linux-firmware
 version=20231211
-revision=1
+revision=2
 hostmakedepends="rdfind which"
 depends="linux-firmware-amd>=${version}_${revision} linux-firmware-network>=${version}_${revision}"
 short_desc="Binary firmware blobs for the Linux kernel"
@@ -43,13 +43,14 @@ linux-firmware-amd_package() {
 linux-firmware-broadcom_package() {
 	short_desc+=" - Broadcom network blobs"
 	nostrip=yes
-	replaces="rpi-firmware-network>=0"
 	pkg_install() {
 		vmove usr/lib/firmware/brcm
 		vmove usr/share/licenses/linux-firmware/LICENCE.broadcom_bcm43xx
 		# firmware/brcm contains multiple symlinks to ../cypress/
 		vmove usr/lib/firmware/cypress
 		vmove usr/share/licenses/linux-firmware/LICENCE.cypress
+		# provided by rpi-firmware
+		find "${PKGDESTDIR}"/usr/lib/firmware/brcm -iname '*raspberry*.txt' -delete
 	}
 }
 

From c4da52f966b08c5fb9add154d0b093a79fe6c123 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 14:02:33 -0500
Subject: [PATCH 06/11] rpi-userland: remove package

the utilities are now part of rpi-utils, and the libraries should be
provided by standard system libraries now
---
 common/shlibs                     | 19 --------
 srcpkgs/removed-packages/template |  5 ++-
 srcpkgs/rpi-userland              |  1 +
 srcpkgs/rpi-userland-devel        |  1 -
 srcpkgs/rpi-userland/template     | 75 -------------------------------
 srcpkgs/rpi-utils/template        |  6 +++
 6 files changed, 10 insertions(+), 97 deletions(-)
 create mode 120000 srcpkgs/rpi-userland
 delete mode 120000 srcpkgs/rpi-userland-devel
 delete mode 100644 srcpkgs/rpi-userland/template

diff --git a/common/shlibs b/common/shlibs
index dcdcacac70bc4..1c4288e0c88d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -132,9 +132,6 @@ libGL.so.1 libGL-7.11_1
 libEGL.so.1 libEGL-7.11_1
 libGLESv1_CM.so.1 libGLES-1.0_1
 libGLESv2.so.2 libGLES-1.0_1
-libbrcmEGL.so rpi-userland-20180103_2
-libbrcmGLESv2.so rpi-userland-20180103_2
-libbrcmOpenVG.so rpi-userland-20180103_2
 libnvidia-ml.so.1 nvidia-libs-346.47_1 ignore
 libnvidia-ml.so.1 nvidia390-libs-390.87_1 ignore
 libnvidia-ml.so.1 nvidia470-libs-470.103.01_1 ignore
@@ -1220,22 +1217,6 @@ libtaginfo.so.1 libtaginfo-0.1.3_1
 libtaginfo_c.so.0 libtaginfo-0.1.3_1
 libaa.so.1 aalib-1.4rc4_2
 libbsd.so.0 libbsd-0.4.2_1
-libWFC.so rpi-userland-0.0.0.0.20150907_1
-libbcm_host.so rpi-userland-0.0.0.0.20150907_1
-libopenmaxil.so rpi-userland-0.0.0.0.20150907_1
-libvchiq_arm.so rpi-userland-0.0.0.0.20150907_1
-libvcos.so rpi-userland-0.0.0.0.20150907_1
-libmmal.so rpi-userland-0.0.0.0.20150907_1
-libmmal_core.so rpi-userland-0.0.0.0.20150907_1
-libmmal_util.so rpi-userland-0.0.0.0.20150907_1
-libOpenVG.so rpi-userland-0.0.0.0.20150907_1
-libmmal_vc_client.so rpi-userland-20170427_1
-libmmal_components.so rpi-userland-20170427_1
-libvcsm.so rpi-userland-20170427_1
-libcontainers.so rpi-userland-20170427_1
-libbrcmWFC.so rpi-userland-20180103_1
-libdebug_sym.so rpi-userland-20180103_1
-libdtovl.so rpi-userland-20180103_1
 libwiringPi.so libwiringPi-0.0.20200408_1
 libwiringPiDev.so libwiringPi-0.0.20200408_1
 liblockdev.so.1 lockdev-1.0.3_1
diff --git a/srcpkgs/removed-packages/template b/srcpkgs/removed-packages/template
index fd9d350d4ad4f..94feb99c0a862 100644
--- a/srcpkgs/removed-packages/template
+++ b/srcpkgs/removed-packages/template
@@ -1,6 +1,6 @@
 # Template file for 'removed-packages'
 pkgname=removed-packages
-version=0.1.20231114
+version=0.1.20240105
 revision=1
 build_style=meta
 short_desc="Uninstalls packages removed from repository"
@@ -345,8 +345,8 @@ replaces="
  libllvm8<=8.0.1_5
  libllvm9<=9.0.1_8
  liblrzip<=0.641_1
- liblvm2app<=2.02.187
  liblvm2app-devel<=2.02.187
+ liblvm2app<=2.02.187
  libmagick6-devel<=6.9.12.12_2
  libmagick6-perl<=6.9.12.12_2
  libmagick6<=6.9.12.12_2
@@ -651,6 +651,7 @@ replaces="
  rkt-stage1-coreos<=1.30.0_3
  rkt-stage1-fly<=1.30.0_3
  rkt<=1.30.0_3
+ rpi-userland-devel<=20230920_1
  rundird<=0.2.0_1
  scantailor<=0.9.12.1_2
  seahorse-sharing<=3.8.0_4
diff --git a/srcpkgs/rpi-userland b/srcpkgs/rpi-userland
new file mode 120000
index 0000000000000..54ed05c7378b8
--- /dev/null
+++ b/srcpkgs/rpi-userland
@@ -0,0 +1 @@
+rpi-utils
\ No newline at end of file
diff --git a/srcpkgs/rpi-userland-devel b/srcpkgs/rpi-userland-devel
deleted file mode 120000
index 8a52372b89695..0000000000000
--- a/srcpkgs/rpi-userland-devel
+++ /dev/null
@@ -1 +0,0 @@
-rpi-userland
\ No newline at end of file
diff --git a/srcpkgs/rpi-userland/template b/srcpkgs/rpi-userland/template
deleted file mode 100644
index 25fc587bfb55d..0000000000000
--- a/srcpkgs/rpi-userland/template
+++ /dev/null
@@ -1,75 +0,0 @@
-# Template file for 'rpi-userland'
-pkgname=rpi-userland
-version=20230920
-revision=1
-_githash="44a3953fd13d5f0b9b0cd120b904aa7db370244e"
-build_style=cmake
-configure_args="-DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib"
-hostmakedepends="pkg-config"
-short_desc="Raspberry Pi GPU userland libraries and utilities"
-maintainer="Orphaned <orphan@voidlinux.org>"
-license="BSD-3-Clause"
-homepage="https://github.com/raspberrypi/userland"
-distfiles="https://github.com/raspberrypi/userland/archive/${_githash}.tar.gz"
-checksum=981c376a110f78fe579a72e218888646ccd5d71ab82d04bb1a8d7be1487b45f0
-
-LDFLAGS="-Wl,--no-as-needed"
-archs="armv6l* armv7l* aarch64*"
-
-shlib_provides="
- libEGL.so
- libGLESv2.so
- libOpenVG.so
- libWFC.so
- libbcm_host.so
- libbrcmEGL.so
- libbrcmGLESv2.so
- libbrcmOpenVG.so
- libbrcmWFC.so
- libcontainers.so
- libdebug_sym.so
- libdtovl.so
- libmmal.so
- libmmal_components.so
- libmmal_core.so
- libmmal_util.so
- libmmal_vc_client.so
- libopenmaxil.so
- libvchiq_arm.so
- libvcos.so
- libvcsm.so"
-
-case "$XBPS_TARGET_MACHINE" in
-aarch64*) configure_args+=" -DARM64=on" ;;
-esac
-
-pre_configure() {
-	for f in $(find ${wrksrc} -type f -name CMakeLists.txt); do
-		sed -i 's,-Werror,,g' $f
-	done
-}
-post_install() {
-	vlicense LICENCE
-	rm -rf ${DESTDIR}/etc
-	rm -rf ${DESTDIR}/opt/vc/share
-
-	vmkdir usr/share
-	mv ${DESTDIR}/opt/vc/man ${DESTDIR}/usr/share
-
-	vmkdir usr/bin
-	ln -sfr ${DESTDIR}/opt/vc/bin/tvservice ${DESTDIR}/usr/bin
-	ln -sfr ${DESTDIR}/opt/vc/bin/vcgencmd ${DESTDIR}/usr/bin
-}
-
-rpi-userland-devel_package() {
-	provides="rpi-firmware-pcfiles-1_1"
-	replaces="rpi-firmware-pcfiles>=0"
-	depends="${sourcepkg}>=${version}_${revision}"
-	short_desc+=" - development files"
-	pkg_install() {
-		vmove opt/vc/include
-		vmove opt/vc/src
-		vmove opt/vc/lib/*.a
-		vmove opt/vc/lib/pkgconfig
-	}
-}
diff --git a/srcpkgs/rpi-utils/template b/srcpkgs/rpi-utils/template
index 4ba633ed47ab6..841ab7b203fbf 100644
--- a/srcpkgs/rpi-utils/template
+++ b/srcpkgs/rpi-utils/template
@@ -18,3 +18,9 @@ python_version=3
 post_install() {
 	vlicense LICENCE
 }
+
+rpi-userland_package() {
+	build_style=meta
+	short_desc="RPi userland utilities (transitional dummy package)"
+	depends="${sourcepkg}>=${version}_${revision}"
+}

From 27e7564704f2612f75b325f99d2c21de523d49a3 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 14:20:43 -0500
Subject: [PATCH 07/11] SDL2: remove rpi build option

unnecessary now that rpi can use system libraries for GLES
---
 srcpkgs/SDL2/template | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/srcpkgs/SDL2/template b/srcpkgs/SDL2/template
index c7975722a06da..175044b3ad83b 100644
--- a/srcpkgs/SDL2/template
+++ b/srcpkgs/SDL2/template
@@ -1,7 +1,7 @@
 # Template file for 'SDL2'
 pkgname=SDL2
 version=2.28.5
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSDL_ALSA=ON -DSDL_ESD=OFF -DSDL_RPATH=OFF
  -DSDL_CLOCK_GETTIME=ON -DSDL_PULSEAUDIO_SHARED=OFF
@@ -21,12 +21,6 @@ checksum=332cb37d0be20cb9541739c61f79bae5a477427d79ae85e352089afdaf6666e4
 build_options="gles opengl pulseaudio pipewire sndio vulkan wayland x11"
 build_options_default="gles opengl pulseaudio sndio vulkan wayland x11"
 
-case "$XBPS_TARGET_MACHINE" in
-	arm*)
-		build_options+=" rpi"
-		;;
-esac
-
 case "$XBPS_TARGET_MACHINE" in
 	ppcle*) ;;
 	*) build_options_default+=" pipewire";;
@@ -51,14 +45,6 @@ else
 	configure_args+=" -DSDL_OPENGLES=OFF"
 fi
 
-if [ "$build_option_rpi" ]; then
-	# RaspberryPi, use Videocore IV
-	configure_args+=" -DSDL_OPENGLES=ON"
-	makedepends+=" rpi-userland-devel"
-	CFLAGS="-I${XBPS_CROSS_BASE}/opt/vc/include -I${XBPS_CROSS_BASE}/opt/vc/include/interface/vcos/pthreads"
-	LDFLAGS="-L${XBPS_CROSS_BASE}/opt/vc/lib -Wl,-rpath=/opt/vc/lib"
-fi
-
 if [ "$build_option_opengl" ]; then
 	# libGL.so.1 is dynamically loaded with dlopen.
 	shlib_requires+=" libGL.so.1"

From 29ca5ff9b9f0ceca251c5e800073e07355d72d55 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 14:20:44 -0500
Subject: [PATCH 08/11] libcec: remove rpi build option

unnecessary now that rpi can use system libraries
---
 srcpkgs/libcec/template | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/srcpkgs/libcec/template b/srcpkgs/libcec/template
index 60f19a27b24ce..b31bc3c3b2cf6 100644
--- a/srcpkgs/libcec/template
+++ b/srcpkgs/libcec/template
@@ -14,21 +14,6 @@ homepage="https://github.com/Pulse-Eight/libcec"
 distfiles="https://github.com/Pulse-Eight/libcec/archive/libcec-${version}.tar.gz"
 checksum=090696d7a4fb772d7acebbb06f91ab92e025531c7c91824046b9e4e71ecb3377
 
-build_options="rpi"
-
-if [ "$build_option_rpi" ]; then
-	configure_args+=" -DRPI_INCLUDE_DIR=${XBPS_CROSS_BASE}/opt/vc/include"
-	configure_args+=" -DRPI_LIB_DIR=${XBPS_CROSS_BASE}/opt/vc/lib"
-	makedepends+=" rpi-userland-devel"
-	LDFLAGS="-Wl,-rpath=/opt/vc/lib"
-fi
-
-post_install() {
-	vmkdir usr/lib
-	mv "$DESTDIR"/$wrksrc/build/lib*/* "$DESTDIR"/usr/lib
-	vsed -i "s#$wrksrc/build/##" "$DESTDIR"/usr/lib/pkgconfig/libcec.pc
-}
-
 cec-client_package() {
 	depends="libcec>=${version}"
 	short_desc+=" - client tool"

From faead346e0735b2aebdf083d07648e43124f512a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 14:20:45 -0500
Subject: [PATCH 09/11] smpeg2: remove rpi build option

unnecessary now that rpi can use system libraries for GLES
---
 srcpkgs/smpeg2/template | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/srcpkgs/smpeg2/template b/srcpkgs/smpeg2/template
index 5c87e4416daea..e7e0f6f74d44c 100644
--- a/srcpkgs/smpeg2/template
+++ b/srcpkgs/smpeg2/template
@@ -1,7 +1,7 @@
 # Template file for 'smpeg2'
 pkgname=smpeg2
 version=2.0.0
-revision=5
+revision=6
 build_style=gnu-configure
 makedepends="SDL2-devel"
 short_desc="SDL2 MPEG Player Library"
@@ -11,21 +11,6 @@ homepage="https://icculus.org/smpeg/"
 distfiles="https://www.libsdl.org/projects/smpeg/release/smpeg2-${version}.tar.gz"
 checksum=979a65b211744a44fa641a9b6e4d64e64a12ff703ae776bafe3c4c4cd85494b3
 
-# Package build options
-build_options="rpi"
-
-case "$XBPS_TARGET_MACHINE" in
-	# Enable OpenGL/ES on rpi platforms
-	armv[67]*) build_options_default="rpi" ;;
-esac
-
-
-if [ "$build_option_rpi" ]; then
-	# Use Videocore IV on Raspberry Pi
-	makedepends+=" rpi-userland-devel"
-	LDFLAGS="-L${XBPS_CROSS_BASE}/opt/vc/lib -Wl,-rpath=/opt/vc/lib -lbcm_host"
-fi
-
 smpeg2-devel_package() {
 	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
 	short_desc+=" - development files"

From f9b4282087b96c6bb8aaaf6440c11b93b0f7d932 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 14:20:45 -0500
Subject: [PATCH 10/11] omxplayer: remove package

deprecated by upstream in favour of improving vlc
---
 srcpkgs/omxplayer                       |  1 +
 srcpkgs/omxplayer/patches/build.patch   | 53 -------------------------
 srcpkgs/omxplayer/patches/no-curl.patch | 10 -----
 srcpkgs/omxplayer/template              | 28 -------------
 srcpkgs/vlc/template                    | 18 +++++++--
 5 files changed, 16 insertions(+), 94 deletions(-)
 create mode 120000 srcpkgs/omxplayer
 delete mode 100644 srcpkgs/omxplayer/patches/build.patch
 delete mode 100644 srcpkgs/omxplayer/patches/no-curl.patch
 delete mode 100644 srcpkgs/omxplayer/template

diff --git a/srcpkgs/omxplayer b/srcpkgs/omxplayer
new file mode 120000
index 0000000000000..af7836d99cd4e
--- /dev/null
+++ b/srcpkgs/omxplayer
@@ -0,0 +1 @@
+vlc
\ No newline at end of file
diff --git a/srcpkgs/omxplayer/patches/build.patch b/srcpkgs/omxplayer/patches/build.patch
deleted file mode 100644
index 01c58e786ca61..0000000000000
--- a/srcpkgs/omxplayer/patches/build.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-diff --git Makefile Makefile
-index 5f4e414..c5b33f5 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,10 +1,10 @@
--CFLAGS=-pipe -mfloat-abi=hard -mcpu=arm1176jzf-s -fomit-frame-pointer -mabi=aapcs-linux -mtune=arm1176jzf-s -mfpu=vfp -Wno-psabi -mno-apcs-stack-check -g -mstructure-size-boundary=32 -mno-sched-prolog
-+CFLAGS=-fomit-frame-pointer -mtune=arm1176jzf-s
- CFLAGS+=-std=c++0x -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DTARGET_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG  -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST
- 
--LDFLAGS=-L$(SDKSTAGE)/opt/vc/lib/
--LDFLAGS+=-L./ -Lffmpeg_compiled/usr/local/lib/ -lc -lbrcmGLESv2 -lbrcmEGL -lbcm_host -lopenmaxil -lfreetype -lz -lasound
-+LDFLAGS=-L$(XBPS_CROSS_BASE)/opt/vc/lib/ -Wl,-R/opt/vc/lib
-+LDFLAGS+=-lc -lbrcmGLESv2 -lbrcmEGL -lbcm_host -lopenmaxil -lfreetype -lz -lasound
- 
--INCLUDES+=-I./ -Ilinux -Iffmpeg_compiled/usr/local/include/ -I /usr/include/dbus-1.0 -I /usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/usr/include/freetype2 -isystem$(SDKSTAGE)/opt/vc/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads
-+INCLUDES+=-I./ -Ilinux -I$(XBPS_CROSS_BASE)/usr/include/dbus-1.0 -I $(XBPS_CROSS_BASE)/usr/lib/dbus-1.0/include -I$(XBPS_CROSS_BASE)/usr/include/freetype2 -I$(XBPS_CROSS_BASE)/opt/vc/include -I$(XBPS_CROSS_BASE)/opt/vc/include/interface/vcos/pthreads
- 
- DIST ?= omxplayer-dist
- STRIP ?= strip
-@@ -41,7 +41,7 @@ SRC=		linux/XMemUtils.cpp \
- 
- OBJS+=$(filter %.o,$(SRC:.cpp=.o))
- 
--all: dist
-+all: omxplayer.bin omxplayer.1
- 
- %.o: %.cpp
- 	@rm -f $@ 
-@@ -53,7 +53,7 @@ version:
- 	bash gen_version.sh > version.h 
- 
- omxplayer.bin: version $(OBJS)
--	$(CXX) $(LDFLAGS) -o omxplayer.bin $(OBJS) -lvchiq_arm -lvchostif -lvcos -ldbus-1 -lrt -lpthread -lavutil -lavcodec -lavformat -lswscale -lswresample -lpcre
-+	$(CXX) -o omxplayer.bin $(OBJS) $(LDFLAGS) -lvchiq_arm -lvchostif -lvcos -ldbus-1 -lrt -lpthread -lavutil -lavcodec -lavformat -lswscale -lswresample -lpcre
- 	$(STRIP) omxplayer.bin
- 
- help.h: README.md Makefile
-@@ -94,7 +94,14 @@ dist: omxplayer.bin omxplayer.1
- 	cd $(DIST); tar -czf ../$(DIST).tgz *
- 
- install:
--	cp -r $(DIST)/* /
-+	install -d $(DESTDIR)/usr/bin
-+	install -d $(DESTDIR)/usr/share/doc/omxplayer
-+	install -d $(DESTDIR)/usr/share/man/man1
-+	install -m755 omxplayer $(DESTDIR)/usr/bin/omxplayer-dbus
-+	install -m755 omxplayer.bin $(DESTDIR)/usr/bin/omxplayer
-+	install -m644 omxplayer.1 $(DESTDIR)/usr/share/man/man1/
-+	install -m644 README.md $(DESTDIR)/usr/share/doc/omxplayer/
-+	install -m644 COPYING $(DESTDIR)/usr/share/doc/omxplayer/
- 
- uninstall:
- 	rm -rf /usr/bin/omxplayer
diff --git a/srcpkgs/omxplayer/patches/no-curl.patch b/srcpkgs/omxplayer/patches/no-curl.patch
deleted file mode 100644
index 522101cc4e0cb..0000000000000
--- a/srcpkgs/omxplayer/patches/no-curl.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -67,6 +67,6 @@ keys.h: README.md Makefile
- 
- omxplayer.1: README.md
- 	sed -e '/DOWNLOADING/,/omxplayer-dist/ d; /DBUS/,$$ d' $< >MAN
--	curl -F page=@MAN http://mantastic.herokuapp.com 2>/dev/null >$@
-+	ronn -r --pipe MAN >$@
- 
- clean:
diff --git a/srcpkgs/omxplayer/template b/srcpkgs/omxplayer/template
deleted file mode 100644
index 9a66690c83ebb..0000000000000
--- a/srcpkgs/omxplayer/template
+++ /dev/null
@@ -1,28 +0,0 @@
-# Template file for 'omxplayer'
-pkgname=omxplayer
-version=20190102
-revision=2
-short_desc="Commandline OMX player for the Raspberry Pi"
-maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later"
-homepage="https://github.com/popcornmix/omxplayer"
-
-_commit="f06235cc9690a6d58187514452df8cf8fcdaacec"
-distfiles="$homepage/archive/$_commit.tar.gz"
-checksum=af2d9450f8947842ea8c401fe9f71eec444013ebbdee29f2ac828c9c493c1329
-
-# XXX only rpi
-archs="armv6l* armv7l*"
-build_style=gnu-makefile
-hostmakedepends="ruby-ronn pkg-config"
-makedepends="alsa-lib-devel rpi-userland-devel pcre-devel boost-devel freetype-devel ffmpeg-devel dbus-devel"
-depends="freefont-ttf"
-
-do_build() {
-	sed -e 's,/usr/share/fonts/truetype/freefont,/usr/share/fonts/TTF,g' -i omxplayer.cpp
-	mkdir -p /opt/vc/lib
-	make CC=$CC XBPS_CROSS_BASE=$XBPS_CROSS_BASE ${makejobs}
-}
-post_install() {
-	sed -i 's,omxplayer.bin,omxplayer,g' ${DESTDIR}/usr/bin/omxplayer-dbus
-}
diff --git a/srcpkgs/vlc/template b/srcpkgs/vlc/template
index abc5eeba01564..fa46c57cba2fa 100644
--- a/srcpkgs/vlc/template
+++ b/srcpkgs/vlc/template
@@ -1,7 +1,7 @@
 # Template file for 'vlc'
 pkgname=vlc
 version=3.0.20
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--disable-gme --disable-libtar --enable-jack
  --enable-live555 --disable-fluidsynth --enable-dvdread
@@ -50,6 +50,8 @@ make_check=ci-skip
 build_options="lua notify opengl qt rpi smb svg v4l2 vaapi vdpau x265 sndio chromecast"
 build_options_default="lua smb v4l2 x265 sndio chromecast qt"
 
+subpackages="libvlc vlc-devel"
+
 CFLAGS="-fcommon"
 CXXFLAGS="-fcommon"
 
@@ -63,7 +65,12 @@ case "$XBPS_TARGET_MACHINE" in
 		configure_args+=" --disable-altivec"
 		build_options_default+=" opengl"
 		;;
-	armv[67]*|aarch64*)
+	armv[67]*)
+		# XXX only for rpi
+		build_options_default+=" rpi"
+		subpackages+=" omxplayer"
+		;;
+	aarch64*)
 		# XXX only for rpi
 		build_options_default+=" rpi"
 		;;
@@ -75,7 +82,6 @@ fi
 
 if [ "$build_option_rpi" ]; then
 	configure_args+=" --enable-omxil --enable-omxil-vout --enable-rpi-omxil"
-	makedepends+=" rpi-userland-devel"
 fi
 
 pre_configure() {
@@ -126,3 +132,9 @@ vlc-devel_package() {
 		vmove "usr/lib/*.so"
 	}
 }
+
+omxplayer_package() {
+	short_desc+="Commandline OMX player for the Raspberry Pi (transitional dummy package)"
+	depends="${sourcepkg}>=${version}_${revision}"
+	build_style=meta
+}

From 5cf0af81cc7a5e793721e092d0b24a1173c975f2 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 17 Nov 2023 14:21:13 -0500
Subject: [PATCH 11/11] libretro-mupen64plus-rpi: merge into
 libretro-mupen64plus

add an rpi build option for armv6/7, but should work all the same
---
 srcpkgs/libretro-mupen64plus-rpi              |  1 +
 .../patches/rpi.patch                         | 24 -------------
 .../patches/string.patch                      | 10 ------
 .../patches/types.patch                       | 29 ---------------
 srcpkgs/libretro-mupen64plus-rpi/template     | 35 -------------------
 srcpkgs/libretro-mupen64plus/template         | 34 +++++++++++-------
 6 files changed, 23 insertions(+), 110 deletions(-)
 create mode 120000 srcpkgs/libretro-mupen64plus-rpi
 delete mode 100644 srcpkgs/libretro-mupen64plus-rpi/patches/rpi.patch
 delete mode 100644 srcpkgs/libretro-mupen64plus-rpi/patches/string.patch
 delete mode 100644 srcpkgs/libretro-mupen64plus-rpi/patches/types.patch
 delete mode 100644 srcpkgs/libretro-mupen64plus-rpi/template

diff --git a/srcpkgs/libretro-mupen64plus-rpi b/srcpkgs/libretro-mupen64plus-rpi
new file mode 120000
index 0000000000000..b3931927d4937
--- /dev/null
+++ b/srcpkgs/libretro-mupen64plus-rpi
@@ -0,0 +1 @@
+libretro-mupen64plus
\ No newline at end of file
diff --git a/srcpkgs/libretro-mupen64plus-rpi/patches/rpi.patch b/srcpkgs/libretro-mupen64plus-rpi/patches/rpi.patch
deleted file mode 100644
index 708e870b5055b..0000000000000
--- a/srcpkgs/libretro-mupen64plus-rpi/patches/rpi.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -99,7 +99,7 @@ else ifneq (,$(findstring rpi,$(platform)))
-       GL_LIB := -lGLESv2
-    else
-       LLE = 0
--      CPUFLAGS += -DVC
-+      CPUFLAGS += -DVC -DGL_GLEXT_PROTOTYPES
-       GL_LIB := -L/opt/vc/lib -lbrcmGLESv2
-       EGL_LIB := -lbrcmEGL
-       INCFLAGS += -I/opt/vc/include -I/opt/vc/include/interface/vcos -I/opt/vc/include/interface/vcos/pthreads
---- a/libretro-common/include/glsm/glsm.h
-+++ b/libretro-common/include/glsm/glsm.h
-@@ -32,8 +32,8 @@
- RETRO_BEGIN_DECLS
- 
- #ifdef HAVE_OPENGLES2
--typedef GLfloat GLdouble;
--typedef GLclampf GLclampd;
-+typedef double GLdouble;
-+typedef double GLclampd;
- #endif
- 
- #if defined(HAVE_OPENGLES2)
diff --git a/srcpkgs/libretro-mupen64plus-rpi/patches/string.patch b/srcpkgs/libretro-mupen64plus-rpi/patches/string.patch
deleted file mode 100644
index 87dd9e9818649..0000000000000
--- a/srcpkgs/libretro-mupen64plus-rpi/patches/string.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/GLideN64/src/ShaderUtils.h	2019-05-31 19:25:22.000000000 +0200
-+++ b/GLideN64/src/ShaderUtils.h	2021-03-02 14:30:43.395732704 +0100
-@@ -1,6 +1,7 @@
- #ifndef SHADER_UTILS_H
- #define SHADER_UTILS_H
- 
-+#include <string>
- #include "OpenGL.h"
- #include "Combiner.h"
- 
diff --git a/srcpkgs/libretro-mupen64plus-rpi/patches/types.patch b/srcpkgs/libretro-mupen64plus-rpi/patches/types.patch
deleted file mode 100644
index c5b65bcaf04a2..0000000000000
--- a/srcpkgs/libretro-mupen64plus-rpi/patches/types.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-This is needed to build on armv6/7 musl.
---- a/mupen64plus-core/src/r4300/new_dynarec/new_dynarec.c
-+++ b/mupen64plus-core/src/r4300/new_dynarec/new_dynarec.c
-@@ -25,12 +25,8 @@
- #include <stdlib.h>
- #include <string.h>
- 
--#if defined(__APPLE__)
- #include <sys/types.h> // needed for u_int, u_char, etc
- 
--#define MAP_ANONYMOUS MAP_ANON
--#endif
--
- #ifdef __cplusplus
- extern "C" {
- #endif
---- a/mupen64plus-core/src/r4300/new_dynarec/new_dynarec_64.c
-+++ b/mupen64plus-core/src/r4300/new_dynarec/new_dynarec_64.c
-@@ -24,10 +24,7 @@
- #include <string.h>
- #include <assert.h>
- 
--#if defined(__APPLE__)
- #include <sys/types.h> // needed for u_int, u_char, etc
--#define MAP_ANONYMOUS MAP_ANON
--#endif
- 
- #include "new_dynarec.h"
- #include "main/main.h"
diff --git a/srcpkgs/libretro-mupen64plus-rpi/template b/srcpkgs/libretro-mupen64plus-rpi/template
deleted file mode 100644
index ba35d8b5fdb03..0000000000000
--- a/srcpkgs/libretro-mupen64plus-rpi/template
+++ /dev/null
@@ -1,35 +0,0 @@
-# Template file for 'libretro-mupen64plus-rpi'
-pkgname=libretro-mupen64plus-rpi
-version=20190611
-revision=1
-archs="armv6l* armv7l*"
-_gitrev=e64ef9d9f214e32341fb7cd9633260fbb44b2326
-hostmakedepends="pkg-config unzip"
-makedepends="rpi-userland-devel zlib-devel"
-short_desc="Libretro port of Mupen64 Plus"
-maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-3.0-or-later"
-homepage="http://www.libretro.com/"
-distfiles="https://github.com/libretro/mupen64plus-libretro/archive/${_gitrev}.tar.gz"
-checksum=947abfb1d5ff34d6b22fecfb2df02bd3759fde3f4a0e5d238f65ec7e97d964d4
-conflicts="ĺibretro-mupen64plus>=0"
-
-CFLAGS="-fcommon"
-
-do_build() {
-	local _args="ARCH=arm"
-
-	case "$XBPS_TARGET_MACHINE" in
-		armv6*) _args+=" platform=rpi";;
-		armv7*) _args+=" platform=rpi2";;
-	esac
-	install -d /opt/vc/lib
-	sed -i "s|-L/opt/vc/lib|-L${XBPS_CROSS_BASE}/opt/vc/lib -Wl,-R /opt/vc/lib|g" Makefile
-	sed -i 's|/opt/vc/include|${XBPS_CROSS_BASE}/opt/vc/include|g' Makefile
-
-	make CC=$CC ${_args} ${makejobs}
-}
-
-do_install() {
-	vinstall mupen64plus_libretro.so 755 usr/lib/libretro
-}
diff --git a/srcpkgs/libretro-mupen64plus/template b/srcpkgs/libretro-mupen64plus/template
index 72d77c7b229e6..2ea7152a6eba1 100644
--- a/srcpkgs/libretro-mupen64plus/template
+++ b/srcpkgs/libretro-mupen64plus/template
@@ -1,7 +1,7 @@
 # Template file for 'libretro-mupen64plus'
 pkgname=libretro-mupen64plus
 version=20190611
-revision=1
+revision=2
 _gitrev=e64ef9d9f214e32341fb7cd9633260fbb44b2326
 hostmakedepends="pkg-config unzip"
 makedepends="MesaLib-devel zlib-devel"
@@ -11,16 +11,16 @@ license="GPL-3.0-or-later"
 homepage="http://www.libretro.com/"
 distfiles="https://github.com/libretro/mupen64plus-libretro/archive/${_gitrev}.tar.gz"
 checksum=947abfb1d5ff34d6b22fecfb2df02bd3759fde3f4a0e5d238f65ec7e97d964d4
-conflicts="ĺibretro-mupen64plus-rpi>=0"
 
 case "$XBPS_TARGET_MACHINE" in
 	i686*) hostmakedepends+=" nasm";;
 esac
 
-build_options="gles gles3"
+build_options="gles gles3 rpi"
 
 case "$XBPS_TARGET_MACHINE" in
-	armv*|aarch64*) build_options_default="gles";;
+	armv*) build_options_default="rpi";;
+	aarch64*) build_options_default="gles";;
 esac
 
 CFLAGS="-fcommon"
@@ -30,22 +30,32 @@ do_build() {
 
 	# setting ARCH makes sure proper dynarec is selected
 	case "$XBPS_TARGET_MACHINE" in
-		i686*) _args="ARCH=i686";;
-		arm*) _args="ARCH=arm";;
-		aarch64*) _args="ARCH=aarch64";;
-		x86_64*) _args="ARCH=x86_64";;
-		*) _args="ARCH=${XBPS_TARGET_MACHINE%-musl}";;
+		armv*) _args=(ARCH=arm);;
+		*) _args=(ARCH="${XBPS_TARGET_MACHINE%-musl}");;
 	esac
 
+	if [ "$build_option_rpi" ]; then
+		case "$XBPS_TARGET_MACHINE" in
+			armv6*) _args+=(platform="rpi mesa");;
+			armv7*) _args+=(platform="rpi2 mesa");;
+		esac
+	fi
+
 	if [ "$build_option_gles3" ]; then
-		_args+=" FORCE_GLES3=1"
+		_args+=(FORCE_GLES3=1)
 	elif [ "$builld_option_gles" ]; then
-		_args+=" FORCE_GLES=1"
+		_args+=(FORCE_GLES=1)
 	fi
 
-	make CC=$CC ${_args} ${makejobs}
+	make CC="$CC" "${_args[@]}" "${makejobs}"
 }
 
 do_install() {
 	vinstall mupen64plus_libretro.so 755 usr/lib/libretro
 }
+
+libretro-mupen64plus-rpi_package() {
+	build_style=meta
+	short_desc+=" (transitional dummy package)"
+	depends="${sourcepkg}>=${version}_${revision}"
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (12 preceding siblings ...)
  2024-01-05 21:26 ` classabbyamp
@ 2024-01-05 21:28 ` classabbyamp
  2024-01-05 21:28 ` classabbyamp
  2024-01-17 19:23 ` [PR PATCH] [Merged]: " classabbyamp
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2024-01-05 21:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/47288#issuecomment-1868344109

Comment:
updated things because this has sat for a bit

new versions should be available at https://files.placeviolette.net/rpi5 for testing

TODOs left:
- [ ] give everything a quick test
- [x] deconflict `linux-firmware-broadcom` and `rpi-firmware` (probably simple)
- [x] figure out #47290
- [ ] rpi5-kernel pagesize gives issues with jemalloc

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (13 preceding siblings ...)
  2024-01-05 21:28 ` classabbyamp
@ 2024-01-05 21:28 ` classabbyamp
  2024-01-17 19:23 ` [PR PATCH] [Merged]: " classabbyamp
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2024-01-05 21:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/47288#issuecomment-1868344109

Comment:
updated things because this has sat for a bit

new versions should be available at https://files.placeviolette.net/rpi5 for testing

TODOs left:
- [x] give everything a quick test
- [x] deconflict `linux-firmware-broadcom` and `rpi-firmware` (probably simple)
- [x] figure out #47290
- [ ] rpi5-kernel pagesize gives issues with jemalloc

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Merged]: rpi-*: update and support rpi5
  2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
                   ` (14 preceding siblings ...)
  2024-01-05 21:28 ` classabbyamp
@ 2024-01-17 19:23 ` classabbyamp
  15 siblings, 0 replies; 17+ messages in thread
From: classabbyamp @ 2024-01-17 19:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]

There's a merged pull request on the void-packages repository

rpi-*: update and support rpi5
https://github.com/void-linux/void-packages/pull/47288

Description:
- rpi-kernel: update to 6.1.62.
- rpi-firmware: update to 20231102.
- New package: rpi-utils-20231105
- rpi-eeprom: update to 2023.11.09.

#### Testing the changes
- I tested the changes in this PR: **YES**
  - [x] 1B+ (armv6l)
  - [ ] 0 (armv6l)
  - [ ] 1A+ (armv6l)
  - [ ] 2B (armv7l)
  - [x] 3B (aarch64)
  - [x] 02W (aarch64)
  - [x] 4B (aarch64)
  - [x] 5 (aarch64)

### Prebuilt packages and RPi5-compatible install images for testing

**packages:** https://files.placeviolette.net/rpi5

```
`https://files.placeviolette.net/rpi5' repository has been RSA signed by "classabbyamp"
Fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
```
**images:** https://files.placeviolette.net/rpi5-live

`rpi5-kernel` is not installed by default on these images, but can be seamlessly switched to by installing it. it will uninstall  `rpi-kernel` (and vice-versa). RPi5 is compatible with both, but `rpi5-kernel` may provide some performance benefits.

The images also include the changes from void-linux/void-mklive#361

[ci skip]

closes #46815 
closes #46522 

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-01-17 19:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-18  4:01 [PR PATCH] rpi-*: update and support rpi5 classabbyamp
2023-11-18  4:02 ` [PR PATCH] [Updated] " classabbyamp
2023-11-18 19:54 ` classabbyamp
2023-11-19 19:19 ` classabbyamp
2023-11-20  3:17 ` classabbyamp
2023-11-21 11:57 ` 0x5c
2023-11-22 22:39 ` moabeat-berlin
2023-12-23 18:09 ` [PR PATCH] [Updated] " classabbyamp
2023-12-23 18:10 ` classabbyamp
2023-12-23 18:13 ` classabbyamp
2023-12-23 22:24 ` [PR PATCH] [Updated] " classabbyamp
2023-12-23 22:26 ` classabbyamp
2024-01-05 19:46 ` [PR PATCH] [Updated] " classabbyamp
2024-01-05 21:26 ` classabbyamp
2024-01-05 21:28 ` classabbyamp
2024-01-05 21:28 ` classabbyamp
2024-01-17 19:23 ` [PR PATCH] [Merged]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).