samveen / mt7902-dkms

Cloning the MT9721 driver into the MT702 driver in the hopes of getting something running.
GNU General Public License v3.0
56 stars 6 forks source link

Progress tracker: 1% - It only builds #1

Open samveen opened 6 months ago

samveen commented 6 months ago

The driver doesn't work yet.

This is a tracking ticket to list and track progess

Task list

Challenges

Linux hardware probe information: https://linux-hardware.org/?id=pci:14c3-7902 - Most of these seem to be Asus laptops and or self build desktops using Asus motherboards.

Current reason of stalled dev

Note: Any useful information in comments will get added here.

henri26mobu commented 6 months ago

J'essaye d'installer et de build le driver juste 2,3 problèmes pour le changement de kernel sur la distribution pos-os. Ils ne trouvent pas le dossier build.

samveen commented 6 months ago

@henri26mobu I have not yet succeeded in building a test environment for it either. As of now, the minimum required version of the kernel is 6.8 (released 2 weeks back), but I'm facing trouble building a dkms capable deployment for it for ubuntu 20..04 as listed in https://github.com/TuxInvader/focal-mainline-builder/issues/43#issuecomment-2005966979

If you are using pop-os, please install linux-6.8 kernel and try.

Ideally for testing:

Please create an new issue and dkms build log (verbose mode if possible). It will help me debug

henri26mobu commented 6 months ago

I did with kernel 6.8 I'll try with ubuntu noble which looks better if it already has I new kernel. And I'll say if the build environment works.

samveen commented 6 months ago

I did with kernel 6.8 I'll try with ubuntu noble which looks better if it already has I new kernel. And I'll say if the build environment works.

Any OS on linux 6.8 kernel with DKMS is fine. Please create a new issue and keep attaching the build logs there. I'll try and see where things are going wrong and fix them. In the mean time, I hope to get kernel 6.8 running too, but there are issues with it still - https://github.com/TuxInvader/focal-mainline-builder/issues/47

StreetXHasu commented 6 months ago

I have never participated in such an attraction before. Tell me if I'm doing something wrong. @samveen

sudo dkms build --verbose -m mt7902 -v 0.0.1

Sign command: /lib/modules/6.5.11-300.fc39.x86_64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/mt7902/0.0.1/source/dkms.conf)

Building module:
make -C mt76/mt7902 clean
make: Entering directory '/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902'
make -C /lib/modules/6.5.11-300.fc39.x86_64/build M=/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902 clean
make[1]: Entering directory '/usr/src/kernels/6.5.11-300.fc39.x86_64'
make[1]: Leaving directory '/usr/src/kernels/6.5.11-300.fc39.x86_64'
make: Leaving directory '/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902'

{ bash build.sh --kver 6.5.11-300.fc39.x86_64; } >> /var/lib/dkms/mt7902/0.0.1/build/make.log 2>&1
(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.5.11-300.fc39.x86_64 (x86_64)
Consult /var/lib/dkms/mt7902/0.0.1/build/make.log for more information.

streetx@fedora:~$ cat /var/lib/dkms/mt7902/0.0.1/build/make.log

DKMS make.log for mt7902-0.0.1 for kernel 6.5.11-300.fc39.x86_64 (x86_64)
Tue Mar 26 05:04:32 PM +05 2024
Build env: Linux fedora 6.5.11-300.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov  8 22:37:57 UTC 2023 x86_64 GNU/Linux
===params===
' --kver 6.5.11-300.fc39.x86_64 '
===========
===ENV===
SHELL=/bin/bash
COLORTERM=truecolor
SUDO_GID=1000
HISTSIZE=1000
HOSTNAME=fedora
SUDO_COMMAND=/usr/sbin/dkms build --verbose -m mt7902 -v 0.0.1
SUDO_USER=streetx
PWD=/var/lib/dkms/mt7902/0.0.1/build
LOGNAME=root
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.7VEGL2
HOME=/root
USERNAME=streetx
LANG=en_US.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;37;41:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:
kernelver=6.5.11-300.fc39.x86_64
KERNEL_CC=gcc
TERM=xterm-256color
USER=root
module=mt7902
DISPLAY=:0
SHLVL=2
arch=x86_64
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/snapd/snap/bin
CC=gcc
SUDO_UID=1000
module_version=0.0.1
MAIL=/var/spool/mail/streetx
OLDPWD=/home/streetx
_=/usr/bin/env
=========
Building for kernel version '6.5.11-300.fc39.x86_64'
make: Entering directory '/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902'
make -C /lib/modules/6.5.11-300.fc39.x86_64/build M=/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902 modules
make[1]: Entering directory '/usr/src/kernels/6.5.11-300.fc39.x86_64'
make --no-print-directory -C /usr/src/kernels/6.5.11-300.fc39.x86_64 \
-f /usr/src/kernels/6.5.11-300.fc39.x86_64/Makefile modules
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)
  You are using:           gcc (GCC) 13.2.1 20240316 (Red Hat 13.2.1-7)
