update to 3.0.12

This commit is contained in:
yaqiangchen 2023-10-23 17:50:41 +08:00
parent 965ef6e93d
commit 5cde8124fa
5 changed files with 19 additions and 119 deletions

View File

@ -1,59 +0,0 @@
From cfe6363124a0d0495727c6f4e8a1809b295a8cbf Mon Sep 17 00:00:00 2001
From: liyunfei <liyunfei33@huawei.com>
Date: Wed, 13 Sep 2023 10:05:33 +0800
Subject: [PATCH] Support CC=clang and LD=ld.lld When building the Linux
kernel, one may use `make LLVM=1` to set multiple flags, akin to `make
CC=clang LD=ld.lld NM=llvm-nm ...` (see the link below for kernel docs
explaining this further in detail).
When building kernel modules, to ensure we're using the same toolchain
as the underlying core kernel image, Kbuild will error if it's reinvoked
with a toolchain that differs. This causes DKMS to fail, since it's not
re-specifying the same compiler (or linker, etc).
Check the .comment section of the vmlinux file in the Linux kernel
source dir, and set CC= and LD= flags for make based on that.
If vmlinux does not exist, grep .config for CONFIG_CC_IS_CLANG=y and
CONFIG_LD_IS_LLD=y.
Fixes: #124
Fixes: ClangBuiltLinux/linux#1104
Link: https://docs.kernel.org/kbuild/llvm.html
Suggested-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
---
dkms | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/dkms b/dkms
index c4b9a26..983aefc 100755
--- a/dkms
+++ b/dkms
@@ -699,6 +699,23 @@ read_conf()
[[ ${MODULES_CONF[$index]} ]] && modules_conf_array[$index]="${MODULES_CONF[$index]}"
done
+ # Check if clang was used to compile or lld was used to link the kernel.
+ if [[ -e $kernel_source_dir/vmlinux ]]; then
+ if readelf -p .comment $kernel_source_dir/vmlinux | grep -q clang; then
+ make_command="${make_command} CC=clang"
+ fi
+ if readelf -p .comment $kernel_source_dir/vmlinux | grep -q LLD; then
+ make_command="${make_command} LD=ld.lld"
+ fi
+ elif [[ -e $kernel_source_dir/.config ]]; then
+ if grep -q CONFIG_CC_IS_CLANG=y $kernel_source_dir/.config; then
+ make_command="${make_command} CC=clang"
+ fi
+ if grep -q CONFIG_LD_IS_LLD=y $kernel_source_dir/.config; then
+ make_command="${make_command} LD=ld.lld"
+ fi
+ fi
+
# Set patch_array (including kernel specific patches)
count=0
for ((index=0; index < ${#PATCH[@]}; index++)); do
--
2.27.0

View File

@ -1,46 +0,0 @@
From 25077200289dfdc37c0e86ec4c86e4932137088e Mon Sep 17 00:00:00 2001
From: Morten Linderud <morten@linderud.pw>
Date: Sat, 10 Sep 2022 15:01:15 +0200
Subject: [PATCH] dkms: Change deprecated egrep for grep -E
New versions of grep is going to issue a warning when `egrep` is used.
egrep: warning: egrep is obsolescent; using grep -E
This changes the invocation to `grep -E`
Signed-off-by: Morten Linderud <morten@linderud.pw>
---
dkms | 2 +-
dkms.8 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dkms b/dkms
index be00118..c4b9a26 100644
--- a/dkms
+++ b/dkms
@@ -1900,7 +1900,7 @@ remove_module()
done
# Delete the $module_version part of the tree if no other $module_version/$kernel_version dirs exist
- if ! find $dkms_tree/$module/$module_version/* -maxdepth 0 -type d 2>/dev/null | egrep -qv "(build|tarball|driver_disk|rpm|deb|source)$"; then
+ if ! find $dkms_tree/$module/$module_version/* -maxdepth 0 -type d 2>/dev/null | grep -Eqv "(build|tarball|driver_disk|rpm|deb|source)$"; then
echo $""
echo $"------------------------------"
echo $"Deleting module version: $module_version"
diff --git a/dkms.8 b/dkms.8
index 75b30de..86df63b 100644
--- a/dkms.8
+++ b/dkms.8
@@ -609,7 +609,7 @@ should be put into
.B MAKE[0].
Other entries in the MAKE array will only be used if their corresponding entry in
.B MAKE_MATCH[#]
-matches, as a regular expression (using egrep), the kernel that the module is being built for.
+matches, as a regular expression (using grep -E), the kernel that the module is being built for.
Note that if no value is placed in
.B MAKE_MATCH[#]
for any
--
2.27.0

Binary file not shown.

BIN
dkms-3.0.12.tar.gz Normal file

Binary file not shown.

View File

@ -1,14 +1,12 @@
Summary: Dynamic Kernel Module Support Framework
Name: dkms
Version: 2.6.1
Release: 8
Version: 3.0.12
Release: 1
License: GPLv2+
BuildArch: noarch
URL: https://github.com/dell/dkms
Source0: https://github.com/dell/dkms/archive/v%{version}.tar.gz#/dkms-%{version}.tar.gz
# because Mandriva calls this package dkms-minimal
Patch0: change-deprecated-egrep-for-grep-E.patch
Patch1: Support-CC-clang-and-LD-ld.lld.patch
Provides: dkms-minimal = %{version}
Requires: coreutils
Requires: cpio
@ -29,6 +27,7 @@ Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires: kernel-devel
Recommends: openssl
%description
This package contains the framework for the Dynamic Kernel Module Support (DKMS)
@ -90,13 +89,13 @@ echo ""
%install
rm -rf $RPM_BUILD_ROOT
make install-redhat-systemd DESTDIR=$RPM_BUILD_ROOT \
SBIN=$RPM_BUILD_ROOT%{_sbindir} \
VAR=$RPM_BUILD_ROOT%{_localstatedir}/lib/%{name} \
MAN=$RPM_BUILD_ROOT%{_mandir}/man8 \
ETC=$RPM_BUILD_ROOT%{_sysconfdir}/%{name} \
BASHDIR=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d \
LIBDIR=$RPM_BUILD_ROOT%{_prefix}/lib/%{name}
make install-redhat DESTDIR=%{buildroot}
# Move 40-dkms.install to read only area (no configuration file):
mkdir -p %{buildroot}%{_prefix}/lib/kernel/
mv %{buildroot}%{_sysconfdir}/kernel/install.d %{buildroot}%{_prefix}/lib/kernel/
sed -i -e 's/# modprobe_on_install="true"/modprobe_on_install="true"/g' %{buildroot}%{_sysconfdir}/%{name}/framework.conf
%clean
rm -rf $RPM_BUILD_ROOT
@ -117,19 +116,25 @@ fi
%files
%defattr(-,root,root)
%doc sample.spec sample.conf AUTHORS COPYING README.md
%doc COPYING README.md images
%{_unitdir}/%{name}.service
%{_prefix}/lib/%{name}
%{_prefix}/lib/kernel/install.d/40-%{name}.install
%{_mandir}/*/*
%{_sbindir}/%{name}
%{_localstatedir}/lib/%{name}
%config(noreplace) %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/framework.conf
%dir %{_sysconfdir}/%{name}/framework.conf.d
# these dirs are for plugins - owned by other packages
%{_sysconfdir}/kernel/postinst.d/%{name}
%{_sysconfdir}/kernel/prerm.d/%{name}
%{_sysconfdir}/bash_completion.d/%{name}
%{_datadir}/bash-completion/completions/%{name}
%changelog
* Fri Oct 20 2023 chenyaqiang <chengyaqiang@huawei.com> - 3.0.12-1
- update to 3.0.12
* Tue Sep 19 2023 liyunfei <liyunfei@huawei.com> - 2.6.1-8
- Add clang compile support