Skip to content

Commit

Permalink
scripts: add new generate_version_script.sh
Browse files Browse the repository at this point in the history
This patch adds new script that generates version script
based on the symbol files from exported_symbols/<arch>/*.symbols

Comparing to the 1st version, this one will work when building both
x64 and aarch64 versions of kernel.

Signed-off-by: Waldemar Kozaczuk <[email protected]>
  • Loading branch information
wkozaczuk committed Dec 13, 2021
1 parent 6e718b8 commit dee5a70
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions scripts/generate_version_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

MACHINE=$(uname -m)
if [ "${MACHINE}" == "x86_64" ]; then
ARCH="x64"
else
ARCH="aarch64"
fi

VERSION_SCRIPT_FILE=$1

VERSION_SCRIPT_START=$(cat <<"EOF"
{
global:
EOF
)

VERSION_SCRIPT_END=$(cat <<"EOF"
local:
*;
};
EOF
)

echo "$VERSION_SCRIPT_START" > $VERSION_SCRIPT_FILE

for file in exported_symbols/$ARCH/*.symbols
do
file_name=$(basename $file)
echo "/*------- $file_name */" >> $VERSION_SCRIPT_FILE
cat $file | awk '// { printf(" %s;\n", $0) }' >> $VERSION_SCRIPT_FILE
done

echo "$VERSION_SCRIPT_END" >> $VERSION_SCRIPT_FILE

0 comments on commit dee5a70

Please sign in to comment.