Github messages for voidlinux
 help / color / mirror / Atom feed
From: classabbyamp <classabbyamp@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] cross-built kernel/dkms improvements
Date: Fri, 29 Sep 2023 23:59:00 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-46332@inbox.vuxu.org> (raw)

[-- 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

             reply	other threads:[~2023-09-29 21:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-29 21:59 classabbyamp [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-46332@inbox.vuxu.org \
    --to=classabbyamp@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).