make -f ./scripts/Makefile.build obj=/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902 need-builtin=1 need-modorder=1 
# cmd_mod /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/mt7902-common.mod
  printf '%s\n'   mac.o mcu.o main.o init.o debugfs.o | awk '!x[$0]++ { print("/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/"$0) }' > /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/mt7902-common.mod
# CC [M]  /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/mac.o
  gcc -Wp,-MMD,/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/.mac.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=branch -fno-jump-tables -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -falign-functions=16 -Wvla -Wno-pointer-sign -Wcast-function-type -fstrict-flex-arrays=3 -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g  -DMODULE  -DKBUILD_BASENAME='"mac"' -DKBUILD_MODNAME='"mt7902_common"' -D__KBUILD_MODNAME=kmod_mt7902_common -c -o /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/mac.o /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/mac.c  
In file included from /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/../mt76_connac.h:7,
                 from /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/../mt76_connac_mcu.h:7,
                 from /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/../mt792x.h:10,
                 from /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/mt7902.h:7,
                 from /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/mac.c:7:
/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/../mt76.h:18:10: fatal error: net/page_pool/helpers.h: No such file or directory
   18 | #include <net/page_pool/helpers.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:243: /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902/mac.o] Error 1
make[2]: *** [/usr/src/kernels/6.5.11-300.fc39.x86_64/Makefile:2046: /var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902] Error 2
make[1]: *** [Makefile:246: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/kernels/6.5.11-300.fc39.x86_64'
make: *** [Makefile:19: modules] Error 2
make: Leaving directory '/var/lib/dkms/mt7902/0.0.1/build/mt76/mt7902'
samveen commented 6 months ago

@StreetXHasu Please see this commit https://github.com/torvalds/linux/commit/a9ca9f9ceff382b58b488248f0c0da9e157f5d06

The page_pool headers were restructured during the above listed commit as part of v6.6-rc1 . Thus the code will not build on 6.5 unfortunately.

What distribution are you running? If you have access to linux-6.6 kernel or higher, you can install that and retry?

Also please open a new ticket to track seperately.

JoshIPT commented 3 months ago

I have a device with an MT7902 you can have remote access to in order to test this. Running Linux Mint Edge.

samveen commented 3 months ago

@JoshIPT I've tried to make the instruction in the Readme beginner friendly. Please try them out (better to fish yourself than wait on a fisherman, right?)

celerizer commented 2 months ago

Successfully built and installed in Debian Testing on a newly purchased laptop that happened to have one of these stupid cards. Is there anything else I can report that would be useful?

samveen commented 2 months ago

@celerizer I've just merged some work by @alesliehughes (Alistair) . Please update, build, modprobe and post a new issue with your kernel log for Alistair to review.

Pyrotonic1 commented 2 months ago

Hello! I recently bought a laptop with this network card and wanted to see what would happen if I tried running this driver on my system. I'm currently using the Asus Vivobook 14 X1404ZA, and I'm running the KDE spin of Fedora 40. I'm not the most educated on how Linux works in the background, but I was looking through a bunch of logs using journalctl and found these errors:

Jul 20 12:58:54 fedora kernel: mt7902_common: module verification failed: signature and/or required key missing - tainting kernel
Jul 20 12:58:54 fedora kernel: mt7902 0000:02:00.0: Direct firmware load for mediatek/WIFI_RAM_CODE_MT7902_1.bin failed with error -2
Jul 20 12:58:54 fedora kernel: mt7902 0000:02:00.0: ASIC revision: 79020000

I'm not sure if this is helpful or not, but if there's anything else you'd like me to (attempt) to do to help out, I'm more than willing to do so!