From: Thomas Walker Lynch Date: Fri, 17 Oct 2025 07:00:55 +0000 (+0000) Subject: build env X-Git-Url: https://git.reasoningtechnology.com/style/static/git-favicon.png?a=commitdiff_plain;h=2e00d3ff83cc9e4cdfadf30ccf0639da7eb3ddc6;p=Rabbit%2F.git build env --- diff --git a/developer/.gitignore b/developer/.gitignore new file mode 100644 index 0000000..120f485 --- /dev/null +++ b/developer/.gitignore @@ -0,0 +1,2 @@ +* +!/.gitignore diff --git a/developer/cc/Rabbit_module_no-op.kmod.c b/developer/cc/Rabbit_module_no-op.kmod.c new file mode 100644 index 0000000..f6c5586 --- /dev/null +++ b/developer/cc/Rabbit_module_no-op.kmod.c @@ -0,0 +1,69 @@ +// rabit_noop.c — Rabit no-op netfilter interposer (Debian 12/Bookworm) +// Build: out-of-tree module. Load/unload to verify hook coverage. +// Behavior: increments counters, returns NF_ACCEPT. No packet mutation. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static atomic64_t cnt_v4_local_out = ATOMIC_LONG_INIT(0); +static atomic64_t cnt_v4_postroute = ATOMIC_LONG_INIT(0); +static atomic64_t cnt_v6_local_out = ATOMIC_LONG_INIT(0); +static atomic64_t cnt_v6_postroute = ATOMIC_LONG_INIT(0); + +static unsigned int rabit_v4_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *st) { + if (st->hook == NF_INET_LOCAL_OUT) atomic64_inc(&cnt_v4_local_out); + else if (st->hook == NF_INET_POST_ROUTING) atomic64_inc(&cnt_v4_postroute); + return NF_ACCEPT; +} + +static unsigned int rabit_v6_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *st) { + if (st->hook == NF_INET_LOCAL_OUT) atomic64_inc(&cnt_v6_local_out); + else if (st->hook == NF_INET_POST_ROUTING) atomic64_inc(&cnt_v6_postroute); + return NF_ACCEPT; +} + +static struct nf_hook_ops rabit_ops[] = { + { .hook = rabit_v4_hook, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP_PRI_FIRST }, + { .hook = rabit_v4_hook, .pf = NFPROTO_IPV4, .hooknum = NF_INET_POST_ROUTING,.priority = NF_IP_PRI_FIRST }, + { .hook = rabit_v6_hook, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP6_PRI_FIRST }, + { .hook = rabit_v6_hook, .pf = NFPROTO_IPV6, .hooknum = NF_INET_POST_ROUTING,.priority = NF_IP6_PRI_FIRST }, +}; + +static int __init rabit_init(void) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) + int ret = nf_register_net_hooks(&init_net, rabit_ops, ARRAY_SIZE(rabit_ops)); +#else + int ret = nf_register_hooks(rabit_ops, ARRAY_SIZE(rabit_ops)); +#endif + if (ret) + pr_err("rabit_noop: nf_register_* failed: %d\n", ret); + else + pr_info("rabit_noop: loaded (no-op)\n"); + return ret; +} + +static void __exit rabit_exit(void) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) + nf_unregister_net_hooks(&init_net, rabit_ops, ARRAY_SIZE(rabit_ops)); +#else + nf_unregister_hooks(rabit_ops, ARRAY_SIZE(rabit_ops)); +#endif + pr_info("rabit_noop: unload stats v4(lo=%lld,po=%lld) v6(lo=%lld,po=%lld)\n", + (long long)atomic64_read(&cnt_v4_local_out), + (long long)atomic64_read(&cnt_v4_postroute), + (long long)atomic64_read(&cnt_v6_local_out), + (long long)atomic64_read(&cnt_v6_postroute)); +} + +module_init(rabit_init); +module_exit(rabit_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Rabit"); +MODULE_DESCRIPTION("Rabit no-op netfilter interposer"); diff --git a/developer/cc/rabbit_module_no-op.mod.c b/developer/cc/rabbit_module_no-op.mod.c deleted file mode 100644 index f6c5586..0000000 --- a/developer/cc/rabbit_module_no-op.mod.c +++ /dev/null @@ -1,69 +0,0 @@ -// rabit_noop.c — Rabit no-op netfilter interposer (Debian 12/Bookworm) -// Build: out-of-tree module. Load/unload to verify hook coverage. -// Behavior: increments counters, returns NF_ACCEPT. No packet mutation. - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static atomic64_t cnt_v4_local_out = ATOMIC_LONG_INIT(0); -static atomic64_t cnt_v4_postroute = ATOMIC_LONG_INIT(0); -static atomic64_t cnt_v6_local_out = ATOMIC_LONG_INIT(0); -static atomic64_t cnt_v6_postroute = ATOMIC_LONG_INIT(0); - -static unsigned int rabit_v4_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *st) { - if (st->hook == NF_INET_LOCAL_OUT) atomic64_inc(&cnt_v4_local_out); - else if (st->hook == NF_INET_POST_ROUTING) atomic64_inc(&cnt_v4_postroute); - return NF_ACCEPT; -} - -static unsigned int rabit_v6_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *st) { - if (st->hook == NF_INET_LOCAL_OUT) atomic64_inc(&cnt_v6_local_out); - else if (st->hook == NF_INET_POST_ROUTING) atomic64_inc(&cnt_v6_postroute); - return NF_ACCEPT; -} - -static struct nf_hook_ops rabit_ops[] = { - { .hook = rabit_v4_hook, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP_PRI_FIRST }, - { .hook = rabit_v4_hook, .pf = NFPROTO_IPV4, .hooknum = NF_INET_POST_ROUTING,.priority = NF_IP_PRI_FIRST }, - { .hook = rabit_v6_hook, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP6_PRI_FIRST }, - { .hook = rabit_v6_hook, .pf = NFPROTO_IPV6, .hooknum = NF_INET_POST_ROUTING,.priority = NF_IP6_PRI_FIRST }, -}; - -static int __init rabit_init(void) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - int ret = nf_register_net_hooks(&init_net, rabit_ops, ARRAY_SIZE(rabit_ops)); -#else - int ret = nf_register_hooks(rabit_ops, ARRAY_SIZE(rabit_ops)); -#endif - if (ret) - pr_err("rabit_noop: nf_register_* failed: %d\n", ret); - else - pr_info("rabit_noop: loaded (no-op)\n"); - return ret; -} - -static void __exit rabit_exit(void) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - nf_unregister_net_hooks(&init_net, rabit_ops, ARRAY_SIZE(rabit_ops)); -#else - nf_unregister_hooks(rabit_ops, ARRAY_SIZE(rabit_ops)); -#endif - pr_info("rabit_noop: unload stats v4(lo=%lld,po=%lld) v6(lo=%lld,po=%lld)\n", - (long long)atomic64_read(&cnt_v4_local_out), - (long long)atomic64_read(&cnt_v4_postroute), - (long long)atomic64_read(&cnt_v6_local_out), - (long long)atomic64_read(&cnt_v6_postroute)); -} - -module_init(rabit_init); -module_exit(rabit_exit); -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Rabit"); -MODULE_DESCRIPTION("Rabit no-op netfilter interposer"); diff --git a/developer/scratchpad/makefile-cc.deps b/developer/scratchpad/makefile-cc.deps deleted file mode 100644 index bbb727e..0000000 --- a/developer/scratchpad/makefile-cc.deps +++ /dev/null @@ -1,7 +0,0 @@ -scratchpad/no-op.lib.o: cc/no-op.lib.c \ - /home/Thomas/subu_data/developer/project/Linux/Rabbit/tool_shared/third_party/RT-project-share/release/make/RT_0.h -scratchpad/hello.cli.o: cc/hello.cli.c \ - /home/Thomas/subu_data/developer/project/Linux/Rabbit/tool_shared/third_party/RT-project-share/release/make/RT_0.h - -machine/hello : scratchpad/hello.cli.o scratchpad/libRabbit.a - gcc -o machine/hello scratchpad/hello.cli.o -Lscratchpad -L/lib64 -L/lib -lRabbit diff --git a/developer/tool/makefile b/developer/tool/makefile index d7f3a40..9677018 100644 --- a/developer/tool/makefile +++ b/developer/tool/makefile @@ -1,31 +1,49 @@ +.SUFFIXES: # developer/tool/makefile — Orchestrator (Hybrid) -ifndef REPO_HOME - $(error REPO_HOME is not set; source your project env (tool_shared/bespoke/env) first) -endif - RT_INCOMMON := $(REPO_HOME)/tool_shared/third_party/RT-project-share/release include $(RT_INCOMMON)/make/environment_RT_1.mk -.PHONY: all usage lib_cli kmod clean check-pwd -all: lib_cli kmod - +.PHONY: usage usage: - @printf "Usage: make [usage|lib_cli|kmod|clean|check-pwd]\n"; exit 2 - -# Build user-space static lib + CLI (cli target builds lib first) -lib_cli: + @printf "Usage: make [usage|information|all|lib|cli|kmod|clean]\n"; exit 2 + +.PHONY: version +version: + @echo tool/makefile version 2.0 + @$(MAKE) -f $(RT_INCOMMON)/make/target_kmod.mk version + @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk version + +.PHONY: information +information: + @printf "local ----------------------------------------\n" + -@echo CURDIR='$(CURDIR)' + @echo REPO_HOME="$(REPO_HOME)" + @echo KMOD_BUILD_DIR="/lib/modules/$(shell uname -r)/build" + @echo CURDIR="$(CURDIR)" + @printf "target_lib_cli.mk ----------------------------------------\n" + @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk information + @printf "target_kmod.mk ----------------------------------------\n" + @$(MAKE) -f $(RT_INCOMMON)/make/target_kmod.mk information + +.PHONY: all +all: lib cli kmod + +.PHONY: lib +lib: + @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk lib + +.PHONY: cli +cli: @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk cli -# Build all kernel modules +.PHONY: kmod kmod: @$(MAKE) -f $(RT_INCOMMON)/make/target_kmod.mk kmod +.PHONY: clean clean: @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk clean @$(MAKE) -f $(RT_INCOMMON)/make/target_kmod.mk clean -check-pwd: - @if [ "$(CURDIR)" != "$(REPO_HOME)/developer" ]; then \ - printf "warn: CURDIR=%s (expected %s)\n" "$(CURDIR)" "$(REPO_HOME)/developer"; \ - fi + diff --git a/release/aarch64/.githolder b/release/aarch64/.githolder deleted file mode 100644 index e69de29..0000000 diff --git a/release/armv7l/.githolder b/release/armv7l/.githolder deleted file mode 100644 index e69de29..0000000 diff --git a/release/i686/.githolder b/release/i686/.githolder deleted file mode 100644 index e69de29..0000000 diff --git a/release/ppc64le/.githolder b/release/ppc64le/.githolder deleted file mode 100644 index e69de29..0000000 diff --git a/release/riscv64/.githolder b/release/riscv64/.githolder deleted file mode 100644 index e69de29..0000000 diff --git a/release/s390x/.githolder b/release/s390x/.githolder deleted file mode 100644 index e69de29..0000000 diff --git a/release/x86_64/.githolder b/release/x86_64/.githolder deleted file mode 100644 index e69de29..0000000