Skip to content
Merged
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
19 changes: 15 additions & 4 deletions dkms.in
Original file line number Diff line number Diff line change
Expand Up @@ -1036,10 +1036,21 @@ prepare_build()
$"Check $build_dir for more information."
done

if [[ -e $kernel_source_dir/.config ]]; then
cc=$(sed -n 's|^CONFIG_CC_VERSION_TEXT="\([^ ]*\) .*"|\1|p' $kernel_source_dir/.config)
if command -v "$cc" >/dev/null; then
export CC="$cc"
if [[ -e "${kernel_config}" ]]; then
if grep -q 'CONFIG_CC_IS_CLANG=y' "${kernel_config}"; then
local cc=clang
if command -v "$cc" >/dev/null; then
export CC="$cc"
export KERNEL_CC="$cc"
fi
fi

if grep -q 'CONFIG_LD_IS_LLD=y' "${kernel_config}"; then
local ld=ld.lld
if command -v "$ld" >/dev/null; then
export LD="$ld"
export KERNEL_LD="$ld"
fi
fi
fi

Expand Down