Home Home > GIT Browse > packaging
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2019-07-22 16:43:10 +0200
committerMichal Kubecek <mkubecek@suse.cz>2019-07-22 16:43:10 +0200
commitc32f8e7cf74362478dea82c747bdc6d83f5853ae (patch)
tree957cc7feaee07e0dc4cf740ed561932a7f65def0
parenteb88df3a58828b4134cd192cafdec32319197945 (diff)
rpm/klp-symbols: update to work with kernel >= 5.3
Since mainline commit b7dca6dd1e59 ("kbuild: create *.mod with full directory path and remove MODVERDIR") in v5.3-rc1, *.mod files are created in the build tree rather than in a single directory .tmp_versions ($MODVERDIR). They also do not provide path to the *.ko module file on their first line as the path is the same (except for the suffix). Update klp-symbols script to handle this new layout and format of *.mod files to fix build of 5.3-rc1 and newer kernel. Note: this is a quick band-aid to fix master branch build without risk of breaking any other branch. A more proper cleanup will follow.
-rwxr-xr-xrpm/klp-symbols18
1 files changed, 14 insertions, 4 deletions
diff --git a/rpm/klp-symbols b/rpm/klp-symbols
index c108030a9e..07580f8170 100755
--- a/rpm/klp-symbols
+++ b/rpm/klp-symbols
@@ -30,8 +30,13 @@ if ! test -f "$VMLINUX" ; then
fi
if ! test -d "$MODVER_DIR" ; then
- echo "Error: Directory does not exist: $MODVER_DIR" >&2
- exit 1
+ # kernel >= 5.3 has *.mod in the build tree
+ mod_cnt=$(find "$KERNEL_BUILD_DIR" -name '*.mod' | wc -l)
+ if [ $mod_cnt -eq 0 ]; then
+ echo "Error: Directory does not exist: $MODVER_DIR" >&2
+ exit 1
+ fi
+ MODVER_DIR="$KERNEL_BUILD_DIR"
fi
get_symbols()
@@ -44,8 +49,13 @@ echo "*vmlinux" >> "$KLP_SYMBOLS"
get_symbols "$VMLINUX" >> "$KLP_SYMBOLS"
find "$MODVER_DIR" -iname '*.mod' | while read KMOD ; do
- # read .ko path and file from .mod file
- KO_FILE="$(head -n1 $KMOD)"
+ if [ "$MODVER_DIR" = "$KERNEL_BUILD_DIR" ]; then
+ # kernel >= 5.3, just replace the suffix
+ KO_FILE="${KMOD%.mod}.ko"
+ else
+ # kernel <= 5.2, read .ko path and file from .mod file
+ KO_FILE="$(head -n1 $KMOD)"
+ fi
# obtain module name and its object file by processing .ko file name
NO_SUFFIX="$(basename -s .ko $KO_FILE)"