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 <jwkozac...@gmail.com>
---
 scripts/generate_version_script.sh | 34 ++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100755 scripts/generate_version_script.sh

diff --git a/scripts/generate_version_script.sh 
b/scripts/generate_version_script.sh
new file mode 100755
index 00000000..80223372
--- /dev/null
+++ b/scripts/generate_version_script.sh
@@ -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/$MACHINE/*.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
-- 
2.31.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20211206192439.413545-1-jwkozaczuk%40gmail.com.

Reply via email to