HI,
I have a kernel module which can be successfully compiled in SDK-18.06.x and SDK-19.07.x, but it can't be successfully done in SDK-21.02.x. It show me some errors as follow. can someone help me what should i change in sourcefile or makefile?
touch /home/zyl/openwrt/openwrt-sdk-21.02.2-ipq40xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/ipt-trigger/.built_check
make -C "/home/zyl/openwrt/openwrt-sdk-21.02.2-ipq40xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/linux-5.4.179" ARCH="arm" CROSS_COMPILE="arm-openwrt-linux-muslgnueabi-" SUBDIRS="/home/zyl/openwrt/openwrt-sdk-21.02.2-ipq40xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/ipt-trigger" EXTRA_CFLAGS=" -DCONFIG_IPT_TRIGGER=1 " CONFIG_IPT_TRIGGER=m modules
make[3]: Entering directory '/home/zyl/openwrt/openwrt-sdk-21.02.2-ipq40xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/linux-5.4.179'
scripts/Makefile.build:42: arch/arm/tools/Makefile: No such file or directory
make[4]: *** No rule to make target 'arch/arm/tools/Makefile'. Stop.
make[3]: *** [arch/arm/Makefile:326: archheaders] Error 2
make[3]: Leaving directory '/home/zyl/openwrt/openwrt-sdk-21.02.2-ipq40xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/linux-5.4.179'
make[2]: *** [Makefile:68: /home/zyl/openwrt/openwrt-sdk-21.02.2-ipq40xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/ipt-trigger/.built] Error 2
make[2]: Leaving directory '/home/zyl/openwrt/openwrt-sdk-21.02.2-ipq40xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64/package/porttrigger'
time: package/porttrigger/compile#1.18#1.35#5.62
ERROR: package/porttrigger failed to build.
make[1]: *** [package/Makefile:116: package/porttrigger/compile] Error 1
make[1]: Leaving directory '/home/zyl/openwrt/openwrt-sdk-21.02.2-ipq40xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64'
make: *** [/home/zyl/openwrt/openwrt-sdk-21.02.2-ipq40xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64/include/toplevel.mk:223:package/porttrigger/compile] 错误 2
And this is my Makefile:
#
# Copyright (C) 2008-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ipt-trigger
PKG_VERSION:=
PKG_RELEASE:=1
#PKG_LICENSE:=GPL-2.0
#PKG_LICENSE_FILES:=
include $(INCLUDE_DIR)/package.mk
define KernelPackage/ipt-trigger
SUBMENU:=Other modules
DEPENDS:=+kmod-nf-conntrack +kmod-nf-nat +kmod-ipt-core
TITLE:=Kmod for pottrigger
FILES:=$(PKG_BUILD_DIR)/ipt_TRIGGER.ko
AUTOLOAD:=$(call AutoProbe,ipt_TRIGGER)
KCONFIG:=
endef
define KernelPackage/ipt-trigger/description
Netfilter (IPv4) kernel modules for connection tracking
Includes:
- TRIGGER
endef
EXTRA_KCONFIG:= \
CONFIG_IPT_TRIGGER=m
EXTRA_CFLAGS:= \
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) \
MAKE_OPTS:= \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
$(EXTRA_KCONFIG)
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
$(MAKE_OPTS) \
modules
endef
define KernelPackage/ipt-trigger/install
$(INSTALL_DIR) $(1)/etc/modules.d
$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
$(CP) $(FILES) $(1)/lib/modules/$(LINUX_VERSION)/
endef
$(eval $(call KernelPackage,ipt-trigger))