Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cross-built kernel/dkms improvements #46332

Merged
merged 5 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions srcpkgs/dkms/files/dkms.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# number of parallel jobs to use for DKMS compilation (default: $(nproc))
#DKMS_JOBS=
9 changes: 6 additions & 3 deletions srcpkgs/dkms/files/kernel.d/dkms.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions srcpkgs/dkms/template
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
license="GPL-2.0-or-later"
Expand Down Expand Up @@ -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
}
26 changes: 10 additions & 16 deletions srcpkgs/linux6.1/template
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
license="GPL-2.0-only"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand All @@ -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

Expand Down Expand Up @@ -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}
Expand Down
27 changes: 10 additions & 17 deletions srcpkgs/linux6.3/template
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
license="GPL-2.0-only"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand All @@ -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

Expand Down Expand Up @@ -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}
Expand Down
11 changes: 10 additions & 1 deletion srcpkgs/linux6.5/template
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
license="GPL-2.0-only"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand All @@ -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

Expand Down
9 changes: 6 additions & 3 deletions srcpkgs/xbps-triggers/files/dkms
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion srcpkgs/xbps-triggers/template
Original file line number Diff line number Diff line change
@@ -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"
Expand Down