From 04f29d2e032aa255c33a54e669d7151d5228b587 Mon Sep 17 00:00:00 2001 From: Valentin Lechner Date: Sun, 8 Dec 2019 12:00:46 +0100 Subject: [PATCH] Skript fr Code Generierung angepasst so dass die explizite Definition der Variablen im c File steht und im Header File die Deklaration fr externes --- src/cr3473_5y563n.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/cr3473_5y563n.sh b/src/cr3473_5y563n.sh index 17d133d..1a1f56c 100755 --- a/src/cr3473_5y563n.sh +++ b/src/cr3473_5y563n.sh @@ -1,19 +1,32 @@ #!/usr/bin/env bash + SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" + SRCS_H="$SCRIPTPATH""/headers" + +SGENS="$SCRIPTPATH""/5y563n.c" SGENH="$SRCS_H""/5y563n.h" smap="/boot/System.map-$(uname -r)" +echo -e '#include "5y563n.h"' > "$SGENS" + echo -e "#pragma once" > "$SGENH" echo -e "#include " >> "$SGENH" + symbline=$(cat $smap | grep '\Wsys_call_table$') set $symbline + [ -z "$symbline" ] && echo "No SysCall Table Value from System.map found" && exit 2; -echo -e "void** sys_call_table = (void**)0x$1;" >> "$SGENH" + +echo -e "extern void** sys_call_table;" >> "$SGENH" + +echo -e "void** sys_call_table = (void**)0x$1;" >> "$SGENS" procline=$(cat $smap | grep '\Wproc_modules_operations$') set $procline -echo -e "struct file_operations* proc_modules_operations = (struct file_operations*)0x$1;" >> "$SGENH" \ No newline at end of file +echo -e "extern struct file_operations* proc_modules_operations;">> "$SGENH" + +echo -e "struct file_operations* proc_modules_operations = (struct file_operations*)0x$1;" >> "$SGENS" \ No newline at end of file