i want to use this packet https://github.com/xdqi/iptables-faketcp.git
but where to start how to write Makefile or make this package for openwrt
ok i made Makefile but it give these logs:
make[1]: Entering directory '/home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64'
make[2]: Entering directory '/home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/package/toolchain'
Makefile:737: WARNING: skipping libgomp -- package has no install section
echo "libc" >> /home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libgcc" >> /home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libpthread" >> /home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "librt" >> /home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
touch -r /home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/toolchain/.built /home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/toolchain/.autoremove 2>/dev/null >/dev/null
find /home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/toolchain -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | xargs -r rm -rf
make[2]: Leaving directory '/home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/package/toolchain'
time: package/toolchain/compile#0.30#0.22#0.53
make[1]: [package/Makefile:115: package/iptables-faketcp/compile] Error 2 (ignored)
make[2]: Entering directory '/home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/package/iptables-faketcp'
Makefile:54: *** ERROR: Unknown pack format for file /home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/tmp/dl/. Stop.
make[2]: Leaving directory '/home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/package/iptables-faketcp'
time: package/iptables-faketcp/compile#0.13#0.04#0.18
ERROR: package/iptables-faketcp failed to build.
make[1]: *** [package/Makefile:116: package/iptables-faketcp/compile] Error 1
make[1]: Leaving directory '/home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64'
make: *** [/home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/include/toplevel.mk:223: package/iptables-faketcp/compile] Error 2
and my Makefile is based on fullconenat;
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=faketcp
PKG_RELEASE:=3
PKG_SOURCE_DATE:=2019-10-21
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/xdqi/iptables-faketcp.git
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/iptables-mod-faketcp
SUBMENU:=Firewall
SECTION:=net
CATEGORY:=Network
TITLE:=FAKETCP iptables extension
MAINTAINER:=Chion Tang <tech@chionlab.moe>
endef
define Package/iptables-mod-faketcp/install
$(INSTALL_DIR) $(1)/usr/lib/iptables
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libipt_FAKETCP.so $(1)/usr/lib/iptables
endef
define KernelPackage/ipt-faketcp
SUBMENU:=Netfilter Extensions
TITLE:=FAKETCP netfilter module
MAINTAINER:=Chion Tang <tech@chionlab.moe>
KCONFIG:=CONFIG_NF_CONNTRACK_EVENTS=y CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y
FILES:=$(PKG_BUILD_DIR)/ko/xt_FAKETCP.ko
endef
include $(INCLUDE_DIR)/kernel-defaults.mk
define Build/Prepare
$(call Build/Prepare/Default)
$(CP) ./files/Makefile $(PKG_BUILD_DIR)/
endef
define Build/Compile
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(BUILDFLAGS)" \
modules
$(call Build/Compile/Default)
endef
$(eval $(call BuildPackage,iptables-mod-faketcp))
$(eval $(call KernelPackage,ipt-faketcp))
You need a Build/Install
section for packages, or it won't actually do anything (because it doesn't know what to do with it since it defaults to make install
if left out)..
If you need these available to the build system in addition to being installed on the device, you'll need a Build/InstallDev
section
Build/Install (optional)
How to install the compiled source. The default is to call “make install”. Again, to pass special arguments or targets, use “$(call Build/Install/Default,install install-foo)”. Note that you need put all the needed make arguments here. If you just need to add something to the “install” argument, don't forget the “install” itself.`
Build/InstallDev (optional)
For things needed to compile packages against it (static libs, header files), but that are of no use on the target device.
Because it's super easy to miss unless you KNOW you're actually looking for it, here is a link to the section in the Wiki regarding Build/Install
file macros.
i am very noob acuallty this my first Makefile all i need is to use this package so please can you help to write or correct the Makefile
I gets this error
Makefile:51: *** ERROR: Unknown pack format for file /home/isso/Downloads/openwrt-sdk-21.02.2-x86-64_gcc-8.4.0_musl.Linux-x86_64/tmp/dl/. Stop.
and Makefile:51 is
$(eval $(call BuildPackage,iptables-mod-faketcp))
You need to include the commit hash that you are pulling..
PKG_SOURCE_VERSION:=5ef2ff34b6c235afa0b4cea92ceeb4f9ba2eda14
PKG_MIRROR_HASH:=skip
This will allow you to clone and archive the remote git.
I've not messed with Kernel packages, however, the instructions on the repo say:
cd ko
make install
cd so
make install
You will need to see where those get installed to after creation and mimic it properly
install:
install -m 755 -t /lib/iptables/ *.so
Something like thiis maybe?
$(INSTALL_BIN) $(PKG_BUILD_DIR)/so/*.so $(1)/lib/iptables/*.so
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules_install
is from the .ko, you'll need to figure out the best way to move those.
how can i install the package from local drive instead of
PKG_SOURCE_URL:=https://github.com/xdqi/iptables-faketcp.git
PKG_SOURCE_VERSION:=5ef2ff34b6c235afa0b4cea92ceeb4f9ba2eda14