Skript fr Code Generierung angepasst so dass die explizite Definition der Variablen im c File steht und im Header File die Deklaration fr externes
This commit is contained in:
parent
bbf48681e0
commit
04f29d2e03
@ -1,19 +1,32 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||||
|
|
||||||
SRCS_H="$SCRIPTPATH""/headers"
|
SRCS_H="$SCRIPTPATH""/headers"
|
||||||
|
|
||||||
|
SGENS="$SCRIPTPATH""/5y563n.c"
|
||||||
SGENH="$SRCS_H""/5y563n.h"
|
SGENH="$SRCS_H""/5y563n.h"
|
||||||
|
|
||||||
smap="/boot/System.map-$(uname -r)"
|
smap="/boot/System.map-$(uname -r)"
|
||||||
|
|
||||||
|
echo -e '#include "5y563n.h"' > "$SGENS"
|
||||||
|
|
||||||
echo -e "#pragma once" > "$SGENH"
|
echo -e "#pragma once" > "$SGENH"
|
||||||
echo -e "#include <linux/fs.h>" >> "$SGENH"
|
echo -e "#include <linux/fs.h>" >> "$SGENH"
|
||||||
|
|
||||||
|
|
||||||
symbline=$(cat $smap | grep '\Wsys_call_table$')
|
symbline=$(cat $smap | grep '\Wsys_call_table$')
|
||||||
set $symbline
|
set $symbline
|
||||||
|
|
||||||
[ -z "$symbline" ] && echo "No SysCall Table Value from System.map found" && exit 2;
|
[ -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$')
|
procline=$(cat $smap | grep '\Wproc_modules_operations$')
|
||||||
set $procline
|
set $procline
|
||||||
|
|
||||||
echo -e "struct file_operations* proc_modules_operations = (struct file_operations*)0x$1;" >> "$SGENH"
|
echo -e "extern struct file_operations* proc_modules_operations;">> "$SGENH"
|
||||||
|
|
||||||
|
echo -e "struct file_operations* proc_modules_operations = (struct file_operations*)0x$1;" >> "$SGENS"
|
Loading…
Reference in New Issue
Block a user