Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] rpi-kernel: build a subpackage for each flavor, add rpi4
@ 2020-10-31 16:17 Piraty
  2020-10-31 16:27 ` [PR PATCH] [Updated] " Piraty
                   ` (60 more replies)
  0 siblings, 61 replies; 62+ messages in thread
From: Piraty @ 2020-10-31 16:17 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Piraty/void-packages rpi-kernel-flavor-subpackage
https://github.com/void-linux/void-packages/pull/26000

rpi-kernel: build a subpackage for each flavor, add rpi4




@Duncaen @pbui 

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rpi-kernel-flavor-subpackage-26000.patch --]
[-- Type: text/x-diff, Size: 12904 bytes --]

From b2c22ecad05932e3a954132e78574fe0ff29943e Mon Sep 17 00:00:00 2001
From: Piraty <piraty1@inbox.ru>
Date: Mon, 26 Oct 2020 21:33:08 +0100
Subject: [PATCH 1/2] rpi-base: don't depend on rpi-kernel anymore

Now that we have rpi4 it's not sufficient to determine the rpi variant
by looking at XBPS_TARGET_MACHINE anymore.

In case rpi-base requires modification for a specific variant that has
the same XBPS_TARGET_MACHINE as another variant, rpi-base needs to be
split into rpi{N}-base; then rpi{N}-base can depend on rpi{N}-kernel
again.
---
 srcpkgs/rpi-base/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/rpi-base/template b/srcpkgs/rpi-base/template
index a1e15b06280..c1115087cd5 100644
--- a/srcpkgs/rpi-base/template
+++ b/srcpkgs/rpi-base/template
@@ -1,14 +1,14 @@
 # Template file for 'rpi-base'
 pkgname=rpi-base
 version=2.5
-revision=4
+revision=5
 homepage="http://www.voidlinux.org"
 short_desc="Void Linux RaspberryPi base files"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="Public Domain"
 
 archs="armv6l* armv7l* aarch64*"
