From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master

scripts: add new generate_version_script.sh

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]>

---
diff --git a/scripts/generate_version_script.sh 
b/scripts/generate_version_script.sh
--- a/scripts/generate_version_script.sh
+++ 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/$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

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000c4642f05d2ff0523%40google.com.

Reply via email to