Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] cross-built kernel/dkms improvements
@ 2023-09-29 21:59 classabbyamp
  2023-09-30  1:14 ` [PR PATCH] [Updated] " classabbyamp
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: classabbyamp @ 2023-09-29 21:59 UTC (permalink / raw)
  To: ml

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

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

https://github.com/classabbyamp/void-packages dkms-cross
https://github.com/void-linux/void-packages/pull/46332

cross-built kernel/dkms improvements
- dkms: allow limiting jobs, add missing dep
    - some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`. Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms`
    - `bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross.
    - see also: https://github.com/void-linux/void-packages/pull/46152#issuecomment-1741479613
- linux6.1: include files necessary for dkms on cross
- linux6.5: include files necessary for dkms on cross

The same fix could be applied to linux6.3 and linux6.4, but with the impending zfs 2.1.13 bump (#46304), I don't see much point.

fixes #44807

#### Testing the changes
- I tested the changes in this PR: **briefly** (these fixes worked for 6.1 on rpi-kernel)

@moabeat-berlin, @r-ricci, @Calandracas606: please test

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

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

From f0e57d2c82c193a214c469f45ed573375eacb26e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:40:53 -0400
Subject: [PATCH 1/3] dkms: allow limiting jobs, add missing dep

some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`.
Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms`

`bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross.
---
 srcpkgs/dkms/files/dkms.default           | 2 ++
 srcpkgs/dkms/files/kernel.d/dkms.postinst | 9 ++++++---
 srcpkgs/dkms/template                     | 9 +++++----
 3 files changed, 13 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/dkms/files/dkms.default

diff --git a/srcpkgs/dkms/files/dkms.default b/srcpkgs/dkms/files/dkms.default
new file mode 100644
index 0000000000000..60312bf9720ca
--- /dev/null
+++ b/srcpkgs/dkms/files/dkms.default
@@ -0,0 +1,2 @@
+# number of parallel jobs to use for DKMS compilation (default: $(nproc))
+#DKMS_JOBS=
diff --git a/srcpkgs/dkms/files/kernel.d/dkms.postinst b/srcpkgs/dkms/files/kernel.d/dkms.postinst
index 66d22981b5172..6e4d3b3149a5b 100644
--- a/srcpkgs/dkms/files/kernel.d/dkms.postinst
+++ b/srcpkgs/dkms/files/kernel.d/dkms.postinst
@@ -17,10 +17,13 @@ if [ ! -e /lib/modules/${VERSION}/build/include ] ; then
 	exit 0
 fi
 
+[ -r /etc/default/dkms ] && . /etc/default/dkms
+: "${DKMS_JOBS:=$(nproc)}"
+
 export IGNORE_CC_MISMATCH=1
 
 if [ ! -f /lib/modules/${VERSION}/build/scripts/basic/fixdep ] || [ ! -f /lib/modules/${VERSION}/build/scripts/mod/modpost ]; then
-	yes "" | make -j $(nproc) -C /lib/modules/${VERSION}/build prepare0
+	yes "" | make -j "${DKMS_JOBS}" -C /lib/modules/${VERSION}/build prepare0
 fi
 
 # Check available DKMS modules
@@ -68,7 +71,7 @@ while [ $# -gt 1 ]; do
 		fi
 		# Build the module
 		echo -n "Building DKMS module: ${module}-${modulever}... "
-		/usr/bin/dkms build -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
+		/usr/bin/dkms build -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
 		rval=$?
 		# If the module was skipped or failed, go to the next module.
 		if [ $rval -eq 0 ]; then
@@ -87,7 +90,7 @@ while [ $# -gt 1 ]; do
 	if [ $(echo "$status"|grep -c ": built") -eq 1 ] &&
 	   [ $(echo "$status"|grep -c ": installed") -eq 0 ]; then
 		echo -n "Installing DKMS module: ${module}-${modulever}... "
-		/usr/bin/dkms install --force -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
+		/usr/bin/dkms install --force -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
 		rval=$?
 		# If the module failed installation, go to the next module.
 		if [ $rval -eq 0 ]; then
diff --git a/srcpkgs/dkms/template b/srcpkgs/dkms/template
index 34ee6c4afabb3..eaaa5d47404d2 100644
--- a/srcpkgs/dkms/template
+++ b/srcpkgs/dkms/template
@@ -1,9 +1,9 @@
 # Template file for 'dkms'
 pkgname=dkms
 version=3.0.10
-revision=2
+revision=3
 conf_files="/etc/dkms/framework.conf"
-depends="bash kmod gcc make coreutils xbps-triggers>=0.123_1"
+depends="bash kmod gcc bc make coreutils xbps-triggers>=0.123_1"
 short_desc="Dynamic Kernel Module Support"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later"
@@ -35,6 +35,7 @@ do_install() {
 	vcompletion dkms.bash-completion bash dkms
 	vinstall dkms_framework.conf 644 etc/dkms framework.conf
 	# Kernel hooks.
-	vinstall ${FILESDIR}/kernel.d/dkms.postinst 754 etc/kernel.d/post-install 10-dkms
-	vinstall ${FILESDIR}/kernel.d/dkms.prerm 754 etc/kernel.d/pre-remove 10-dkms
+	vinstall "${FILESDIR}/kernel.d/dkms.postinst" 754 etc/kernel.d/post-install 10-dkms
+	vinstall "${FILESDIR}/kernel.d/dkms.prerm" 754 etc/kernel.d/pre-remove 10-dkms
+	vinstall "${FILESDIR}/dkms.default" 644 etc/default dkms
 }

From f81d95b4a7a4ecac0b845e8a3835cabe12d3a732 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:49:56 -0400
Subject: [PATCH 2/3] linux6.1: include files necessary for dkms on cross

---
 srcpkgs/linux6.1/template | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/srcpkgs/linux6.1/template b/srcpkgs/linux6.1/template
index e77b8b8d2ef72..d15cd00ec0196 100644
--- a/srcpkgs/linux6.1/template
+++ b/srcpkgs/linux6.1/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.1'
 pkgname=linux6.1
 version=6.1.55
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
 license="GPL-2.0-only"
@@ -169,6 +169,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -211,6 +212,11 @@ do_install() {
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
 
+	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"
+
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
 	if [ "$subarch" = "i386" ]; then
@@ -283,21 +289,6 @@ do_install() {
 			;;
 	esac
 
-	# Remove unneeded architectures
-	case "$arch" in
-		i386|x86_64) _args="arm* m* p*";;
-		arm|arm64) _args="x86* m* p*";;
-		powerpc) _args="arm* m* x86* parisc";;
-		mips) _args="arm* x86* p*";;
-	esac
-	for arch in alpha avr32 blackfin cris frv h8300 \
-		ia64 s* um v850 xtensa ${_args}; do
-		rm -rf ${hdrdest}/arch/${arch}
-	done
-	# Keep arch/x86/ras/Kconfig as it is needed by drivers/ras/Kconfig
-	mkdir -p ${hdrdest}/arch/x86/ras
-	cp -a arch/x86/ras/Kconfig ${hdrdest}/arch/x86/ras/Kconfig
-
 	# Extract debugging symbols and compress modules
 	msg_normal "$pkgver: extracting debug info and compressing modules, please wait...\n"
 	install -Dm644 vmlinux ${DESTDIR}/usr/lib/debug/boot/vmlinux-${_kernver}

From 7e1ae20fc28d299eb07bc7e4f50cea43d4bfad4f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:50:01 -0400
Subject: [PATCH 3/3] linux6.5: include files necessary for dkms on cross

---
 srcpkgs/linux6.5/template | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/linux6.5/template b/srcpkgs/linux6.5/template
index bc1c6417ec24f..c4930a6e39015 100644
--- a/srcpkgs/linux6.5/template
+++ b/srcpkgs/linux6.5/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.5'
 pkgname=linux6.5
 version=6.5.5
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="GPL-2.0-only"
@@ -176,6 +176,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -218,6 +219,11 @@ do_install() {
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
 
+	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"
+
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
 	if [ "$subarch" = "i386" ]; then

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

* Re: [PR PATCH] [Updated] cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
@ 2023-09-30  1:14 ` classabbyamp
  2023-09-30 16:46 ` Calandracas606
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: classabbyamp @ 2023-09-30  1:14 UTC (permalink / raw)
  To: ml

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

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

https://github.com/classabbyamp/void-packages dkms-cross
https://github.com/void-linux/void-packages/pull/46332

cross-built kernel/dkms improvements
- dkms: allow limiting jobs, add missing dep
    - some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`. Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms`
    - `bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross.
    - see also: https://github.com/void-linux/void-packages/pull/46152#issuecomment-1741479613
- linux6.1: include files necessary for dkms on cross
- linux6.5: include files necessary for dkms on cross

The same fix could be applied to linux6.3 and linux6.4, but with the impending zfs 2.1.13 bump (#46304), I don't see much point.

fixes #44807

#### Testing the changes
- I tested the changes in this PR: **briefly** (these fixes worked for 6.1 on rpi-kernel)

@moabeat-berlin, @r-ricci, @Calandracas606: please test

[ci skip]

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

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

From f0e57d2c82c193a214c469f45ed573375eacb26e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:40:53 -0400
Subject: [PATCH 1/4] dkms: allow limiting jobs, add missing dep

some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`.
Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms`

`bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross.
---
 srcpkgs/dkms/files/dkms.default           | 2 ++
 srcpkgs/dkms/files/kernel.d/dkms.postinst | 9 ++++++---
 srcpkgs/dkms/template                     | 9 +++++----
 3 files changed, 13 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/dkms/files/dkms.default

diff --git a/srcpkgs/dkms/files/dkms.default b/srcpkgs/dkms/files/dkms.default
new file mode 100644
index 0000000000000..60312bf9720ca
--- /dev/null
+++ b/srcpkgs/dkms/files/dkms.default
@@ -0,0 +1,2 @@
+# number of parallel jobs to use for DKMS compilation (default: $(nproc))
+#DKMS_JOBS=
diff --git a/srcpkgs/dkms/files/kernel.d/dkms.postinst b/srcpkgs/dkms/files/kernel.d/dkms.postinst
index 66d22981b5172..6e4d3b3149a5b 100644
--- a/srcpkgs/dkms/files/kernel.d/dkms.postinst
+++ b/srcpkgs/dkms/files/kernel.d/dkms.postinst
@@ -17,10 +17,13 @@ if [ ! -e /lib/modules/${VERSION}/build/include ] ; then
 	exit 0
 fi
 
+[ -r /etc/default/dkms ] && . /etc/default/dkms
+: "${DKMS_JOBS:=$(nproc)}"
+
 export IGNORE_CC_MISMATCH=1
 
 if [ ! -f /lib/modules/${VERSION}/build/scripts/basic/fixdep ] || [ ! -f /lib/modules/${VERSION}/build/scripts/mod/modpost ]; then
-	yes "" | make -j $(nproc) -C /lib/modules/${VERSION}/build prepare0
+	yes "" | make -j "${DKMS_JOBS}" -C /lib/modules/${VERSION}/build prepare0
 fi
 
 # Check available DKMS modules
@@ -68,7 +71,7 @@ while [ $# -gt 1 ]; do
 		fi
 		# Build the module
 		echo -n "Building DKMS module: ${module}-${modulever}... "
-		/usr/bin/dkms build -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
+		/usr/bin/dkms build -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
 		rval=$?
 		# If the module was skipped or failed, go to the next module.
 		if [ $rval -eq 0 ]; then
@@ -87,7 +90,7 @@ while [ $# -gt 1 ]; do
 	if [ $(echo "$status"|grep -c ": built") -eq 1 ] &&
 	   [ $(echo "$status"|grep -c ": installed") -eq 0 ]; then
 		echo -n "Installing DKMS module: ${module}-${modulever}... "
-		/usr/bin/dkms install --force -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
+		/usr/bin/dkms install --force -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
 		rval=$?
 		# If the module failed installation, go to the next module.
 		if [ $rval -eq 0 ]; then
diff --git a/srcpkgs/dkms/template b/srcpkgs/dkms/template
index 34ee6c4afabb3..eaaa5d47404d2 100644
--- a/srcpkgs/dkms/template
+++ b/srcpkgs/dkms/template
@@ -1,9 +1,9 @@
 # Template file for 'dkms'
 pkgname=dkms
 version=3.0.10
-revision=2
+revision=3
 conf_files="/etc/dkms/framework.conf"
-depends="bash kmod gcc make coreutils xbps-triggers>=0.123_1"
+depends="bash kmod gcc bc make coreutils xbps-triggers>=0.123_1"
 short_desc="Dynamic Kernel Module Support"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later"
@@ -35,6 +35,7 @@ do_install() {
 	vcompletion dkms.bash-completion bash dkms
 	vinstall dkms_framework.conf 644 etc/dkms framework.conf
 	# Kernel hooks.
-	vinstall ${FILESDIR}/kernel.d/dkms.postinst 754 etc/kernel.d/post-install 10-dkms
-	vinstall ${FILESDIR}/kernel.d/dkms.prerm 754 etc/kernel.d/pre-remove 10-dkms
+	vinstall "${FILESDIR}/kernel.d/dkms.postinst" 754 etc/kernel.d/post-install 10-dkms
+	vinstall "${FILESDIR}/kernel.d/dkms.prerm" 754 etc/kernel.d/pre-remove 10-dkms
+	vinstall "${FILESDIR}/dkms.default" 644 etc/default dkms
 }

From f81d95b4a7a4ecac0b845e8a3835cabe12d3a732 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:49:56 -0400
Subject: [PATCH 2/4] linux6.1: include files necessary for dkms on cross

---
 srcpkgs/linux6.1/template | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/srcpkgs/linux6.1/template b/srcpkgs/linux6.1/template
index e77b8b8d2ef72..d15cd00ec0196 100644
--- a/srcpkgs/linux6.1/template
+++ b/srcpkgs/linux6.1/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.1'
 pkgname=linux6.1
 version=6.1.55
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
 license="GPL-2.0-only"
@@ -169,6 +169,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -211,6 +212,11 @@ do_install() {
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
 
+	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"
+
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
 	if [ "$subarch" = "i386" ]; then
@@ -283,21 +289,6 @@ do_install() {
 			;;
 	esac
 
-	# Remove unneeded architectures
-	case "$arch" in
-		i386|x86_64) _args="arm* m* p*";;
-		arm|arm64) _args="x86* m* p*";;
-		powerpc) _args="arm* m* x86* parisc";;
-		mips) _args="arm* x86* p*";;
-	esac
-	for arch in alpha avr32 blackfin cris frv h8300 \
-		ia64 s* um v850 xtensa ${_args}; do
-		rm -rf ${hdrdest}/arch/${arch}
-	done
-	# Keep arch/x86/ras/Kconfig as it is needed by drivers/ras/Kconfig
-	mkdir -p ${hdrdest}/arch/x86/ras
-	cp -a arch/x86/ras/Kconfig ${hdrdest}/arch/x86/ras/Kconfig
-
 	# Extract debugging symbols and compress modules
 	msg_normal "$pkgver: extracting debug info and compressing modules, please wait...\n"
 	install -Dm644 vmlinux ${DESTDIR}/usr/lib/debug/boot/vmlinux-${_kernver}

From cb2928d0c36311472e4696a85e645bc925239378 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 21:12:54 -0400
Subject: [PATCH 3/4] linux6.3: include files necessary for dkms on cross

---
 srcpkgs/linux6.3/template | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/srcpkgs/linux6.3/template b/srcpkgs/linux6.3/template
index f2e373f55278d..d18ef0a337d02 100644
--- a/srcpkgs/linux6.3/template
+++ b/srcpkgs/linux6.3/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.3'
 pkgname=linux6.3
 version=6.3.13
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
 license="GPL-2.0-only"
@@ -177,6 +177,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -219,6 +220,11 @@ do_install() {
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
 
+	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"
+
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
 	if [ "$subarch" = "i386" ]; then
@@ -291,22 +297,6 @@ do_install() {
 			;;
 	esac
 
-	# Remove unneeded architectures
-	case "$arch" in
-		i386|x86_64) _args="arm* m* p*";;
-		arm|arm64) _args="x86* m* p*";;
-		powerpc) _args="arm* m* x86* parisc";;
-		mips) _args="arm* x86* p*";;
-		riscv) _args="arm* m* x86* p*";;
-	esac
-	for arch in alpha avr32 blackfin cris frv h8300 \
-		ia64 s* um v850 xtensa ${_args}; do
-		rm -rf ${hdrdest}/arch/${arch}
-	done
-	# Keep arch/x86/ras/Kconfig as it is needed by drivers/ras/Kconfig
-	mkdir -p ${hdrdest}/arch/x86/ras
-	cp -a arch/x86/ras/Kconfig ${hdrdest}/arch/x86/ras/Kconfig
-
 	# Extract debugging symbols and compress modules
 	msg_normal "$pkgver: extracting debug info and compressing modules, please wait...\n"
 	install -Dm644 vmlinux ${DESTDIR}/usr/lib/debug/boot/vmlinux-${_kernver}

From babf74c76aa8eacffad8fc8bec5de3946bab60a9 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:50:01 -0400
Subject: [PATCH 4/4] linux6.5: include files necessary for dkms on cross

---
 srcpkgs/linux6.5/template | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/linux6.5/template b/srcpkgs/linux6.5/template
index bc1c6417ec24f..c4930a6e39015 100644
--- a/srcpkgs/linux6.5/template
+++ b/srcpkgs/linux6.5/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.5'
 pkgname=linux6.5
 version=6.5.5
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="GPL-2.0-only"
@@ -176,6 +176,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -218,6 +219,11 @@ do_install() {
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
 
+	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"
+
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
 	if [ "$subarch" = "i386" ]; then

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
  2023-09-30  1:14 ` [PR PATCH] [Updated] " classabbyamp
@ 2023-09-30 16:46 ` Calandracas606
  2023-09-30 16:49 ` Calandracas606
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Calandracas606 @ 2023-09-30 16:46 UTC (permalink / raw)
  To: ml

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

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741811430

Comment:
Was able to install ddcci-dkms for a natively compiled 6.3.13_2 kernel on my aarch64-musl system

zfs dkms failing, but there's no hard errors in the /var/lib/dkms/zfs/2.1.12/build/build/build.log, although there is a warning about: modpost: "blk_register_queue" [/var/lib/dkms/zfs/2.1.12/build/build/bio_bdev_disk/bio_bdev_disk.ko] undefined.

The issue with the missing headers appears to have been resolved though



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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
  2023-09-30  1:14 ` [PR PATCH] [Updated] " classabbyamp
  2023-09-30 16:46 ` Calandracas606
@ 2023-09-30 16:49 ` Calandracas606
  2023-09-30 16:54 ` classabbyamp
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Calandracas606 @ 2023-09-30 16:49 UTC (permalink / raw)
  To: ml

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

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741811430

Comment:
Was able to install ddcci-dkms for a natively compiled 6.3.13_2 kernel on my aarch64-musl system

zfs dkms failing, but there's no hard errors in the /var/lib/dkms/zfs/2.1.12/build/build/build.log, although there is a warning

 modpost: "blk_register_queue" [/var/lib/dkms/zfs/2.1.12/build/build/bio_bdev_disk/bio_bdev_disk.ko] undefined! 

and many "Skipping BTF generation for /var/lib/dkms/zfs/2.1.12/build/build/foobar/foobar.ko due to unavailability of vmlinux"

The issue with the missing headers appears to have been resolved though



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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (2 preceding siblings ...)
  2023-09-30 16:49 ` Calandracas606
@ 2023-09-30 16:54 ` classabbyamp
  2023-09-30 16:54 ` classabbyamp
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: classabbyamp @ 2023-09-30 16:54 UTC (permalink / raw)
  To: ml

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

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741812918

Comment:
can you try `rm  /lib/modules/<version>/build/scripts/basic/fixdep` then `xbps-reconfigure -f linux6.3` to ensure that triggers one of the fail conditiond

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (3 preceding siblings ...)
  2023-09-30 16:54 ` classabbyamp
@ 2023-09-30 16:54 ` classabbyamp
  2023-09-30 17:05 ` Calandracas606
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: classabbyamp @ 2023-09-30 16:54 UTC (permalink / raw)
  To: ml

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

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741812918

Comment:
can you try `rm  /lib/modules/<version>/build/scripts/basic/fixdep` then `xbps-reconfigure -f linux6.3` to ensure that triggers one of the previous fail conditions 

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (4 preceding siblings ...)
  2023-09-30 16:54 ` classabbyamp
@ 2023-09-30 17:05 ` Calandracas606
  2023-09-30 18:21 ` moabeat-berlin
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Calandracas606 @ 2023-09-30 17:05 UTC (permalink / raw)
  To: ml

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

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741815307

Comment:
Getting error linux6.3-6.3.13_2: configuring ...
Executing post-install kernel hook: 10-dkms ...
  HOSTCC  scripts/basic/fixdep
  UPD     include/generated/compile.h
scripts/Makefile.build:41: arch/arm64/tools/Makefile: No such file or directory
make[1]: *** No rule to make target 'arch/arm64/tools/Makefile'.  Stop.
make: *** [arch/arm64/Makefile:179: archprepare] Error 2

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (5 preceding siblings ...)
  2023-09-30 17:05 ` Calandracas606
@ 2023-09-30 18:21 ` moabeat-berlin
  2023-09-30 22:30 ` moabeat-berlin
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: moabeat-berlin @ 2023-09-30 18:21 UTC (permalink / raw)
  To: ml

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

New comment by moabeat-berlin on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741830170

Comment:
I think I got something. I cross-built "linux6.1" and "linux6.5" packages for "aarch64" and "aarch64-musl" from this PR. If you would like to pull them, you can get them from `https://barrens.de/repo/`, e.g. `xbps-install -S -R https://barrens.de/repo linux6.5-headers`. linux6.3 is still running.

My findings executing `make prepare0` for both of these headers packages on "aarch64-musl" so far:

- `arch/arm64/tools/*` is missing multiple files, maybe just keep the directory entirely.
- `arch/arm64/kernel/asm-offsets.c` is required
- `include/kvm/*` is missing.

After adding them, the command succeeds. @Calandracas606, you seem to run into the same issue with 6.3.

Shouldn't actually everything in `include/*` be part of the "*-headers" packages? Excluding `include/generated` of course.

Will test dkms after that got fixed, but probably we are good after adding those files.

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (6 preceding siblings ...)
  2023-09-30 18:21 ` moabeat-berlin
@ 2023-09-30 22:30 ` moabeat-berlin
  2023-10-01  1:06 ` classabbyamp
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: moabeat-berlin @ 2023-09-30 22:30 UTC (permalink / raw)
  To: ml

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

New comment by moabeat-berlin on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741872958

Comment:
Packages for "linux6.3" are also available now. The same files are also missing there. When they have been added, dkms seems to be working fine.

<details><summary>installing dkms package "ddcci-dkms"</summary>

```
# xbps-install ddcci-dkms

Name       Action    Version           New version            Download size
ddcci-dkms install   -                 0.4.3_1                22KB 

Size to download:               22KB
Size required on disk:          82KB
Space available on disk:        24GB

Do you want to continue? [Y/n] 

[*] Downloading packages
ddcci-dkms-0.4.3_1.aarch64-musl.xbps.sig2: 512B [avg rate: 4425KB/s]
ddcci-dkms-0.4.3_1.aarch64-musl.xbps: 22KB [avg rate: 115MB/s]
ddcci-dkms-0.4.3_1: verifying RSA signature...

[*] Collecting package files
ddcci-dkms-0.4.3_1: collecting files...

[*] Unpacking packages
ddcci-dkms-0.4.3_1: unpacking ...

[*] Configuring unpacked packages
ddcci-dkms-0.4.3_1: configuring ...
Added DKMS module 'ddcci-0.4.3'.
Prepare to build modules for kernel-6.1.54_1... done.
Building DKMS module 'ddcci-0.4.3' for kernel-6.1.54_1... done.
Installing DKMS module 'ddcci-0.4.3' for kernel-6.1.54_1... done.
Skipping kernel-6.1.55_2. kernel-headers package not installed...
Prepare to build modules for kernel-6.3.13_2... done.
Building DKMS module 'ddcci-0.4.3' for kernel-6.3.13_2... done.
Installing DKMS module 'ddcci-0.4.3' for kernel-6.3.13_2... done.
ddcci-dkms-0.4.3_1: installed successfully.

1 downloaded, 1 installed, 0 updated, 1 configured, 0 removed.
```

</details> 


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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (7 preceding siblings ...)
  2023-09-30 22:30 ` moabeat-berlin
@ 2023-10-01  1:06 ` classabbyamp
  2023-10-01  1:06 ` classabbyamp
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: classabbyamp @ 2023-10-01  1:06 UTC (permalink / raw)
  To: ml

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

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741906122

Comment:
> * `include/kvm/*` is missing.

I don't think that's needed, from my testing.

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (8 preceding siblings ...)
  2023-10-01  1:06 ` classabbyamp
@ 2023-10-01  1:06 ` classabbyamp
  2023-10-01  1:59 ` [PR PATCH] [Updated] " classabbyamp
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: classabbyamp @ 2023-10-01  1:06 UTC (permalink / raw)
  To: ml

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

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741906122

Comment:
> * `include/kvm/*` is missing.

I don't think that's needed, from my testing. what needed it?

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

* Re: [PR PATCH] [Updated] cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (9 preceding siblings ...)
  2023-10-01  1:06 ` classabbyamp
@ 2023-10-01  1:59 ` classabbyamp
  2023-10-01  3:09 ` Calandracas606
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: classabbyamp @ 2023-10-01  1:59 UTC (permalink / raw)
  To: ml

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

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

https://github.com/classabbyamp/void-packages dkms-cross
https://github.com/void-linux/void-packages/pull/46332

cross-built kernel/dkms improvements
- dkms: allow limiting jobs, add missing dep
    - some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`. Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms`
    - `bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross.
    - see also: https://github.com/void-linux/void-packages/pull/46152#issuecomment-1741479613
- linux6.1: include files necessary for dkms on cross
- linux6.5: include files necessary for dkms on cross

The same fix could be applied to linux6.3 and linux6.4, but with the impending zfs 2.1.13 bump (#46304), I don't see much point.

fixes #44807

#### Testing the changes
- I tested the changes in this PR: **briefly** (these fixes worked for 6.1 on rpi-kernel)

@moabeat-berlin, @r-ricci, @Calandracas606: please test

[ci skip]

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

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

From 69544760af94682fab569d49e79b65863c43cc21 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:40:53 -0400
Subject: [PATCH 1/5] dkms: allow limiting jobs, add missing dep

some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`.
Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms`

`bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross.
---
 srcpkgs/dkms/files/dkms.default           | 2 ++
 srcpkgs/dkms/files/kernel.d/dkms.postinst | 9 ++++++---
 srcpkgs/dkms/template                     | 9 +++++----
 3 files changed, 13 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/dkms/files/dkms.default

diff --git a/srcpkgs/dkms/files/dkms.default b/srcpkgs/dkms/files/dkms.default
new file mode 100644
index 0000000000000..60312bf9720ca
--- /dev/null
+++ b/srcpkgs/dkms/files/dkms.default
@@ -0,0 +1,2 @@
+# number of parallel jobs to use for DKMS compilation (default: $(nproc))
+#DKMS_JOBS=
diff --git a/srcpkgs/dkms/files/kernel.d/dkms.postinst b/srcpkgs/dkms/files/kernel.d/dkms.postinst
index 66d22981b5172..6e4d3b3149a5b 100644
--- a/srcpkgs/dkms/files/kernel.d/dkms.postinst
+++ b/srcpkgs/dkms/files/kernel.d/dkms.postinst
@@ -17,10 +17,13 @@ if [ ! -e /lib/modules/${VERSION}/build/include ] ; then
 	exit 0
 fi
 
+[ -r /etc/default/dkms ] && . /etc/default/dkms
+: "${DKMS_JOBS:=$(nproc)}"
+
 export IGNORE_CC_MISMATCH=1
 
 if [ ! -f /lib/modules/${VERSION}/build/scripts/basic/fixdep ] || [ ! -f /lib/modules/${VERSION}/build/scripts/mod/modpost ]; then
-	yes "" | make -j $(nproc) -C /lib/modules/${VERSION}/build prepare0
+	yes "" | make -j "${DKMS_JOBS}" -C /lib/modules/${VERSION}/build prepare0
 fi
 
 # Check available DKMS modules
@@ -68,7 +71,7 @@ while [ $# -gt 1 ]; do
 		fi
 		# Build the module
 		echo -n "Building DKMS module: ${module}-${modulever}... "
-		/usr/bin/dkms build -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
+		/usr/bin/dkms build -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
 		rval=$?
 		# If the module was skipped or failed, go to the next module.
 		if [ $rval -eq 0 ]; then
@@ -87,7 +90,7 @@ while [ $# -gt 1 ]; do
 	if [ $(echo "$status"|grep -c ": built") -eq 1 ] &&
 	   [ $(echo "$status"|grep -c ": installed") -eq 0 ]; then
 		echo -n "Installing DKMS module: ${module}-${modulever}... "
-		/usr/bin/dkms install --force -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
+		/usr/bin/dkms install --force -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
 		rval=$?
 		# If the module failed installation, go to the next module.
 		if [ $rval -eq 0 ]; then
diff --git a/srcpkgs/dkms/template b/srcpkgs/dkms/template
index 34ee6c4afabb3..eaaa5d47404d2 100644
--- a/srcpkgs/dkms/template
+++ b/srcpkgs/dkms/template
@@ -1,9 +1,9 @@
 # Template file for 'dkms'
 pkgname=dkms
 version=3.0.10
-revision=2
+revision=3
 conf_files="/etc/dkms/framework.conf"
-depends="bash kmod gcc make coreutils xbps-triggers>=0.123_1"
+depends="bash kmod gcc bc make coreutils xbps-triggers>=0.123_1"
 short_desc="Dynamic Kernel Module Support"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later"
@@ -35,6 +35,7 @@ do_install() {
 	vcompletion dkms.bash-completion bash dkms
 	vinstall dkms_framework.conf 644 etc/dkms framework.conf
 	# Kernel hooks.
-	vinstall ${FILESDIR}/kernel.d/dkms.postinst 754 etc/kernel.d/post-install 10-dkms
-	vinstall ${FILESDIR}/kernel.d/dkms.prerm 754 etc/kernel.d/pre-remove 10-dkms
+	vinstall "${FILESDIR}/kernel.d/dkms.postinst" 754 etc/kernel.d/post-install 10-dkms
+	vinstall "${FILESDIR}/kernel.d/dkms.prerm" 754 etc/kernel.d/pre-remove 10-dkms
+	vinstall "${FILESDIR}/dkms.default" 644 etc/default dkms
 }

From 0969061ed031e7de11fba3968a15eb1b7bc34d5b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 30 Sep 2023 21:45:14 -0400
Subject: [PATCH 2/5] xbps-triggers: update to 0.126.

adds the ability to limit the number of makejobs to the dkms trigger
---
 srcpkgs/xbps-triggers/files/dkms | 9 ++++++---
 srcpkgs/xbps-triggers/template   | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/xbps-triggers/files/dkms b/srcpkgs/xbps-triggers/files/dkms
index ae87f3bff838b..4c5aeb4d6a28b 100755
--- a/srcpkgs/xbps-triggers/files/dkms
+++ b/srcpkgs/xbps-triggers/files/dkms
@@ -52,6 +52,9 @@ remove_modules() {
 add_modules() {
 	local rval=
 
+	[ -r /etc/default/dkms ] && . /etc/default/dkms
+	: "${DKMS_JOBS:=$(nproc)}"
+
 	# Add/build and install the specified modules for all kernels.
 	set -- ${dkms_modules}
 	while [ $# -gt 0 ]; do
@@ -77,7 +80,7 @@ add_modules() {
 		fi
 		if [ ! -f ${f}/build/scripts/basic/fixdep ] || [ ! -f ${f}/build/scripts/mod/modpost ] ; then
 			echo -n "Prepare to build modules for kernel-${_kver}... "
-			yes "" | make -j$(nproc) -C ${f}/build prepare0 > ${f}/build/make.log 2>&1
+			yes "" | make -j "$DKMS_JOBS" -C ${f}/build prepare0 > ${f}/build/make.log 2>&1
 			if [ $? -eq 0 ]; then
 				echo "done."
 			else
@@ -89,7 +92,7 @@ add_modules() {
 		set -- ${dkms_modules}
 		while [ $# -gt 0 ]; do
 			echo -n "Building DKMS module '$1-$2' for kernel-${_kver}... "
-			$DKMS build -q -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1
+			$DKMS build -j "${DKMS_JOBS}" -q -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1
 			if [ $? -eq 0 ]; then
 				echo "done."
 			else
@@ -99,7 +102,7 @@ add_modules() {
 				shift 2; continue
 			fi
 			echo -n "Installing DKMS module '$1-$2' for kernel-${_kver}... "
-			$DKMS install --force -q -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1
+			$DKMS install --force -j "${DKMS_JOBS}" -q -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1
 			if [ $? -eq 0 ]; then
 				echo "done."
 			else
diff --git a/srcpkgs/xbps-triggers/template b/srcpkgs/xbps-triggers/template
index 89cc9398c8c44..76c3a6b27fad4 100644
--- a/srcpkgs/xbps-triggers/template
+++ b/srcpkgs/xbps-triggers/template
@@ -1,6 +1,6 @@
 # Template file for 'xbps-triggers'
 pkgname=xbps-triggers
-version=0.125
+version=0.126
 revision=1
 bootstrap=yes
 short_desc="XBPS triggers for Void Linux"

From f4e72689b1ae884d3159e8983b4e717e3f75acd3 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:49:56 -0400
Subject: [PATCH 3/5] linux6.1: include files necessary for dkms on cross

---
 srcpkgs/linux6.1/template | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/srcpkgs/linux6.1/template b/srcpkgs/linux6.1/template
index e77b8b8d2ef72..9dba170e3dcdb 100644
--- a/srcpkgs/linux6.1/template
+++ b/srcpkgs/linux6.1/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.1'
 pkgname=linux6.1
 version=6.1.55
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
 license="GPL-2.0-only"
@@ -169,6 +169,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -210,6 +211,13 @@ do_install() {
 	cp -a security/selinux/include ${hdrdest}/security/selinux
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
+	if [ -d "arch/${arch}/tools" ]; then
+		cp -a "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"
 
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
@@ -222,6 +230,7 @@ do_install() {
 		cp arch/x86/kernel/asm-offsets.s ${hdrdest}/arch/x86/kernel
 	elif [ "$arch" = "arm64" ]; then
 		mkdir -p ${hdrdest}/arch/arm64/kernel
+		cp arch/arm64/kernel/asm-offsets.s ${hdrdest}/arch/arm64/kernel
 		cp -a arch/arm64/kernel/vdso ${hdrdest}/arch/arm64/kernel/
 	fi
 
@@ -283,21 +292,6 @@ do_install() {
 			;;
 	esac
 
-	# Remove unneeded architectures
-	case "$arch" in
-		i386|x86_64) _args="arm* m* p*";;
-		arm|arm64) _args="x86* m* p*";;
-		powerpc) _args="arm* m* x86* parisc";;
-		mips) _args="arm* x86* p*";;
-	esac
-	for arch in alpha avr32 blackfin cris frv h8300 \
-		ia64 s* um v850 xtensa ${_args}; do
-		rm -rf ${hdrdest}/arch/${arch}
-	done
-	# Keep arch/x86/ras/Kconfig as it is needed by drivers/ras/Kconfig
-	mkdir -p ${hdrdest}/arch/x86/ras
-	cp -a arch/x86/ras/Kconfig ${hdrdest}/arch/x86/ras/Kconfig
-
 	# Extract debugging symbols and compress modules
 	msg_normal "$pkgver: extracting debug info and compressing modules, please wait...\n"
 	install -Dm644 vmlinux ${DESTDIR}/usr/lib/debug/boot/vmlinux-${_kernver}

From d1652d2c248843e2bbf0beddd558a6d6b2dabbac Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 21:12:54 -0400
Subject: [PATCH 4/5] linux6.3: include files necessary for dkms on cross

---
 srcpkgs/linux6.3/template | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/srcpkgs/linux6.3/template b/srcpkgs/linux6.3/template
index f2e373f55278d..3208d6bdada37 100644
--- a/srcpkgs/linux6.3/template
+++ b/srcpkgs/linux6.3/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.3'
 pkgname=linux6.3
 version=6.3.13
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
 license="GPL-2.0-only"
@@ -177,6 +177,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -218,6 +219,13 @@ do_install() {
 	cp -a security/selinux/include ${hdrdest}/security/selinux
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
+	if [ -d "arch/${arch}/tools" ]; then
+		cp -a "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"
 
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
@@ -230,6 +238,7 @@ do_install() {
 		cp arch/x86/kernel/asm-offsets.s ${hdrdest}/arch/x86/kernel
 	elif [ "$arch" = "arm64" ]; then
 		mkdir -p ${hdrdest}/arch/arm64/kernel
+		cp arch/arm64/kernel/asm-offsets.s ${hdrdest}/arch/arm64/kernel
 		cp -a arch/arm64/kernel/vdso ${hdrdest}/arch/arm64/kernel/
 	fi
 
@@ -291,22 +300,6 @@ do_install() {
 			;;
 	esac
 
-	# Remove unneeded architectures
-	case "$arch" in
-		i386|x86_64) _args="arm* m* p*";;
-		arm|arm64) _args="x86* m* p*";;
-		powerpc) _args="arm* m* x86* parisc";;
-		mips) _args="arm* x86* p*";;
-		riscv) _args="arm* m* x86* p*";;
-	esac
-	for arch in alpha avr32 blackfin cris frv h8300 \
-		ia64 s* um v850 xtensa ${_args}; do
-		rm -rf ${hdrdest}/arch/${arch}
-	done
-	# Keep arch/x86/ras/Kconfig as it is needed by drivers/ras/Kconfig
-	mkdir -p ${hdrdest}/arch/x86/ras
-	cp -a arch/x86/ras/Kconfig ${hdrdest}/arch/x86/ras/Kconfig
-
 	# Extract debugging symbols and compress modules
 	msg_normal "$pkgver: extracting debug info and compressing modules, please wait...\n"
 	install -Dm644 vmlinux ${DESTDIR}/usr/lib/debug/boot/vmlinux-${_kernver}

From 551befce6830dccede697aac7a8c80e7c35ce145 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:50:01 -0400
Subject: [PATCH 5/5] linux6.5: include files necessary for dkms on cross

---
 srcpkgs/linux6.5/template | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/linux6.5/template b/srcpkgs/linux6.5/template
index bc1c6417ec24f..94c109cf8375c 100644
--- a/srcpkgs/linux6.5/template
+++ b/srcpkgs/linux6.5/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.5'
 pkgname=linux6.5
 version=6.5.5
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="GPL-2.0-only"
@@ -176,6 +176,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -217,6 +218,13 @@ do_install() {
 	cp -a security/selinux/include ${hdrdest}/security/selinux
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
+	if [ -d "arch/${arch}/tools" ]; then
+		cp -a "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"
 
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
@@ -229,6 +237,7 @@ do_install() {
 		cp arch/x86/kernel/asm-offsets.s ${hdrdest}/arch/x86/kernel
 	elif [ "$arch" = "arm64" ]; then
 		mkdir -p ${hdrdest}/arch/arm64/kernel
+		cp arch/arm64/kernel/asm-offsets.s ${hdrdest}/arch/arm64/kernel
 		cp -a arch/arm64/kernel/vdso ${hdrdest}/arch/arm64/kernel/
 	fi
 

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (10 preceding siblings ...)
  2023-10-01  1:59 ` [PR PATCH] [Updated] " classabbyamp
@ 2023-10-01  3:09 ` Calandracas606
  2023-10-01  4:40 ` [PR PATCH] [Updated] " classabbyamp
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Calandracas606 @ 2023-10-01  3:09 UTC (permalink / raw)
  To: ml

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

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741938065

Comment:
ZFS builds after changing /usr/src/zfs*/META from CCDL to GPL

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

* Re: [PR PATCH] [Updated] cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (11 preceding siblings ...)
  2023-10-01  3:09 ` Calandracas606
@ 2023-10-01  4:40 ` classabbyamp
  2023-10-01 10:02 ` moabeat-berlin
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: classabbyamp @ 2023-10-01  4:40 UTC (permalink / raw)
  To: ml

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

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

https://github.com/classabbyamp/void-packages dkms-cross
https://github.com/void-linux/void-packages/pull/46332

cross-built kernel/dkms improvements
- dkms: allow limiting jobs, add missing dep
    - some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`. Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms`
    - `bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross.
    - see also: https://github.com/void-linux/void-packages/pull/46152#issuecomment-1741479613
- linux6.1: include files necessary for dkms on cross
- linux6.5: include files necessary for dkms on cross

The same fix could be applied to linux6.3 and linux6.4, but with the impending zfs 2.1.13 bump (#46304), I don't see much point.

fixes #44807

#### Testing the changes
- I tested the changes in this PR: **briefly** (these fixes worked for 6.1 on rpi-kernel)

@moabeat-berlin, @r-ricci, @Calandracas606: please test

[ci skip]

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

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

From 418c85007867ffaf1bc90cbb8e50160ee0bf7b31 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:40:53 -0400
Subject: [PATCH 1/5] dkms: allow limiting jobs, add missing dep

some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`.
Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms`

`bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross.
---
 srcpkgs/dkms/files/dkms.default           |  2 ++
 srcpkgs/dkms/files/kernel.d/dkms.postinst |  9 ++++++---
 srcpkgs/dkms/template                     | 11 ++++++-----
 3 files changed, 14 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/dkms/files/dkms.default

diff --git a/srcpkgs/dkms/files/dkms.default b/srcpkgs/dkms/files/dkms.default
new file mode 100644
index 0000000000000..60312bf9720ca
--- /dev/null
+++ b/srcpkgs/dkms/files/dkms.default
@@ -0,0 +1,2 @@
+# number of parallel jobs to use for DKMS compilation (default: $(nproc))
+#DKMS_JOBS=
diff --git a/srcpkgs/dkms/files/kernel.d/dkms.postinst b/srcpkgs/dkms/files/kernel.d/dkms.postinst
index 66d22981b5172..6e4d3b3149a5b 100644
--- a/srcpkgs/dkms/files/kernel.d/dkms.postinst
+++ b/srcpkgs/dkms/files/kernel.d/dkms.postinst
@@ -17,10 +17,13 @@ if [ ! -e /lib/modules/${VERSION}/build/include ] ; then
 	exit 0
 fi
 
+[ -r /etc/default/dkms ] && . /etc/default/dkms
+: "${DKMS_JOBS:=$(nproc)}"
+
 export IGNORE_CC_MISMATCH=1
 
 if [ ! -f /lib/modules/${VERSION}/build/scripts/basic/fixdep ] || [ ! -f /lib/modules/${VERSION}/build/scripts/mod/modpost ]; then
-	yes "" | make -j $(nproc) -C /lib/modules/${VERSION}/build prepare0
+	yes "" | make -j "${DKMS_JOBS}" -C /lib/modules/${VERSION}/build prepare0
 fi
 
 # Check available DKMS modules
@@ -68,7 +71,7 @@ while [ $# -gt 1 ]; do
 		fi
 		# Build the module
 		echo -n "Building DKMS module: ${module}-${modulever}... "
-		/usr/bin/dkms build -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
+		/usr/bin/dkms build -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
 		rval=$?
 		# If the module was skipped or failed, go to the next module.
 		if [ $rval -eq 0 ]; then
@@ -87,7 +90,7 @@ while [ $# -gt 1 ]; do
 	if [ $(echo "$status"|grep -c ": built") -eq 1 ] &&
 	   [ $(echo "$status"|grep -c ": installed") -eq 0 ]; then
 		echo -n "Installing DKMS module: ${module}-${modulever}... "
-		/usr/bin/dkms install --force -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
+		/usr/bin/dkms install --force -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
 		rval=$?
 		# If the module failed installation, go to the next module.
 		if [ $rval -eq 0 ]; then
diff --git a/srcpkgs/dkms/template b/srcpkgs/dkms/template
index 34ee6c4afabb3..4c86485bc0102 100644
--- a/srcpkgs/dkms/template
+++ b/srcpkgs/dkms/template
@@ -1,9 +1,9 @@
 # Template file for 'dkms'
 pkgname=dkms
 version=3.0.10
-revision=2
-conf_files="/etc/dkms/framework.conf"
-depends="bash kmod gcc make coreutils xbps-triggers>=0.123_1"
+revision=3
+conf_files="/etc/dkms/framework.conf /etc/default/dkms"
+depends="bash kmod gcc bc make coreutils xbps-triggers>=0.123_1"
 short_desc="Dynamic Kernel Module Support"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later"
@@ -35,6 +35,7 @@ do_install() {
 	vcompletion dkms.bash-completion bash dkms
 	vinstall dkms_framework.conf 644 etc/dkms framework.conf
 	# Kernel hooks.
-	vinstall ${FILESDIR}/kernel.d/dkms.postinst 754 etc/kernel.d/post-install 10-dkms
-	vinstall ${FILESDIR}/kernel.d/dkms.prerm 754 etc/kernel.d/pre-remove 10-dkms
+	vinstall "${FILESDIR}/kernel.d/dkms.postinst" 754 etc/kernel.d/post-install 10-dkms
+	vinstall "${FILESDIR}/kernel.d/dkms.prerm" 754 etc/kernel.d/pre-remove 10-dkms
+	vinstall "${FILESDIR}/dkms.default" 644 etc/default dkms
 }

From aa6348a23479f21ef25cfcfb184aacc98ac72e5d Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 30 Sep 2023 21:45:14 -0400
Subject: [PATCH 2/5] xbps-triggers: update to 0.126.

adds the ability to limit the number of makejobs to the dkms trigger
---
 srcpkgs/xbps-triggers/files/dkms | 9 ++++++---
 srcpkgs/xbps-triggers/template   | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/xbps-triggers/files/dkms b/srcpkgs/xbps-triggers/files/dkms
index ae87f3bff838b..4c5aeb4d6a28b 100755
--- a/srcpkgs/xbps-triggers/files/dkms
+++ b/srcpkgs/xbps-triggers/files/dkms
@@ -52,6 +52,9 @@ remove_modules() {
 add_modules() {
 	local rval=
 
+	[ -r /etc/default/dkms ] && . /etc/default/dkms
+	: "${DKMS_JOBS:=$(nproc)}"
+
 	# Add/build and install the specified modules for all kernels.
 	set -- ${dkms_modules}
 	while [ $# -gt 0 ]; do
@@ -77,7 +80,7 @@ add_modules() {
 		fi
 		if [ ! -f ${f}/build/scripts/basic/fixdep ] || [ ! -f ${f}/build/scripts/mod/modpost ] ; then
 			echo -n "Prepare to build modules for kernel-${_kver}... "
-			yes "" | make -j$(nproc) -C ${f}/build prepare0 > ${f}/build/make.log 2>&1
+			yes "" | make -j "$DKMS_JOBS" -C ${f}/build prepare0 > ${f}/build/make.log 2>&1
 			if [ $? -eq 0 ]; then
 				echo "done."
 			else
@@ -89,7 +92,7 @@ add_modules() {
 		set -- ${dkms_modules}
 		while [ $# -gt 0 ]; do
 			echo -n "Building DKMS module '$1-$2' for kernel-${_kver}... "
-			$DKMS build -q -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1
+			$DKMS build -j "${DKMS_JOBS}" -q -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1
 			if [ $? -eq 0 ]; then
 				echo "done."
 			else
@@ -99,7 +102,7 @@ add_modules() {
 				shift 2; continue
 			fi
 			echo -n "Installing DKMS module '$1-$2' for kernel-${_kver}... "
-			$DKMS install --force -q -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1
+			$DKMS install --force -j "${DKMS_JOBS}" -q -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1
 			if [ $? -eq 0 ]; then
 				echo "done."
 			else
diff --git a/srcpkgs/xbps-triggers/template b/srcpkgs/xbps-triggers/template
index 89cc9398c8c44..76c3a6b27fad4 100644
--- a/srcpkgs/xbps-triggers/template
+++ b/srcpkgs/xbps-triggers/template
@@ -1,6 +1,6 @@
 # Template file for 'xbps-triggers'
 pkgname=xbps-triggers
-version=0.125
+version=0.126
 revision=1
 bootstrap=yes
 short_desc="XBPS triggers for Void Linux"

From d34fe076d1ed5d3c78da00cf380fd57b636dfd7d Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:49:56 -0400
Subject: [PATCH 3/5] linux6.1: include files necessary for dkms on cross

---
 srcpkgs/linux6.1/template | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/srcpkgs/linux6.1/template b/srcpkgs/linux6.1/template
index e77b8b8d2ef72..9dba170e3dcdb 100644
--- a/srcpkgs/linux6.1/template
+++ b/srcpkgs/linux6.1/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.1'
 pkgname=linux6.1
 version=6.1.55
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
 license="GPL-2.0-only"
@@ -169,6 +169,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -210,6 +211,13 @@ do_install() {
 	cp -a security/selinux/include ${hdrdest}/security/selinux
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
+	if [ -d "arch/${arch}/tools" ]; then
+		cp -a "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"
 
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
@@ -222,6 +230,7 @@ do_install() {
 		cp arch/x86/kernel/asm-offsets.s ${hdrdest}/arch/x86/kernel
 	elif [ "$arch" = "arm64" ]; then
 		mkdir -p ${hdrdest}/arch/arm64/kernel
+		cp arch/arm64/kernel/asm-offsets.s ${hdrdest}/arch/arm64/kernel
 		cp -a arch/arm64/kernel/vdso ${hdrdest}/arch/arm64/kernel/
 	fi
 
@@ -283,21 +292,6 @@ do_install() {
 			;;
 	esac
 
-	# Remove unneeded architectures
-	case "$arch" in
-		i386|x86_64) _args="arm* m* p*";;
-		arm|arm64) _args="x86* m* p*";;
-		powerpc) _args="arm* m* x86* parisc";;
-		mips) _args="arm* x86* p*";;
-	esac
-	for arch in alpha avr32 blackfin cris frv h8300 \
-		ia64 s* um v850 xtensa ${_args}; do
-		rm -rf ${hdrdest}/arch/${arch}
-	done
-	# Keep arch/x86/ras/Kconfig as it is needed by drivers/ras/Kconfig
-	mkdir -p ${hdrdest}/arch/x86/ras
-	cp -a arch/x86/ras/Kconfig ${hdrdest}/arch/x86/ras/Kconfig
-
 	# Extract debugging symbols and compress modules
 	msg_normal "$pkgver: extracting debug info and compressing modules, please wait...\n"
 	install -Dm644 vmlinux ${DESTDIR}/usr/lib/debug/boot/vmlinux-${_kernver}

From 98f48d6e55f3d831649d8da3a4fbc04734b20b18 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 21:12:54 -0400
Subject: [PATCH 4/5] linux6.3: include files necessary for dkms on cross

---
 srcpkgs/linux6.3/template | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/srcpkgs/linux6.3/template b/srcpkgs/linux6.3/template
index f2e373f55278d..3208d6bdada37 100644
--- a/srcpkgs/linux6.3/template
+++ b/srcpkgs/linux6.3/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.3'
 pkgname=linux6.3
 version=6.3.13
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
 license="GPL-2.0-only"
@@ -177,6 +177,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -218,6 +219,13 @@ do_install() {
 	cp -a security/selinux/include ${hdrdest}/security/selinux
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
+	if [ -d "arch/${arch}/tools" ]; then
+		cp -a "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"
 
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
@@ -230,6 +238,7 @@ do_install() {
 		cp arch/x86/kernel/asm-offsets.s ${hdrdest}/arch/x86/kernel
 	elif [ "$arch" = "arm64" ]; then
 		mkdir -p ${hdrdest}/arch/arm64/kernel
+		cp arch/arm64/kernel/asm-offsets.s ${hdrdest}/arch/arm64/kernel
 		cp -a arch/arm64/kernel/vdso ${hdrdest}/arch/arm64/kernel/
 	fi
 
@@ -291,22 +300,6 @@ do_install() {
 			;;
 	esac
 
-	# Remove unneeded architectures
-	case "$arch" in
-		i386|x86_64) _args="arm* m* p*";;
-		arm|arm64) _args="x86* m* p*";;
-		powerpc) _args="arm* m* x86* parisc";;
-		mips) _args="arm* x86* p*";;
-		riscv) _args="arm* m* x86* p*";;
-	esac
-	for arch in alpha avr32 blackfin cris frv h8300 \
-		ia64 s* um v850 xtensa ${_args}; do
-		rm -rf ${hdrdest}/arch/${arch}
-	done
-	# Keep arch/x86/ras/Kconfig as it is needed by drivers/ras/Kconfig
-	mkdir -p ${hdrdest}/arch/x86/ras
-	cp -a arch/x86/ras/Kconfig ${hdrdest}/arch/x86/ras/Kconfig
-
 	# Extract debugging symbols and compress modules
 	msg_normal "$pkgver: extracting debug info and compressing modules, please wait...\n"
 	install -Dm644 vmlinux ${DESTDIR}/usr/lib/debug/boot/vmlinux-${_kernver}

From d51a4c7e2a0157075116764519af672094fd4a6a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 29 Sep 2023 17:50:01 -0400
Subject: [PATCH 5/5] linux6.5: include files necessary for dkms on cross

---
 srcpkgs/linux6.5/template | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/linux6.5/template b/srcpkgs/linux6.5/template
index bc1c6417ec24f..94c109cf8375c 100644
--- a/srcpkgs/linux6.5/template
+++ b/srcpkgs/linux6.5/template
@@ -1,7 +1,7 @@
 # Template file for 'linux6.5'
 pkgname=linux6.5
 version=6.5.5
-revision=1
+revision=2
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="GPL-2.0-only"
@@ -176,6 +176,7 @@ do_install() {
 	cd ${wrksrc}
 	# 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
 	for file in $(find . -name Kconfig\*); do
@@ -217,6 +218,13 @@ do_install() {
 	cp -a security/selinux/include ${hdrdest}/security/selinux
 	mkdir -p ${hdrdest}/tools/include
 	cp -a tools/include/tools ${hdrdest}/tools/include
+	if [ -d "arch/${arch}/tools" ]; then
+		cp -a "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"
 
 	mkdir -p ${hdrdest}/arch/${arch}/kernel
 	cp arch/${arch}/Makefile ${hdrdest}/arch/${arch}
@@ -229,6 +237,7 @@ do_install() {
 		cp arch/x86/kernel/asm-offsets.s ${hdrdest}/arch/x86/kernel
 	elif [ "$arch" = "arm64" ]; then
 		mkdir -p ${hdrdest}/arch/arm64/kernel
+		cp arch/arm64/kernel/asm-offsets.s ${hdrdest}/arch/arm64/kernel
 		cp -a arch/arm64/kernel/vdso ${hdrdest}/arch/arm64/kernel/
 	fi
 

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (12 preceding siblings ...)
  2023-10-01  4:40 ` [PR PATCH] [Updated] " classabbyamp
@ 2023-10-01 10:02 ` moabeat-berlin
  2023-10-01 10:03 ` moabeat-berlin
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: moabeat-berlin @ 2023-10-01 10:02 UTC (permalink / raw)
  To: ml

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

New comment by moabeat-berlin on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1742028581

Comment:
> > * `include/kvm/*` is missing.
> 
> I don't think that's needed, from my testing. what needed it?

The difference is, I added asm-offsets.**c** but the new version of package includes asm-offsets.**s**. The .s file was not part of the original linux kernel tarball, I was using a a reference and is a generated file. Regeneration obviously requires the kvm-headers.

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (13 preceding siblings ...)
  2023-10-01 10:02 ` moabeat-berlin
@ 2023-10-01 10:03 ` moabeat-berlin
  2023-10-01 15:42 ` Calandracas606
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: moabeat-berlin @ 2023-10-01 10:03 UTC (permalink / raw)
  To: ml

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

New comment by moabeat-berlin on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1742028581

Comment:
> > * `include/kvm/*` is missing.
> 
> I don't think that's needed, from my testing. what needed it?

The difference is, I added asm-offsets.**c** but the new version of package includes asm-offsets.**s**. The .s file was not part of the original linux kernel tarball, I was using as a reference and is a generated file. Regeneration obviously requires the kvm-headers.

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (14 preceding siblings ...)
  2023-10-01 10:03 ` moabeat-berlin
@ 2023-10-01 15:42 ` Calandracas606
  2023-10-01 20:15 ` moabeat-berlin
  2023-10-01 20:21 ` [PR PATCH] [Merged]: " classabbyamp
  17 siblings, 0 replies; 19+ messages in thread
From: Calandracas606 @ 2023-10-01 15:42 UTC (permalink / raw)
  To: ml

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

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1741938065

Comment:
ZFS builds after changing /usr/src/zfs*/META from CDDL to GPL

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

* Re: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (15 preceding siblings ...)
  2023-10-01 15:42 ` Calandracas606
@ 2023-10-01 20:15 ` moabeat-berlin
  2023-10-01 20:21 ` [PR PATCH] [Merged]: " classabbyamp
  17 siblings, 0 replies; 19+ messages in thread
From: moabeat-berlin @ 2023-10-01 20:15 UTC (permalink / raw)
  To: ml

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

New comment by moabeat-berlin on void-packages repository

https://github.com/void-linux/void-packages/pull/46332#issuecomment-1742189190

Comment:
I have rebuilt the packages in this PR with the latest changes (aarch64 and aarch64-musl), source is still `https://barrens.de/repo/`. I had to remove them also from `/var/cache/xbps/` to make sure it's not the old one installed from there.

Testing dkms on "aarch64-musl" by installing "ddcci-dkms" was successful and it also respected the `/etc/default/dkms` jobs settings on the Raspberry Pi Zero 2W (using new the "xbps-triggers" package). However, installing "zfs" was still not possible (device unresponsive after some time). It did not respect the setting. It seems to use it's own mechanism of building the module and was running with `-j4` again. But I was not able to figure out yet how this exactly happens.

<details><summary>dkms ddcci-dkms install log</summary>

```
# xbps-install ddcci-dkms                                                                

Name       Action    Version           New version            Download size
ddcci-dkms install   -                 0.4.3_1                - 

Size required on disk:          82KB
Space available on disk:        27GB

Do you want to continue? [Y/n] 

[*] Verifying package integrity
ddcci-dkms-0.4.3_1: verifying RSA signature...

[*] Collecting package files
ddcci-dkms-0.4.3_1: collecting files...

[*] Unpacking packages
ddcci-dkms-0.4.3_1: unpacking ...

[*] Configuring unpacked packages
ddcci-dkms-0.4.3_1: configuring ...
Added DKMS module 'ddcci-0.4.3'.
Prepare to build modules for kernel-6.1.54_1... done.
Building DKMS module 'ddcci-0.4.3' for kernel-6.1.54_1... done.
Installing DKMS module 'ddcci-0.4.3' for kernel-6.1.54_1... done.
Prepare to build modules for kernel-6.1.55_2... done.
Building DKMS module 'ddcci-0.4.3' for kernel-6.1.55_2... done.
Installing DKMS module 'ddcci-0.4.3' for kernel-6.1.55_2... done.
Prepare to build modules for kernel-6.3.13_2... done.
Building DKMS module 'ddcci-0.4.3' for kernel-6.3.13_2... done.
Installing DKMS module 'ddcci-0.4.3' for kernel-6.3.13_2... done.
Prepare to build modules for kernel-6.5.5_2... done.
Building DKMS module 'ddcci-0.4.3' for kernel-6.5.5_2... done.
Installing DKMS module 'ddcci-0.4.3' for kernel-6.5.5_2... done.
ddcci-dkms-0.4.3_1: installed successfully.

0 downloaded, 1 installed, 0 updated, 1 configured, 0 removed.
```

</details>

<details><summary>make processes during zfs install</summary>

```
#ps -Af | grep make
root      2326  2325 13 20:13 pts/1    00:00:00 make modules -k -j4 CONFIG_MODULES=y CFLAGS_MODULE=-DCONFIG_MODULES -C /lib/modules/6.1.54_1/build M=/var/lib/dkms/zfs/2.1.12/build/build
moabeat   2543 14729  0 20:13 pts/2    00:00:00 grep make
```

</details>

So, in general probably a success, beside "zfs" on the Zero 2W.

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

* Re: [PR PATCH] [Merged]: cross-built kernel/dkms improvements
  2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
                   ` (16 preceding siblings ...)
  2023-10-01 20:15 ` moabeat-berlin
@ 2023-10-01 20:21 ` classabbyamp
  17 siblings, 0 replies; 19+ messages in thread
From: classabbyamp @ 2023-10-01 20:21 UTC (permalink / raw)
  To: ml

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

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

cross-built kernel/dkms improvements
https://github.com/void-linux/void-packages/pull/46332

Description:
- dkms: allow limiting jobs, add missing dep
    - some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`. Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms`
    - `bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross.
    - see also: https://github.com/void-linux/void-packages/pull/46152#issuecomment-1741479613
- linux6.1: include files necessary for dkms on cross
- linux6.5: include files necessary for dkms on cross

The same fix could be applied to linux6.3 and linux6.4, but with the impending zfs 2.1.13 bump (#46304), I don't see much point.

fixes #44807

#### Testing the changes
- I tested the changes in this PR: **YES** (tested in an aarch64-musl VM on 6.3 with several dkms modules)

@moabeat-berlin, @r-ricci, @Calandracas606: please test

[ci skip]

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

end of thread, other threads:[~2023-10-01 20:21 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-29 21:59 [PR PATCH] cross-built kernel/dkms improvements classabbyamp
2023-09-30  1:14 ` [PR PATCH] [Updated] " classabbyamp
2023-09-30 16:46 ` Calandracas606
2023-09-30 16:49 ` Calandracas606
2023-09-30 16:54 ` classabbyamp
2023-09-30 16:54 ` classabbyamp
2023-09-30 17:05 ` Calandracas606
2023-09-30 18:21 ` moabeat-berlin
2023-09-30 22:30 ` moabeat-berlin
2023-10-01  1:06 ` classabbyamp
2023-10-01  1:06 ` classabbyamp
2023-10-01  1:59 ` [PR PATCH] [Updated] " classabbyamp
2023-10-01  3:09 ` Calandracas606
2023-10-01  4:40 ` [PR PATCH] [Updated] " classabbyamp
2023-10-01 10:02 ` moabeat-berlin
2023-10-01 10:03 ` moabeat-berlin
2023-10-01 15:42 ` Calandracas606
2023-10-01 20:15 ` moabeat-berlin
2023-10-01 20:21 ` [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).