-depends="virtual?ntp-daemon rpi-firmware rpi-kernel"
+depends="virtual?ntp-daemon rpi-firmware"
 
 do_install() {
 	case "$XBPS_TARGET_MACHINE" in

From 944112b26a867dc330beecdeecf30f8369055798 Mon Sep 17 00:00:00 2001
From: Piraty <piraty1@inbox.ru>
Date: Sun, 18 Oct 2020 22:04:24 +0200
Subject: [PATCH 2/2] rpi-kernel: build a subpackage for each flavor

add rpi4

[ci skip]
---
 srcpkgs/rpi-kernel/template | 236 ++++++++++++++++++++++++++++++------
 srcpkgs/rpi1-kernel         |   1 +
 srcpkgs/rpi1-kernel-headers |   1 +
 srcpkgs/rpi2-kernel         |   1 +
 srcpkgs/rpi2-kernel-headers |   1 +
 srcpkgs/rpi3-kernel         |   1 +
 srcpkgs/rpi3-kernel-headers |   1 +
 srcpkgs/rpi4-kernel         |   1 +
 srcpkgs/rpi4-kernel-headers |   1 +
 9 files changed, 210 insertions(+), 34 deletions(-)
 create mode 120000 srcpkgs/rpi1-kernel
 create mode 120000 srcpkgs/rpi1-kernel-headers
 create mode 120000 srcpkgs/rpi2-kernel
 create mode 120000 srcpkgs/rpi2-kernel-headers
 create mode 120000 srcpkgs/rpi3-kernel
 create mode 120000 srcpkgs/rpi3-kernel-headers
 create mode 120000 srcpkgs/rpi4-kernel
 create mode 120000 srcpkgs/rpi4-kernel-headers

diff --git a/srcpkgs/rpi-kernel/template b/srcpkgs/rpi-kernel/template
index 7bce019015f..2a62cc192d1 100644
--- a/srcpkgs/rpi-kernel/template
+++ b/srcpkgs/rpi-kernel/template
@@ -11,11 +11,14 @@ _gitshort="${_githash:0:7}"
 pkgname=rpi-kernel
 version=5.4.68
 revision=1
+build_style=meta
+archs="armv6l* armv7l* aarch64*"
 wrksrc="linux-${_githash}"
+hostmakedepends="perl kmod uboot-mkimage libressl-devel bc bison flex"
 maintainer="Peter Bui <pbui@github.bx612.space>"
 homepage="http://www.kernel.org"
 license="GPL-2.0-only"
-short_desc="The Linux kernel for Raspberry Pi (${version%.*} series [git ${_gitshort}])"
+short_desc="Linux kernel for Raspberry Pi (${version%.*} series [git ${_gitshort}])"
 distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
 checksum=e0dc98befadb4c8c66aa0e73d9d79f10b20e29fb758ab870a0c6c708e3a0abb7
 python_version=2
@@ -27,13 +30,9 @@ nostrip=yes
 noverifyrdeps=yes
 noshlibprovides=yes
 
-# RPi, RPi2, RPi3
-archs="armv6l* armv7l* aarch64*"
-hostmakedepends="perl kmod uboot-mkimage libressl-devel bc bison flex"
-makedepends="ncurses-devel"
-triggers="kernel-hooks"
+_triggers="kernel-hooks"
 # These files could be modified when an external module is built.
-mutable_files="
+_mutable_files="
 	/usr/lib/modules/${_kernver}/modules.dep
 	/usr/lib/modules/${_kernver}/modules.dep.bin
 	/usr/lib/modules/${_kernver}/modules.symbols
@@ -52,31 +51,109 @@ if [ "$CROSS_BUILD" ]; then
 	_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
 fi
 
+# handle all raspberry pi flavors
+case "$XBPS_TARGET_MACHINE" in
+	armv6*) _flavors=rpi1 ;;
+	armv7*) _flavors=rpi2 ;;
+	aarch64*) _flavors="rpi3 rpi4" ;;
+esac
+
+subpackages="rpi-kernel-headers"
+for _f in $_flavors; do
+	subpackages+=" ${_f}-kernel-headers ${_f}-kernel"
+done
+
+# support legacy installations. don't drop before 2021-12 !!
+# make the meta packages depend on the new flavor packages
+case "$XBPS_TARGET_MACHINE" in
+	armv6*) depends=rpi1-kernel ;;
+	armv7*) depends=rpi2-kernel ;;
+	aarch64*) depends=rpi3-kernel ;;
+esac
+
+_flavor_stage() {
+	stage="$1"
+
+	for _f in $_flavors ; do
+		msg_normal "$_f: $stage\n"
+		(
+		case "$stage" in
+			pre_configure)
+				msg_normal "$_f: prepare build dir, please wait...\n"
+				cp -a "$wrksrc" "$wrksrc/../$_f"
+				;;
+			configure)
+				cd "$wrksrc/../$_f"
+				_configure $_f
+				;;
+			build)
+				cd "$wrksrc/../$_f"
+				_build
+				;;
+			install)
+				cd "$wrksrc/../$_f"
+				_install $_f
+				mv "$DESTDIR" "$DESTDIR/../$_f"
+				mkdir -p "$DESTDIR" 
+				;;
+		esac
+		)
+	done
+}
+
+_flavor_subpkg_install_kernel() {
+	(
+		export DESTDIR="$DESTDIR/../$1"
+		vmove /boot
+		vmove /usr/lib
+	)
+}
+_flavor_subpkg_install_headers() {
+	(
+		export DESTDIR="$DESTDIR/../$1"
+		vmove usr/src
+		vmove usr/lib/modules/${_kernver}/build
+	)
+}
+
+
 pre_configure() {
-	# Remove .git directory, otherwise scripts/setkernelversion.sh
-	# modifies KERNELRELEASE and appends + to it.
-	rm -rf .git
+	_flavor_stage pre_configure
 }
+
 do_configure() {
+	_flavor_stage configure
+}
+
+do_build() {
+	_flavor_stage build
+}
+
+do_install() {
+	_flavor_stage install
+}
+
+_configure() {
+	local rpi_flavor="$1"
 	local target defconfig
 
 	# Use upstream's default configuration, no need to maintain ours.
-	case "$XBPS_TARGET_MACHINE" in
-		# RPi3
-		aarch64*)
-			target=bcmrpi3_defconfig
+	case "$rpi_flavor" in
+		rpi1)
+			target=bcmrpi_defconfig
 			;;
