MT7601u
MT7601u copied to clipboard
Doesnt compile on raspios kernel 5.4.83-v7+
I did an update and installed kernel headers then tried to compile the driver but it didnt work:
pi@raspberrypi:\~/mt7601Drivers/muratdemirtas/MT7601u $ uname -r
5.4.83-v7+
pi@raspberrypi:\~/mt7601Drivers/muratdemirtas/MT7601u $ sudo make clean
make -C src/ clean
make[1]: Entering directory '/home/pi/mt7601Drivers/muratdemirtas/MT7601u/src'
cp -f os/linux/Makefile.clean os/linux/Makefile
make -C os/linux clean
make[2]: Entering directory '/home/pi/mt7601Drivers/muratdemirtas/MT7601u/src/os/linux'
rm -f ../../common/*.o
rm -f ../../common/.*.cmd .*.flags .*.d
rm -f ../../os/linux/*.o *.ko *.mod.o *.mod.c
rm -f ../../os/linux/.*.cmd .*.flags .*.d
rm -fr ../../os/linux/.tmp_versions
rm -f ../../os/linux/Module.symvers
rm -f ../../os/linux/Modules.symvers
rm -f ../../os/linux/Module.markers
rm -f ../../os/linux/modules.order
rm -f ../../chips/*.o
rm -f ../../chips/.*.cmd .*.flags .*.d
rm -f ../../rate_ctrl/*.o
rm -f ../../rate_ctrl/.*.cmd .*.flags .*.d
rm -f ../../ate/common/*.o
rm -f ../../ate/common/.*.cmd .*.flags .*.d
rm -f ../../ate/chips/*.o
rm -f ../../ate/chips/.*.cmd .*.flags .*.d
rm -f ../../phy/*.o
rm -f ../../phy/.*.cmd .*.flags .*.d
rm -f ../../mac/*.o
rm -f ../../mac/.*.cmd .*.flags .*.d
rm -f ../../mcu/*.o
rm -f ../../mcu/.*.cmd .*.flags .*.d
rm -f ../../mgmt/*.o
rm -f ../../mgmt/.*.cmd .*.flags .*.d
rm -f ../../naf/*.o
rm -f ../../naf/.*.cmd .*.flags .*.d
rm -f ../../ap/*.o
rm -f ../../ap/.*.cmd .*.flags .*.d
make[2]: Leaving directory '/home/pi/mt7601Drivers/muratdemirtas/MT7601u/src/os/linux'
rm -rf os/linux/Makefile
make[1]: Leaving directory '/home/pi/mt7601Drivers/muratdemirtas/MT7601u/src'
pi@raspberrypi:\~/mt7601Drivers/muratdemirtas/MT7601u $ sudo make all
make -C src/ osutil
make[1]: Entering directory '/home/pi/mt7601Drivers/muratdemirtas/MT7601u/src'
cp -f os/linux/Makefile.6.util /home/pi/mt7601Drivers/muratdemirtas/MT7601u/src/os/linux/Makefile
make -C /lib/modules/5.4.83-v7+/build SUBDIRS=/home/pi/mt7601Drivers/muratdemirtas/MT7601u/src/os/linux modules
make[2]: Entering directory '/usr/src/linux-headers-5.4.83-v7+'
make[3]: *** No rule to make target 'arch/arm/tools/syscallhdr.sh', needed by 'arch/arm/include/generated/uapi/asm/unistd-common.h'. Stop.
make[2]: *** [arch/arm/Makefile:325: archheaders] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-5.4.83-v7+'
make[1]: *** [Makefile:511: osutil] Error 2
make[1]: Leaving directory '/home/pi/mt7601Drivers/muratdemirtas/MT7601u/src'
make: *** [Makefile:2: all] Error 2
pi@raspberrypi:\~/mt7601Drivers/muratdemirtas/MT7601u $
Before this I added syscall.tbl because it complained about that file missing:
make[3]: *** No rule to make target 'arch/arm/tools/syscall.tbl', needed by 'arch/arm/include/generated/uapi/asm/unistd-common.h'. Stop.
make[2]: *** [arch/arm/Makefile:325: archheaders] Error 2
Same for me:
make[2]: Entering directory '/usr/src/linux-headers-5.4.83-v7l+'
make[3]: *** No rule to make target 'arch/arm/tools/syscall.tbl', needed by 'arch/arm/include/generated/uapi/asm/unistd-common.h'. Stop.
make[2]: *** [arch/arm/Makefile:325: archheaders] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-5.4.83-v7l+'
make[1]: *** [Makefile:511: osutil] Error 2
make[1]: Leaving directory '/home/pi/Workspace/MT7601u/src'
make: *** [Makefile:2: all] Error 2
Do you think we need to build the kernel to make it work?
@sifr01 were you able to make this work? Did you find a working driver?
@stravi @sifr01 when applying this patch:
diff --git a/Makefile.inc b/Makefile.inc
index ed4b88f..31761cf 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -377,23 +377,23 @@ else
ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
ifeq ($(PLATFORM),DM6446)
- $(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
else
ifeq ($(PLATFORM),FREESCALE8377)
- $(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
else
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
endif
ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
ifeq ($(RT28xx_MODE),AP)
@@ -498,7 +498,7 @@ ifneq (,$(findstring 2.4,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.libwapi.6 $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
osutil:
@@ -508,7 +508,7 @@ ifneq (,$(findstring 2.4,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
endif
@@ -519,7 +519,7 @@ ifneq (,$(findstring 2.4,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
endif
@@ -529,7 +529,7 @@ ifneq (,$(findstring 2.4,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
# Declare the contents of the .PHONY variable as phony. We keep that information in a variable
diff --git a/src/Makefile b/src/Makefile
index ed4b88f..31761cf 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -377,23 +377,23 @@ else
ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
ifeq ($(PLATFORM),DM6446)
- $(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
else
ifeq ($(PLATFORM),FREESCALE8377)
- $(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
else
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
endif
ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
diff --git a/Makefile.inc b/Makefile.inc
index ed4b88f..31761cf 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -377,23 +377,23 @@ else
ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
ifeq ($(PLATFORM),DM6446)
- $(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
else
ifeq ($(PLATFORM),FREESCALE8377)
- $(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
else
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
endif
@@ -529,7 +529,7 @@ ifneq (,$(findstring 2.4,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+ $(MAKE) -C $(LINUX_SRC) M=$(RT28xx_DIR)/os/linux modules
endif
# Declare the contents of the .PHONY variable as phony. We keep that information in a variable
diff --git a/src/os/linux/config.mk b/src/os/linux/config.mk
index 1d3b5ab..dc4036b 100644
--- a/src/os/linux/config.mk
+++ b/src/os/linux/config.mk
@@ -1320,7 +1320,7 @@ ifeq ($(PLATFORM),PC)
export CFLAGS
else
# Linux 2.6
- EXTRA_CFLAGS := $(WFLAGS)
+ EXTRA_CFLAGS := $(WFLAGS) -Wno-return-type -Wno-incompatible-pointer-types -Wno-implicit-function-declaration
endif
endif
to keep up-to-date with kernel v5.x.x series out-of-tree build I still get this error :
CC [M] /root/MT7601u/src/os/linux/../../os/linux/rt_linux.o
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c: In function ‘__RTMP_OS_Init_Timer’:
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c:124:9: error: ‘OS_NDIS_MINIPORT_TIMER’ {aka ‘struct timer_list’} has no member named ‘data’
pTimer->data = (unsigned long)data;
^~
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c: In function ‘RtmpOsUsDelay’:
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c:182:8: warning: unused variable ‘i’ [-Wunused-variable]
ULONG i;
^
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c: In function ‘RtmpDrvAllRFPrint’:
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c:2164:22: warning: unused variable ‘macValue’ [-Wunused-variable]
UINT32 macAddr = 0, macValue = 0;
^~~~~~~~
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c:2164:9: warning: unused variable ‘macAddr’ [-Wunused-variable]
UINT32 macAddr = 0, macValue = 0;
^~~~~~~
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c: In function ‘RtmpOSIRQRelease’:
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c:2300:21: warning: unused variable ‘net_dev’ [-Wunused-variable]
struct net_device *net_dev = (struct net_device *)pNetDev;
^~~~~~~
In file included from /root/MT7601u/src/include/rtmp_os.h:48,
from /root/MT7601u/src/include/rtmp_comm.h:69,
from /root/MT7601u/src/os/linux/../../os/linux/rt_linux.c:35:
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c: In function ‘RtmpOsGetPid’:
/root/MT7601u/src/include/os/rt_linux.h:524:71: error: ‘struct task_struct’ has no member named ‘pids’; did you mean ‘pid’?
#define RT_GET_OS_PID(_x, _y) do{rcu_read_lock(); _x=(ULONG)current->pids[PIDTYPE_PID].pid; rcu_read_unlock();}while(0)
^~~~
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c:4596:2: note: in expansion of macro ‘RT_GET_OS_PID’
RT_GET_OS_PID(*pDst, PID);
^~~~~~~~~~~~~
make[3]: *** [scripts/Makefile.build:279: /root/MT7601u/src/os/linux/../../os/linux/rt_linux.o] Error 1
make[2]: *** [Makefile:1804: /root/MT7601u/src/os/linux] Error 2
make[2]: uscita dalla directory "/usr/src/linux-headers-5.10.17-v7+"
make[1]: *** [Makefile:511: osutil] Error 2
make[1]: uscita dalla directory "/root/MT7601u/src"
make: *** [Makefile:2: all] Error 2
any ideas ?
adding this another patch :
--- a/src/os/linux/rt_linux.c
+++ b/src/os/linux/rt_linux.c
@@ -120,9 +120,10 @@ static inline VOID __RTMP_OS_Init_Timer(
IN PVOID data)
{
if (!timer_pending(pTimer)) {
- init_timer(pTimer);
- pTimer->data = (unsigned long)data;
- pTimer->function = function;
+ // init_timer(pTimer);
+ // pTimer->data = (unsigned long)data;
+ // pTimer->function = function;
+ timer_setup(pTimer, function, (unsigned long)data);
}
}
and getting this last-step error:
CC [M] /root/MT7601u/src/os/linux/../../common/rt_os_util.o
CC [M] /root/MT7601u/src/os/linux/../../os/linux/rt_linux_symb.o
CC [M] /root/MT7601u/src/os/linux/../../os/linux/rt_rbus_pci_util.o
CC [M] /root/MT7601u/src/os/linux/../../os/linux/rt_usb_util.o
CC [M] /root/MT7601u/src/os/linux/../../os/linux/rt_linux.o
In file included from /root/MT7601u/src/include/rtmp_os.h:48,
from /root/MT7601u/src/include/rtmp_comm.h:69,
from /root/MT7601u/src/os/linux/../../os/linux/rt_linux.c:35:
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c: In function ‘RtmpOsGetPid’:
/root/MT7601u/src/include/os/rt_linux.h:525:71: error: ‘struct task_struct’ has no member named ‘pids’; did you mean ‘pid’?
#define RT_GET_OS_PID(_x, _y) do{rcu_read_lock(); _x=(ULONG)current->pids[PIDTYPE_PID].pid; rcu_read_unlock();}while(0)
^~~~
/root/MT7601u/src/os/linux/../../os/linux/rt_linux.c:4597:2: note: in expansion of macro ‘RT_GET_OS_PID’
RT_GET_OS_PID(*pDst, PID);
^~~~~~~~~~~~~
make[3]: *** [scripts/Makefile.build:279: /root/MT7601u/src/os/linux/../../os/linux/rt_linux.o] Error 1
make[2]: *** [Makefile:1804: /root/MT7601u/src/os/linux] Error 2
make[2]: uscita dalla directory "/usr/src/linux-headers-5.10.17-v7+"
make[1]: *** [Makefile:511: osutil] Error 2
make[1]: uscita dalla directory "/root/MT7601u/src"
make: *** [Makefile:2: all] Error 2
but I can't figure out how to fix the struct...any ideas @muratdemirtas ?
Yes it is giving a lot of errors. Seems it will not work in new kernels
Same problem with Linux 5.13.0-28 Ubuntu 21.10
I am on v5.10.146 | unable to compile with all same above problems !
Pls guide !