Newer
Older
linux_kernel_hacking / 2_MemoryLoading / 2.0_no_arguments / Makefile
@Harvey Phillips Harvey Phillips on 14 Jun 2020 368 bytes replace example with sed
kmod_name = example

all:
	echo "#include <linux/module.h>" > tmp.c
	echo "#include <syscall.h>" >> tmp.c
	echo "#include <stdio.h>" >> tmp.c
	echo "" >> tmp.c
	xxd -i $(kmod_name).ko >> tmp.c
	echo "const char args[] = \"\\\0\";" >> tmp.c
	echo "" >> tmp.c
	cat stub.c >> tmp.c
	cat tmp.c | sed 's/example_ko/$(kmod_name)_ko/g' > load.c
	rm tmp.c
	gcc -o load load.c