-		# RPi2 / RPi3
-		armv7l*)
+		rpi2)
 			target=bcm2709_defconfig
 			;;
-		# RPi1
-		armv6l*)
-			target=bcmrpi_defconfig
+		rpi3)
+			target=bcmrpi3_defconfig
+			;;
+		rpi4)
+			target=bcm2711_defconfig
 			;;
 	esac
-
 	defconfig="arch/${_arch}/configs/${target}"
+
 	echo "CONFIG_CONNECTOR=y" >> "$defconfig"
 	echo "CONFIG_PROC_EVENTS=y" >> "$defconfig"
 	echo "CONFIG_F2FS_FS_SECURITY=y" >> "$defconfig"
@@ -101,7 +178,8 @@ do_configure() {
 	# Always use our revision to CONFIG_LOCALVERSION to match our pkg version.
 	vsed -i -e "s|^\(CONFIG_LOCALVERSION=\).*|\1\"_${revision}\"|" .config
 }
-do_build() {
+
+_build() {
 	local target
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -116,11 +194,13 @@ do_build() {
 	make ${makejobs} ${_cross} ARCH=${_arch} prepare
 	make ${makejobs} ${_cross} ARCH=${_arch} ${target}
 }
-do_install() {
+
+_install() {
+	local rpi_flavor="$1"
 	local hdrdest
 
 	# Run depmod after compressing modules.
-	sed -i '2iexit 0' scripts/depmod.sh
+	vsed -i '2iexit 0' scripts/depmod.sh
 
 	# Install kernel, firmware and modules
 	make ${makejobs} ARCH=${_arch} INSTALL_MOD_PATH=${DESTDIR} modules_install
@@ -128,12 +208,16 @@ do_install() {
 	# Install device tree blobs
 	make ${makejobs} ARCH=${_arch} INSTALL_DTBS_PATH=${DESTDIR}/boot dtbs_install
 
-	#move rpi3's dtb that ended up in /boot/broadcom
-	case "$XBPS_TARGET_MACHINE" in
-	aarch64*)
-		mv ${DESTDIR}/boot/broadcom/bcm2710-rpi-3-b.dtb ${DESTDIR}/boot
-		;;
+	#move dtb that ended up in /boot/broadcom
+	case "$rpi_flavor" in
+		rpi3)
+			mv ${DESTDIR}/boot/broadcom/bcm2710-rpi-3-b.dtb ${DESTDIR}/boot
+			;;
+		rpi4)
+			mv ${DESTDIR}/boot/broadcom/bcm2711-rpi-4-b.dtb ${DESTDIR}/boot
+			;;
 	esac
+	rm -rf ${DESTDIR}/boot/broadcom
 
 	vmkdir boot
 	# Generate kernel.img and install it to destdir.
@@ -155,11 +239,12 @@ do_install() {
 	vmkdir usr
 	mv ${DESTDIR}/lib ${DESTDIR}/usr
 
+	(
 	cd ${DESTDIR}/usr/lib/modules/${_kernver}
 	rm -f source build
 	ln -sf ../../../src/${sourcepkg}-headers-${_kernver} build
+	)
 
-	cd ${wrksrc}
 	# Install required headers to build external modules
 	install -Dm644 Makefile ${hdrdest}/Makefile
 	install -Dm644 kernel/Makefile ${hdrdest}/kernel/Makefile
@@ -182,7 +267,6 @@ do_install() {
 		[ -d include/$i ] && cp -a include/$i ${hdrdest}/include
 	done
 
-	cd ${wrksrc}
 	# 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
@@ -241,20 +325,104 @@ do_install() {
 	cp -a arch/x86/ras/Kconfig ${hdrdest}/arch/x86/ras/Kconfig
 
 	# Compress all modules with xz to save a few MBs.
-	msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
+	msg_normal "$rpi_flavor: 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}
 }
 
+# legacy
 rpi-kernel-headers_package() {
+	short_desc="${short_desc/kernel/kernel headers} (transitional)"
+	build_style=meta
+	case "$XBPS_TARGET_MACHINE" in
+		armv6*) depends=rpi1-kernel-headers ;;
+		armv7*) depends=rpi2-kernel-headers ;;
+		aarch64*) depends=rpi3-kernel-headers ;;
+	esac
+}
+
+rpi1-kernel_package() {
 	nostrip=yes
 	noverifyrdeps=yes
 	noshlibprovides=yes
-	short_desc="The Linux kernel headers for Raspberry Pi (${version%.*} series [git ${_gitshort}])"
+	triggers="$_triggers"
+	mutable_files="$_mutable_files"
+	short_desc="Linux kernel for Raspberry Pi 1 (${version%.*} [git ${_gitshort}])"
 	pkg_install() {
-		vmove usr/src
-		vmove usr/lib/modules/${_kernver}/build
+		_flavor_subpkg_install_kernel rpi1
+	}
+}
+rpi1-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="Linux kernel headers for Raspberry Pi 1 (${version%.*} [git ${_gitshort}])"
+	pkg_install() {
+		_flavor_subpkg_install_headers rpi1
+	}
+}
+
+rpi2-kernel_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	triggers="$_triggers"
+	mutable_files="$_mutable_files"
+	short_desc="Linux kernel for Raspberry Pi 2 (${version%.*} [git ${_gitshort}])"
+	pkg_install() {
+		_flavor_subpkg_install_kernel rpi2
+	}
+}
+rpi2-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="Linux kernel headers for Raspberry Pi 2 (${version%.*} [git ${_gitshort}])"
+	pkg_install() {
+		_flavor_subpkg_install_headers rpi2
+	}
+}
+
+rpi3-kernel_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	mutable_files="$_mutable_files"
+	triggers="$_triggers"
+	short_desc="Linux kernel for Raspberry Pi 3 (${version%.*} [git ${_gitshort}])"
+	pkg_install() {
+		_flavor_subpkg_install_kernel rpi3
+	}
+}
+rpi3-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="Linux kernel headers for Raspberry Pi 3 (${version%.*} [git ${_gitshort}])"
+	pkg_install() {
+		_flavor_subpkg_install_headers rpi3
+	}
+}
+
+rpi4-kernel_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	mutable_files="$_mutable_files"
+	triggers="$_triggers"
+	short_desc="Linux kernel for Raspberry Pi 4 (${version%.*} [git ${_gitshort}])"
+	pkg_install() {
+		_flavor_subpkg_install_kernel rpi4
+	}
+}
+rpi4-kernel-headers_package() {
+	nostrip=yes
+	noverifyrdeps=yes
+	noshlibprovides=yes
+	short_desc="Linux kernel headers for Raspberry Pi 4 (${version%.*} [git ${_gitshort}])"
+	pkg_install() {
+		_flavor_subpkg_install_headers rpi4
 	}
 }
