diff --git a/Makefile b/Makefile index eb9aa7fad..101879000 100755 --- a/Makefile +++ b/Makefile @@ -87,17 +87,17 @@ else endif trace: -ifeq ($(OPT), clean) - @make $(MAKE_FLAGS) -C Platform/build -f module.trace.api.Makefile cleanall MAKE_TARGET=trace-api - @make $(MAKE_FLAGS) -C Platform/build -f module.trace.relay.Makefile cleanall MAKE_TARGET=trace-relay - @make $(MAKE_FLAGS) -C Platform/build -f module.trace.test.Makefile cleanall MAKE_TARGET=trace-test +ifeq ($(OPT), clean) + $(MLOG)make $(MAKE_FLAGS) -C Platform/build -f module.trace_relay.Makefile cleanall MLOG=$(MLOG) MAKE_TARGET=trace-relay + $(MLOG)make $(MAKE_FLAGS) -C Platform/build -f user.trace.api.Makefile cleanall MLOG=$(MLOG) MAKE_TARGET=trace-api + $(MLOG)make $(MAKE_FLAGS) -C Platform/build -f user.trace.test.Makefile cleanall MLOG=$(MLOG) MAKE_TARGET=trace-test else ifeq ($(OPT), install) - @make $(MAKE_FLAGS) -C Platform/build -f module.trace.api.Makefile install DIR=$(DIR) MAKE_TARGET=trace-api - @make $(MAKE_FLAGS) -C Platform/build -f module.trace.relay.Makefile install DIR=$(DIR) MAKE_TARGET=trace-relay - @make $(MAKE_FLAGS) -C Platform/build -f module.trace.test.Makefile install DIR=$(DIR) MAKE_TARGET=trace-test + $(MLOG)make $(MAKE_FLAGS) -C Platform/build -f module.trace_relay.Makefile install DIR=$(DIR) MLOG=$(MLOG) MAKE_TARGET=trace-relay + $(MLOG)make $(MAKE_FLAGS) -C Platform/build -f user.trace.api.Makefile install DIR=$(DIR) MLOG=$(MLOG) MAKE_TARGET=trace-api + $(MLOG)make $(MAKE_FLAGS) -C Platform/build -f user.trace.test.Makefile install DIR=$(DIR) MLOG=$(MLOG) MAKE_TARGET=trace-test else - @make all $(MAKE_FLAGS) -C Platform/build -f module.trace.api.Makefile DISABLE_WARRING=$(DIS_BUILD_WARRING) MAKE_TARGET=trace-api - @make all $(MAKE_FLAGS) -C Platform/build -f module.trace.relay.Makefile DISABLE_WARRING=$(DIS_BUILD_WARRING) MAKE_TARGET=trace-relay - @make all $(MAKE_FLAGS) -C Platform/build -f module.trace.test.Makefile DISABLE_WARRING=$(DIS_BUILD_WARRING) MAKE_TARGET=trace-test + $(MLOG)make all $(MAKE_FLAGS) -C Platform/build -f module.trace_relay.Makefile MLOG=$(MLOG) DISABLE_WARRING=$(DIS_BUILD_WARRING) MAKE_TARGET=trace-relay + $(MLOG)make all $(MAKE_FLAGS) -C Platform/build -f user.trace.api.Makefile MLOG=$(MLOG) DISABLE_WARRING=$(DIS_BUILD_WARRING) MAKE_TARGET=trace-api + $(MLOG)make all $(MAKE_FLAGS) -C Platform/build -f user.trace.test.Makefile MLOG=$(MLOG) DISABLE_WARRING=$(DIS_BUILD_WARRING) MAKE_TARGET=trace-test endif diff --git a/Platform/build/module.trace.api.Makefile b/Platform/build/module.trace.api.Makefile deleted file mode 100755 index f2f6cf2d8..000000000 --- a/Platform/build/module.trace.api.Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# target name, the target name must have the same name of c source file -TARGET_NAME=libtrace-api - -# target -# for linux module driver: KO -# for application: EXE -# for dynamic library: DLL -TARGET_TYPE = DLL - -# target object -# for application: APP -# for device driver: DRV -TARGET_OBJ = APP - -# custom install dir -TARGET_BOX = - -#debug mode or release mode -DEBUG = TRUE - -PLAT_LINUX ?= TRUE -PLAT_ARM64 ?= TRUE - -VPATH = ../trace/trace-api - -# source code - -# set the source file, don't used .o because of ... - -COMMON_SRCS = trace_api.c - -# MRS Board Source Files -PLAT_LINUX_SRCS = $(COMMON_SRCS) -PLAT_ARM64_SRCS = $(COMMON_SRCS) - -# gcc CFLAGS -PLAT_ARM64_CFLAGS := -I../ -I/data/NetAccessControl/Platform/trace -I../../Common -I/data/NetAccessControl/Platform/modules/netlink_api/app_u/lib -PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS) - - -PLAT_ARM64_LDFLAGS := -fPIC -shared -PLAT_LINUX_LDFLAGS := $(PLAT_ARM64_LDFLAGS) - - -#gcc libs -ARM64_LIBS := -lpthread -L/data/NetAccessControl/Platform/modules/netlink_api/app_u/lib -lnetlinku -LINUX_LIBS := $(ARM64_LIBS) - - -# this line must be at below of thus, because of... -include ../../Common/common.Makefile - -ifeq ($(MAKECMDGOALS), ) -$(shell find ./ -name "$(TARGET)-*.ko" -delete) -else -ifeq ($(MAKECMDGOALS), all) -$(shell find ./ -name "$(TARGET)-*.ko" -delete) -endif -endif - diff --git a/Platform/build/module.trace.relay.Makefile b/Platform/build/module.trace.relay.Makefile deleted file mode 100755 index 5cc944102..000000000 --- a/Platform/build/module.trace.relay.Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# target name, the target name must have the same name of c source file -TARGET_NAME=trace_relay - -# target -# for linux module driver: KO -# for application: EXE -# for dynamic library: DLL -TARGET_TYPE = KO - -# target object -# for application: APP -# for device driver: DRV -TARGET_OBJ = DRV - -# custom install dir -TARGET_BOX = - -#debug mode or release mode -DEBUG = TRUE - -PLAT_LINUX ?= TRUE -PLAT_ARM64 ?= TRUE - -VPATH = ../trace/trace-relay - -# source code - -# set the source file, don't used .o because of ... - -COMMON_SRCS = trace_init.c trace.mod.c - -# MRS Board Source Files -PLAT_LINUX_SRCS = $(COMMON_SRCS) -PLAT_ARM64_SRCS = $(COMMON_SRCS) - -# gcc CFLAGS -PLAT_ARM64_CFLAGS := -I../ -I/data/NetAccessControl/Platform/trace -I../../Common -I/data/NetAccessControl/Platform/modules/netlink_api/app_k/ -fPIC -PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS) - -# this line must be at below of thus, because of... -include ../../Common/common.Makefile - -ifeq ($(MAKECMDGOALS), ) -$(shell find ./ -name "$(TARGET)-*.ko" -delete) -else -ifeq ($(MAKECMDGOALS), all) -$(shell find ./ -name "$(TARGET)-*.ko" -delete) -endif -endif - diff --git a/Platform/build/module.trace.test.Makefile b/Platform/build/module.trace.test.Makefile deleted file mode 100755 index 574a7bf83..000000000 --- a/Platform/build/module.trace.test.Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# target name, the target name must have the same name of c source file -TARGET_NAME=test-trace - -# target -# for linux module driver: KO -# for application: EXE -# for dynamic library: DLL -TARGET_TYPE = EXE - -# target object -# for application: APP -# for device driver: DRV -TARGET_OBJ = APP - -# custom install dir -TARGET_BOX = - -#debug mode or release mode -DEBUG = TRUE - -PLAT_LINUX ?= TRUE -PLAT_ARM64 ?= TRUE - -VPATH = ../trace/trace-api - -# source code - -# set the source file, don't used .o because of ... - -COMMON_SRCS = test_client_main.c - -# MRS Board Source Files -PLAT_LINUX_SRCS = $(COMMON_SRCS) -PLAT_ARM64_SRCS = $(COMMON_SRCS) - -# gcc CFLAGS -PLAT_ARM64_CFLAGS := -I../ -I/data/NetAccessControl/Platform/trace -I../../Common -PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS) - -# gcc libs -TRACE_LDFLAGS := -L/data/NetAccessControl/Platform/build/debug -PLAT_ARM64_LDFLAGS := $(TRACE_LDFLAGS) -ltrace-api-arm64 -#PLAT_LINUX_LDFLAGS := $(TRACE_LDFLAGS) -ltrace-api-linux -PLAT_LINUX_LDFLAGS := $(TRACE_LDFLAGS) -L/root -lxx - -ARM64_LIBS := -LINUX_LIBS := - -ifeq ($(PLAT_ARM64), TRUE) -DEPEND_LIBS += ./debug/$(ARM64_LIBS) -USER_CLEAN_ITEMS += ./$(ARM64_LIBS) -endif - -ifeq ($(PLAT_LINUX), TRUE) -DEPEND_LIBS += ./debug/$(LINUX_LIBS) -USER_CLEAN_ITEMS += ./$(LINUX_LIBS) -endif - - -# this line must be at below of thus, because of... -include ../../Common/common.Makefile - -ifeq ($(MAKECMDGOALS), ) -$(shell find ./ -name "$(TARGET)-*.ko" -delete) -else -ifeq ($(MAKECMDGOALS), all) -$(shell find ./ -name "$(TARGET)-*.ko" -delete) -endif -endif - diff --git a/Platform/build/user.cfg2kernel.Makefile b/Platform/build/user.cfg2kernel.Makefile index 257576ac7..5767cbb74 100755 --- a/Platform/build/user.cfg2kernel.Makefile +++ b/Platform/build/user.cfg2kernel.Makefile @@ -41,8 +41,8 @@ PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS) PLAT_ARM64_LDFLAGS := PLAT_LINUX_LDFLAGS := $(PLAT_ARM64_LDFLAGS) -ARM64_LIBS := libnetlinku-arm64.so -LINUX_LIBS := libnetlinku-linux.so +ARM64_LIBS := ./libnetlinku-arm64.so +LINUX_LIBS := ./libnetlinku-linux.so diff --git a/Platform/build/user.pdeliv_u.Makefile b/Platform/build/user.pdeliv_u.Makefile index 5bff72609..3429df4d4 100755 --- a/Platform/build/user.pdeliv_u.Makefile +++ b/Platform/build/user.pdeliv_u.Makefile @@ -41,8 +41,8 @@ PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS) PLAT_ARM64_LDFLAGS := PLAT_LINUX_LDFLAGS := $(PLAT_ARM64_LDFLAGS) -ARM64_LIBS := libnetlinku-arm64.so -LINUX_LIBS := libnetlinku-linux.so +ARM64_LIBS := ./libnetlinku-arm64.so +LINUX_LIBS := ./libnetlinku-linux.so diff --git a/Platform/modules/trace-relay/Makefile b/Platform/modules/trace-relay/Makefile new file mode 100755 index 000000000..1a6c584cd --- /dev/null +++ b/Platform/modules/trace-relay/Makefile @@ -0,0 +1,15 @@ +ifneq ($(KERNELRELEASE),) + obj-m += trace_init.o +else + PWD := $(shell pwd) + KVER := $(shell uname -r) +# KDIR := /lib/modules/$(KVER)/build + KDIR := $(HUACHENG_LINUX_KERNEL) +# KBUILD_EXTRA_SYMBOLS += /data/code/modules/netlink_api/app_k/Module.symvers +default: + $(MAKE) -C $(KDIR) M=$(PWD) modules +all: + make -C $(KDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.c *.ko *.symvers *.order *.makers .*.cmd *.cmd .tmp_versions .cache.mks +endif diff --git a/Platform/trace/trace-relay/trace_init.c b/Platform/modules/trace-relay/trace_init.c similarity index 88% rename from Platform/trace/trace-relay/trace_init.c rename to Platform/modules/trace-relay/trace_init.c index b8767e8db..a81f553dc 100755 --- a/Platform/trace/trace-relay/trace_init.c +++ b/Platform/modules/trace-relay/trace_init.c @@ -1,6 +1,6 @@ #include -#include +#include "../netlink_api/libnetlink_k.h" static int trace_rcv_policy(struct sk_buff *skb, struct nlmsghdr *nlh) { diff --git a/Platform/modules/trace-relay/trace_init_mod.c b/Platform/modules/trace-relay/trace_init_mod.c new file mode 100644 index 000000000..d6a10e65b --- /dev/null +++ b/Platform/modules/trace-relay/trace_init_mod.c @@ -0,0 +1,28 @@ +#include +#include +#include + +MODULE_INFO(vermagic, VERMAGIC_STRING); +MODULE_INFO(name, KBUILD_MODNAME); + +__visible struct module __this_module +__attribute__((section(".gnu.linkonce.this_module"))) = { + .name = KBUILD_MODNAME, + .init = init_module, +#ifdef CONFIG_MODULE_UNLOAD + .exit = cleanup_module, +#endif + .arch = MODULE_ARCH_INIT, +}; + +#ifdef RETPOLINE +MODULE_INFO(retpoline, "Y"); +#endif + +static const char __module_depends[] +__used +__attribute__((section(".modinfo"))) = +"depends="; + + +MODULE_INFO(srcversion, "176959D2D9B79E0BAD85AE2"); diff --git a/Platform/trace/trace-api/test_trace b/Platform/trace/trace-api/test_trace deleted file mode 100755 index b2556999a..000000000 Binary files a/Platform/trace/trace-api/test_trace and /dev/null differ diff --git a/Platform/trace/trace-relay/Makefile b/Platform/trace/trace-relay/Makefile deleted file mode 100755 index f1f4dcc83..000000000 --- a/Platform/trace/trace-relay/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -ifneq ($(KERNELRELEASE),) - obj-m += trace_relay.o -else - PWD := $(shell pwd) - KVER := $(shell uname -r) - KDIR := /lib/modules/$(KVER)/build - KBUILD_EXTRA_SYMBOLS += /data/code/modules/netlink_api/app_k/Module.symvers -default: - $(MAKE) -C $(KDIR) M=$(PWD) modules -all: - make -C $(KDIR) M=$(PWD) modules -clean: - rm -rf *.o *.mod.c *.ko *.symvers *.order *.makers -endif diff --git a/Platform/trace/trace-api/test_client_main.c b/Platform/user/trace/test/test_client_main.c similarity index 100% rename from Platform/trace/trace-api/test_client_main.c rename to Platform/user/trace/test/test_client_main.c diff --git a/Platform/trace/trace-api/Makefile b/Platform/user/trace/trace-api/Makefile similarity index 100% rename from Platform/trace/trace-api/Makefile rename to Platform/user/trace/trace-api/Makefile diff --git a/Platform/trace/trace-api/collection.h b/Platform/user/trace/trace-api/collection.h similarity index 100% rename from Platform/trace/trace-api/collection.h rename to Platform/user/trace/trace-api/collection.h diff --git a/Platform/trace/trace-api/list.h b/Platform/user/trace/trace-api/list.h similarity index 100% rename from Platform/trace/trace-api/list.h rename to Platform/user/trace/trace-api/list.h diff --git a/Platform/trace/trace-api/log.h b/Platform/user/trace/trace-api/log.h similarity index 100% rename from Platform/trace/trace-api/log.h rename to Platform/user/trace/trace-api/log.h diff --git a/Platform/trace/trace-api/trace_api.c b/Platform/user/trace/trace-api/trace_api.c similarity index 100% rename from Platform/trace/trace-api/trace_api.c rename to Platform/user/trace/trace-api/trace_api.c diff --git a/Platform/trace/trace_api.h b/Platform/user/trace/trace-api/trace_api.h similarity index 100% rename from Platform/trace/trace_api.h rename to Platform/user/trace/trace-api/trace_api.h diff --git a/Platform/trace/trace_msg.h b/Platform/user/trace/trace-api/trace_msg.h similarity index 100% rename from Platform/trace/trace_msg.h rename to Platform/user/trace/trace-api/trace_msg.h