# MT7697 Built In WiFi Problem

**URL:** <https://forum.legato.io/t/mt7697-built-in-wifi-problem/4592>\
**Category:** Legato Application Framework\
**Created:** [July 26, 2019, 5:27pm UTC](https://forum.legato.io/t/mt7697-built-in-wifi-problem/4592 "2019-07-26T17:27:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BroderickJack](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@BroderickJack](https://forum.legato.io/u/BroderickJack)\
**Post date:** [July 26, 2019, 5:27pm UTC](https://forum.legato.io/t/mt7697-built-in-wifi-problem/4592/1 "2019-07-26T17:27:15Z")

</div>

Hi, I am working with the WP77XX with Firmware release 11, Legato FW 18.09, and I am getting error when I try _ifup wlan1_

_root@swi-mdm9x28:~# ifup wlan1  
Setup MT7697 UART  
Device: WP77  
Enable power control  
Initialized Linux WiFi modules  
insmod: can’t insert ‘/legato/systems/current/modules/mt7697wifi\_core.ko’: No such file or directory_

I have followed the wiki ([mangOH Red mt7697 WiFi · mangOH/mangOH Wiki · GitHub](https://github.com/mangOH/mangOH/wiki/mangOH-Red-mt7697-WiFi)) working in the VM. I also followed another thread ([Using WiFi on mangOH Red + wp76xx running Legato 19.02 AF - #3 by luisvi70 - mangOH Red - mangOH forum](https://forum.mangoh.io/t/using-wifi-on-mangoh-red-wp76xx-running-legato-19-02-af/2766/3?u=jbroderick)) assuming that building the WiFi module would add the required kernel modules. When trying to build _mksys -t wp77xx wifi.sdef_. I get the following error:

```auto
WARNING: "mt7697q_read" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697_uart_read" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697q_shutdown" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697_uart_close" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697_uart_write" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697q_unblock_writer" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697_uart_open" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697q_write" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697q_init" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
```

Thanks!

---

<div class="post-metadata">

**Author:** ![Alegato](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Alegato](https://forum.legato.io/u/Alegato)\
**Post date:** [August 2, 2019, 12:51am UTC](https://forum.legato.io/t/mt7697-built-in-wifi-problem/4592/2 "2019-08-02T00:51:24Z")

</div>

Hi @BroderickJack

Try with Legato 19.01. It worked for me. Note that I built a Legato system with just the kernel modules, patches and scripts from mangOH. I’ve attached my sdef fore reference. [red\_MT\_wifi.sdef](https://forum.legato.io/uploads/short-url/8Rg9INshXlgaNnOpyowaN0CP7lv.sdef) (2.6 KB) . You can softlink this to default.sdef

a:leaf\_workspace$ leaf setup WP77\_R11 -p swi-wp77\_2.0.0  
a:leaf\_workspace$ leaf shell  
(lsh:WP77\_R11) a:leaf\_workspace$ cd Legato\_19.01/  
(lsh:WP77\_R11) a:legato-19.01.0$ export MANGOH\_ROOT=$(pwd)  
(lsh:WP77\_R11) a:legato-19.01.0$ export LEGATO\_ROOT=$(pwd)  
(lsh:WP77\_R11) a:legato-19.01.0$ patch -p1 \< 0001-Add-mangOH-Red-mt7697-wifi-support.patch  
(lsh:WP77\_R11) a:legato-19.01.0$ cd modules/WiFi/  
(lsh:WP77\_R11) a:legato-19.01.0$ patch -p1 \< 0001-Add-support-for-multiple-wlan-interfaces.patch  
(lsh:WP77\_R11) a:legato-19.01.0$ cd …/…  
(lsh:WP77\_R11) a:legato-19.01.0$ make wp77xx​  
(lsh:WP77\_R11) a:legato-19.01.0$ instsys build/wp77xx/system.wp77xx.update 192.168.2.2

Then I updated /etc/network/interfaces and added /etc/init.d/mtwifi,

root@swi-mdm9x28-wp:~# ifup wlan1  
Setup MT7697 UART  
[64.567047] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv\_addr:0x3a MSTR\_STS:0x0c1300c8 OPER:0x00000090  
Device: WP77  
Enable power control  
Initialized Linux WiFi modules  
[67.011548] mt7697serial mt7697serial: mt7697\_uart\_open(): open serial device ‘/dev/ttyHS0’  
Initialized MT7697 WiFi core  
[67.098377] mt7697core mt7697core: mt7697\_interface\_add(): added(‘wlan1’) type(2)  
Started MT7697 WiFi uart core wlan1  
root@swi-mdm9x28-wp:~#

My Wifi AP script [mangOH-red-MT-wifi-AP.sh](https://forum.legato.io/uploads/short-url/cxQ0TgZFgXfCHNeOxjXDHSV5kTB.sh) (7.4 KB) . You can change the APN and try it out.

Please update on how it goes for you.

---

<div class="post-metadata">

**Author:** ![BroderickJack](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@BroderickJack](https://forum.legato.io/u/BroderickJack)\
**Post date:** [August 2, 2019, 6:52pm UTC](https://forum.legato.io/t/mt7697-built-in-wifi-problem/4592/3 "2019-08-02T18:52:45Z")

</div>

Hi @Alegato thanks for getting back to me!

I followed your steps but when I get to `make wp77xx` I get a bunch of `format-truncations` errors:

usr/bin/gcc -Wall -Werror -o /home/jbroderick/Documents/CouncilRock/RS100/legato\_workspace/legato-19.01.0/bin/mkPatch   
mkPatch.c /home/jbroderick/Documents/CouncilRock/RS100/legato\_workspace/legato-19.01.0/framework/liblegato/crc.c   
-I/home/jbroderick/Documents/CouncilRock/RS100/legato\_workspace/legato-19.01.0/framework/include   
-I/home/jbroderick/Documents/CouncilRock/RS100/legato\_workspace/legato-19.01.0/3rdParty/include  
mkPatch.c: In function ‘main’:  
mkPatch.c:1419:55: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size between 4045 and 4063 [-Werror=format-truncation=]  
“cat patch.%u.cwe.hdr patch.%u.cwe \>%s/patch-%s.cwe”,  
^~  
pid, pid, CurrentWorkDir, targetPtr );  
~~~~~~~~~~~~~~  
mkPatch.c:1418:9: note: ‘snprintf’ output 45 or more bytes (assuming 4140) into a destination of size 4096  
snprintf( CmdBuf, sizeof(CmdBuf),  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
“cat patch.%u.cwe.hdr patch.%u.cwe \>%s/patch-%s.cwe”,  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
pid, pid, CurrentWorkDir, targetPtr );  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
mkPatch.c:1154:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]  
snprintf(OrigName, sizeof(OrigName), “%s/%s”, CurrentWorkDir, OrigPtr);  
^  
mkPatch.c:1154:17: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096  
snprintf(OrigName, sizeof(OrigName), “%s/%s”, CurrentWorkDir, OrigPtr);  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
mkPatch.c:1177:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]  
snprintf(DestName, sizeof(DestName), “%s/%s”, CurrentWorkDir, DestPtr);  
^  
mkPatch.c:1177:17: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096  
snprintf(DestName, sizeof(DestName), “%s/%s”, CurrentWorkDir, DestPtr);  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
mkPatch.c:1230:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]  
snprintf(OrigName, sizeof(OrigName), “%s/%s”, CurrentWorkDir, OrigPtr);  
^  
mkPatch.c:1230:17: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096  
snprintf(OrigName, sizeof(OrigName), “%s/%s”, CurrentWorkDir, OrigPtr);  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
mkPatch.c:1260:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]  
snprintf(DestName, sizeof(DestName), “%s/%s”, CurrentWorkDir, DestPtr);  
^  
mkPatch.c:1260:17: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096  
snprintf(DestName, sizeof(DestName), “%s/%s”, CurrentWorkDir, DestPtr);  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
mkPatch.c:1396:60: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size between 4048 and 4066 [-Werror=format-truncation=]  
“cat patch.%u.hdr patch.%u.bin \>\>%s/patch-%s.cwe”,  
^~  
pid, pid, CurrentWorkDir, productPtr );  
~~~~~~~~~~~~~~  
mkPatch.c:1395:17: note: ‘snprintf’ output 42 or more bytes (assuming 4137) into a destination of size 4096  
snprintf( CmdBuf, sizeof(CmdBuf),  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
“cat patch.%u.hdr patch.%u.bin \>\>%s/patch-%s.cwe”,  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
pid, pid, CurrentWorkDir, productPtr );  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
mkPatch.c:20:16: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4089 [-Werror=format-truncation=]  
#define BSDIFF “bsdiff”  
^ ~~~~~~~  
mkPatch.c:1305:27: note: in expansion of macro ‘BSDIFF’  
BSDIFF " %s %s patched.%u.bin.%d",  
^ ~~~~~  
mkPatch.c:1305:36: note: format string is defined here  
BSDIFF " %s %s patched.%u.bin.%d",  
^~  
mkPatch.c:20:16: note: using the range [0, 4294967295] for directive argument  
#define BSDIFF “bsdiff”  
^ ~~~~~~~  
mkPatch.c:1305:27: note: in expansion of macro ‘BSDIFF’  
BSDIFF " %s %s patched.%u.bin.%d",  
^ ~~~~~  
mkPatch.c:1304:17: note: ‘snprintf’ output between 25 and 8234 bytes into a destination of size 4096  
snprintf( CmdBuf, sizeof(CmdBuf),  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
BSDIFF " %s %s patched.%u.bin.%d",  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
OrigName, tmpName, pid, patchNum );

Thanks!  
Jack

---

<div class="post-metadata">

**Author:** ![Alegato](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Alegato](https://forum.legato.io/u/Alegato)\
**Post date:** [August 7, 2019, 5:24pm UTC](https://forum.legato.io/t/mt7697-built-in-wifi-problem/4592/4 "2019-08-07T17:24:09Z")

</div>

HI @BroderickJack, I used a Ubuntu 16.04 64 bit with all latest updates. Also, please ensure that the cross compiler is setup correctly (leaf shell and then env to check the environment variables). My build machine details are below:

> a:leaf\_workspace$ leaf status  
> lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk  
> x Workspace: /home/a/leaf\_workspace x  
> tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu  
> x Profile: WP77\_R11 [current] (sync) x  
> tqqqqqqqqqqwqqqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu  
> x Packages x Identifier x Description x  
> tqqqqqqqqqqnqqqqqqqqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu  
> x Included x swi-wp77\_2.0.0 x SDK for WP77 (Release 11 + Legato 18.09.2) x  
> mqqqqqqqqqqvqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj  
> Other profiles: WP76\_R13, WP76\_R13.1  
> a:leaf\_workspace$ leaf shell  
> Leaf Shell /bin/bash started in Leaf environment.  
> (lsh:WP77\_R11) a:leaf\_workspace$ env  
> LEAF\_SHELL\_ORIGINAL\_PROMPT=[\e]0;\u@\h: \w\a]${debian\_chroot:+($debian\_chroot)}\u:\W$  
> LEAF\_TIMEOUT=20  
> WP77XX\_LEGATO\_IMAGES=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-legato-image  
> LEAF\_PROFILE=WP77\_R11  
> XDG\_SESSION\_ID=553  
> LEAF\_SHELL=/bin/bash  
> LEAF\_SHELL\_EXEC\_COMMAND=  
> LEAF\_PLATFORM\_MACHINE=x86\_64  
> WP77XX\_LINUX\_IMAGES=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-linux-image  
> SWI\_LINUX\_CLONE=/home/a/leaf\_workspace/swi-linux-src  
> TERM=xterm  
> SHELL=/bin/bash  
> SSH\_CLIENT=10.4.94.167 50647 22  
> LEGATO\_TOOLCHAIN\_FULL\_PREFIX=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-toolchain/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-  
> LEAF\_SHELL\_OLDPWD=/home/a/leaf\_workspace  
> LEAF\_PLATFORM\_SYSTEM=Linux  
> LEGATO\_SYSROOT=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi  
> SSH\_TTY=/dev/pts/19  
> LEAF\_CACHE=~/.cache/leaf  
> USER=a  
> 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=00:su=37;41:sg=30;43:ca=30;41: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:_.Z=01;31:_.dz=01;31:_.gz=01;31:_.lrz=01;31:_.lz=01;31:_.lzo=01;31:_.xz=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:_.jpg=01;35:_.jpeg=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:_.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=00;36:_.au=00;36:_.flac=00;36:_.m4a=00;36:_.mid=00;36:_.midi=00;36:_.mka=00;36:_.mp3=00;36:_.mpc=00;36:_.ogg=00;36:_.ra=00;36:_.wav=00;36:_.oga=00;36:_.opus=00;36:_.spx=00;36:_.xspf=00;36:  
> LEAF\_CONFIG=~/.config/leaf  
> LEGATO\_UPDATE\_FILE=  
> LEAF\_SHARED\_DIR=/usr/share/leaf/packages/leaf-plugins\_1.0/shell  
> WP77XX\_TOOLCHAIN\_PREFIX=arm-poky-linux-gnueabi-  
> LEAF\_PLATFORM\_RELEASE=4.15.0-54-generic  
> MAIL=/var/mail/a  
> PATH=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-legato/bin:/home/a/bin:/home/a/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin  
> LEGATO\_CONFIG\_SCRIPT=  
> QT\_QPA\_PLATFORMTHEME=appmenu-qt5  
> LEGATO\_OBJECT\_DIR=  
> PWD=/home/a/leaf\_workspace  
> LEAF\_USER\_ROOT=~/.leaf  
> LANG=en\_US.UTF-8  
> LEAF\_GPG\_KEYSERVER=[subset.pool.sks-keyservers.net](http://subset.pool.sks-keyservers.net)  
> LEAF\_SHELL\_DEFAULT=bash  
> LEGATO\_OUTPUT\_DIR=  
> LEAF\_WORKSPACE=/home/a/leaf\_workspace  
> LEAF\_SYSTEM\_ROOTS=/usr/share/leaf/packages:~/.local/share/leaf/packages  
> WP77XX\_TOOLCHAIN\_DIR=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-toolchain/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi  
> LEAF\_RETRY=5  
> LEAF\_REMOTE\_SMARTREFRESH=1  
> SHLVL=2  
> HOME=/home/a  
> WP77XX\_DEVICE\_IMAGES=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-image  
> LOGNAME=a  
> LEAF\_ORIGINAL\_PROMPT\_COMMAND=  
> LEAF\_VERSION=2.0.1  
> XDG\_DATA\_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop  
> SSH\_CONNECTION=10.4.94.167 50647 10.3.58.8 22  
> LESSOPEN=| /usr/bin/lesspipe %s  
> DEST\_IP=192.168.2.2  
> WP77XX\_MODEM\_IMAGES=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-modem-image  
> LEGATO\_ROOT=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-legato  
> XDG\_RUNTIME\_DIR=/run/user/1000  
> WP77XX\_SYSROOT=/home/a/leaf\_workspace/leaf-data/WP77\_R11/wp77-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi  
> LESSCLOSE=/usr/bin/lesspipe %s %s  
> LEGATO\_TARGET=wp77xx  
> [GERRIT\_USER=user@gmail.com](mailto:GERRIT_USER=user@gmail.com)  
> \_=/usr/bin/env  
> (lsh:WP77\_R11) a:leaf\_workspace$ uname -a  
> Linux a-ThinkPad-X240 4.15.0-54-generic #58~16.04.1-Ubuntu SMP Mon Jun 24 13:21:41 UTC 2019 x86\_64 x86\_64 x86\_64 GNU/Linux  
> (lsh:WP77\_R11) a:leaf\_workspace$ lsb\_release -a  
> No LSB modules are available.  
> Distributor ID: Ubuntu  
> Description: Ubuntu 16.04.6 LTS  
> Release: 16.04  
> Codename: xenial  
> (lsh:WP77\_R11) a:leaf\_workspace$