diff --git a/srcpkgs/rpi1-kernel b/srcpkgs/rpi1-kernel
new file mode 120000
index 00000000000..3b4ec073331
--- /dev/null
+++ b/srcpkgs/rpi1-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi1-kernel-headers b/srcpkgs/rpi1-kernel-headers
new file mode 120000
index 00000000000..3b4ec073331
--- /dev/null
+++ b/srcpkgs/rpi1-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi2-kernel b/srcpkgs/rpi2-kernel
new file mode 120000
index 00000000000..3b4ec073331
--- /dev/null
+++ b/srcpkgs/rpi2-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi2-kernel-headers b/srcpkgs/rpi2-kernel-headers
new file mode 120000
index 00000000000..3b4ec073331
--- /dev/null
+++ b/srcpkgs/rpi2-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi3-kernel b/srcpkgs/rpi3-kernel
new file mode 120000
index 00000000000..3b4ec073331
--- /dev/null
+++ b/srcpkgs/rpi3-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi3-kernel-headers b/srcpkgs/rpi3-kernel-headers
new file mode 120000
index 00000000000..3b4ec073331
--- /dev/null
+++ b/srcpkgs/rpi3-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi4-kernel b/srcpkgs/rpi4-kernel
new file mode 120000
index 00000000000..3b4ec073331
--- /dev/null
+++ b/srcpkgs/rpi4-kernel
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file
diff --git a/srcpkgs/rpi4-kernel-headers b/srcpkgs/rpi4-kernel-headers
new file mode 120000
index 00000000000..3b4ec073331
--- /dev/null
+++ b/srcpkgs/rpi4-kernel-headers
@@ -0,0 +1 @@
+rpi-kernel
\ No newline at end of file

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

