]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - scripts/adjust_autoksyms.sh
Merge branch 'for-linus-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/ibft
[linux.git] / scripts / adjust_autoksyms.sh
index 84bf6b500815a9ed930e99385dc77c3c60adabf9..a904bf1f5e67e7e1d7197e5e16c970bf0f211d53 100755 (executable)
@@ -1,17 +1,14 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-only
 
 # Script to create/update include/generated/autoksyms.h and dependency files
 #
 # Copyright:   (C) 2016  Linaro Limited
 # Created by:  Nicolas Pitre, January 2016
 #
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
 
 # Create/update the include/generated/autoksyms.h file from the list
-# of all module's needed symbols as recorded on the third line of
-# .tmp_versions/*.mod files.
+# of all module's needed symbols as recorded on the second line of *.mod files.
 #
 # For each symbol being added or removed, the corresponding dependency
 # file's timestamp is updated to force a rebuild of the affected source
@@ -49,13 +46,10 @@ cat > "$new_ksyms_file" << EOT
  */
 
 EOT
-[ "$(ls -A "$MODVERDIR")" ] &&
-for mod in "$MODVERDIR"/*.mod; do
-       sed -n -e '3{s/ /\n/g;/^$/!p;}' "$mod"
-done | sort -u |
-while read sym; do
-       echo "#define __KSYM_${sym} 1"
-done >> "$new_ksyms_file"
+sed 's/ko$/mod/' modules.order |
+xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- |
+sort -u |
+sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file"
 
 # Special case for modversions (see modpost.c)
 if [ -n "$CONFIG_MODVERSIONS" ]; then