end of thread, other threads:[~2021-04-27 19:43 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-31 16:17 [PR PATCH] rpi-kernel: build a subpackage for each flavor, add rpi4 Piraty
2020-10-31 16:27 ` [PR PATCH] [Updated] " Piraty
2020-10-31 16:36 ` Piraty
2020-11-06 23:34 ` [NEEDS TESTERS] " liketechnik
2020-11-16  3:32 ` [PR REVIEW] " agausmann
2020-11-16  3:34 ` agausmann
2020-11-16  3:36 ` agausmann
2020-11-16  3:57 ` agausmann
2020-11-16  3:58 ` agausmann
2020-11-16  3:59 ` agausmann
2020-11-17  9:10 ` [PR REVIEW] " Piraty
2020-11-22 18:23 ` Piraty
2020-11-22 19:48 ` Piraty
2020-11-22 20:58 ` agausmann
2020-12-29  7:49 ` manneorama
2020-12-29  7:59 ` manneorama
2020-12-29  8:10 ` manneorama
2020-12-29  9:03 ` manneorama
2020-12-29  9:48 ` manneorama
2020-12-29 10:53 ` manneorama
2020-12-31  1:42 ` [PR PATCH] [Updated] " Piraty
2021-01-03 23:08 ` manneorama
2021-01-05  9:36 ` Anachron
2021-01-05 19:48 ` LeamHall
2021-01-06 19:21 ` manneorama
2021-01-07  1:18 ` CMB
2021-01-07  2:04 ` LeamHall
2021-01-07  2:20 ` LeamHall
2021-01-11  0:24 ` [PR REVIEW] " ahesford
2021-01-11  2:02 ` ericonr
2021-01-11  2:02 ` ericonr
2021-01-11  2:57 ` jsumners
2021-01-11  3:17 ` ericonr
2021-01-11  3:51 ` jsumners
2021-01-11  4:14 ` ericonr
2021-01-11  5:04 ` ahesford
2021-01-11 11:19 ` Piraty
2021-01-11 11:21 ` Piraty
2021-01-11 11:25 ` Piraty
2021-01-11 13:17 ` ahesford
2021-01-11 13:20 ` ericonr
2021-01-12 20:19 ` [PR PATCH] [Updated] " Piraty
2021-01-13  2:42 ` [PR REVIEW] " ahesford
2021-01-16 22:38 ` CameronNemo
2021-01-16 23:36 ` [PR PATCH] [Updated] " Piraty
2021-01-16 23:37 ` [PR REVIEW] " Piraty
2021-01-16 23:49 ` Piraty
2021-01-16 23:49 ` Piraty
2021-01-17  0:22 ` [WIP] " ahesford
2021-01-18  9:44 ` [PR REVIEW] " Piraty
2021-01-18 21:48 ` ericonr
2021-01-23 17:30 ` Bridouz
2021-01-23 20:22 ` jsumners
2021-01-28  6:28 ` Bridouz
2021-02-05 10:20 ` paper42
2021-02-10 19:03 ` jsav0
2021-02-11 19:45 ` [PR PATCH] [Updated] " Piraty
2021-02-11 20:01 ` [PR PATCH] [Updated] [WIP] rpi-kernel: split into flavor packages, " Piraty
2021-02-11 20:03 ` Piraty
2021-02-12 18:15 ` Piraty
2021-04-27 19:43 ` [WIP] rpi-kernel: build flavor subpackages, " Piraty
2021-04-27 19:43 ` [PR PATCH] [Closed]: " Piraty

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).