# Unable to compile 8021q module using mdef

**URL:** <https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418>\
**Category:** Legato Application Framework\
**Created:** [February 5, 2023, 5:07pm UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418 "2023-02-05T17:07:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 5, 2023, 5:07pm UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/1 "2023-02-05T17:07:33Z")

</div>

We want to implement VLAN 8021q driver in wp7608 (Rel 16.0.1) . As this is new requirement and devices are already working at multiple sites, We want to implement these changes without .cwe file. Hence we are planning to implement it using .mdef file as with out of tree kernel module, we are undefined symbols errors for few functions. As .mdef will create symvers file for modue, we are planning to implement mdef solution for implementing driver. I am trying to compile 8021q VLAN module using mdef file. While compiling I am getting compilation errors like redefinition errors for few functions. These functions are defined with different arguments and used by different functions. Could you please help me with this ASAP. I am attaching module folder containing source code , mdef file and fragment.cfg to be implemented. Request you to help ASAP.  
[SourceCode.zip](https://forum.legato.io/uploads/short-url/3GbJq9F3qdLnjOIAUV1NSbBF0g5.zip) (53.9 KB)

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 5, 2023, 5:27pm UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/2 "2023-02-05T17:27:08Z")

</div>

are you able to compile the legato.cwe ?

> **[GitHub - legatoproject/legato-af: Legato Application Framework](https://github.com/legatoproject/legato-af)**
>
> Legato Application Framework. Contribute to legatoproject/legato-af development by creating an account on GitHub.

If yes, you can add your driver in the driver folder and .sdef to include your driver

I have quick try on adding your 802/gvrp driver in mangoh layer source code, I can compile it.

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 3:25am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/3 "2023-02-06T03:25:06Z")

</div>

I am unable to get legato.cwe file. I was also able compile gvrp code but once i added 8021q it’s throwing compilation errors. Could you please help me with this. Also it’ will be helpful if you can share example to include driver folder so that i can explore this at my end

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 6, 2023, 3:44am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/4 "2023-02-06T03:44:51Z")

</div>

Why you cannot compile the legato.cwe?  
You can just go into leaf shell, and go to the legato framework source, and type “make wp76xx” to make it

If you cannot compile 8021q driver, that is your 8021q driver problem, you need to ask the vendor of this driver…

FYI, I can only compile /802/gvrp and /802/mrp

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 5:00am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/5 "2023-02-06T05:00:02Z")

</div>

I am using vscode legato plugin with rel 16.0.1 toolchain for this. In this i am unable to find driver directory. Let me try with as per your suggestion.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 6, 2023, 5:07am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/6 "2023-02-06T05:07:15Z")

</div>

i am also compiling legato.cwe insidie VSCode with R16.0.1 package.

Anyway, i don’t think the compilation error is related to legato.cwe, it should be your driver problem.  
You need to check with the vendor.

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 7:05am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/7 "2023-02-06T07:05:15Z")

</div>

I am unable to find driver directory in leaf-data. Could you please let me know the path of driver directory

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 6, 2023, 7:35am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/8 "2023-02-06T07:35:42Z")

</div>

then can you find the legato source folder with in the leaf-data folder?

```auto
owner@ubuntu:~$ ls leaf/leaf-data/wp76/wp76-legato/drivers/
example mangoh spisvc

```

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 8:38am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/9 "2023-02-06T08:38:12Z")

</div>

After cleaning and rebuilding , I am able to see drivers folder. I will add 8021q in driver folder and confirm.

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 9:09am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/10 "2023-02-06T09:09:19Z")

</div>

I have copied 8021q driver source with mdef file in drivers directory and added mdef file path in .sdef directory. But it’s giving compilation error. However , in yocto build, it’s compiled successfully. So there is no issue with driver source. Could you please help me with this. Am I doing wrong process?

error :

```
 "implicit declaration of function ‘vlan_dev_priv’; did you mean ‘netdev_priv’?

```

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 6, 2023, 9:20am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/11 "2023-02-06T09:20:40Z")

</div>

how did you do yocto build on this driver?  
Why don’t you directly use the yocto image then?

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 9:27am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/12 "2023-02-06T09:27:16Z")

</div>

Sites are already deployed without vlan driver as this requirement is new. For doing OTA we are using IPK upgrade method. We don’t have method to upgrade .cwe through OTA. As devices are already deployed in sites, its requirement is to do OTA of this driver through IPK method.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 6, 2023, 9:40am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/13 "2023-02-06T09:40:00Z")

</div>

then how about you take out the driver binary from yocto build, and create a unsandboxed legato applicatin to insmod ?

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 9:44am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/14 "2023-02-06T09:44:38Z")

</div>

This option i have tried with bash script for insmod. But in this case ,getting unknown symbol error after insmod.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 6, 2023, 9:48am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/15 "2023-02-06T09:48:57Z")

</div>

you need to see what is missing in insmod:

> <https://askubuntu.com/questions/1150155/unknown-symbol-in-module-but-what-symbol>

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 9:53am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/16 "2023-02-06T09:53:37Z")

</div>

Yes I have seen mrp ,garp and vlan related symbols as unknown symbols though in source it’s exported. After verifying , observed that those are missing in Module.symverse file. Hence wanted to try with mdef file whether this problem can be resolved.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 6, 2023, 9:58am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/17 "2023-02-06T09:58:34Z")

</div>

then why does yocto build has no problem?

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 10:09am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/18 "2023-02-06T10:09:20Z")

</div>

We are unsure about this , hence trying to get support here. Please suggest what can be done to resolve it.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 6, 2023, 10:18am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/19 "2023-02-06T10:18:44Z")

</div>

have you diff the size and content with the working one and the NOK one?  
have you diff the modinfo?

did you see anything in dmesg?

> <https://stackoverflow.com/questions/48660638/unable-to-insert-kernel-module-unknown-symbol-net-namespace-list>

BTW, I don’t see problem on gvrp.ko and mrp.ko

```auto

root@swi-mdm9x28-wp:~# insmod /tmp/
gvrp.ko ld.so.conf pkgdwl/ sock0
hosts legato/ psm_socket/ thermal_engi_ipc
ld.so.cache mrp.ko resolv.conf tmpfdbtable.txt
root@swi-mdm9x28-wp:~# insmod /tmp/gvrp.ko
root@swi-mdm9x28-wp:~# insmod /tmp/mrp.ko
root@swi-mdm9x28-wp:~# lsmod
    Tainted: G
mrp 7468 0 - Live 0xbf114000 (O)
gvrp 5876 0 - Live 0xbf10f000 (O)
root@swi-mdm9x28-wp:~# ^C
root@swi-mdm9x28-wp:~# cm info
Device: WP7608
IMEI: 352913090512345
IMEISV: E
FSN: XG207430712345
Firmware Version: SWI9X07Y_02.37.03.00 73df45 jenkins 2020/04/08 10:59:14
Bootloader Version: SWI9X07Y_02.37.03.00 73df45 jenkins 2020/04/08 10:59:14
MCU Version: 002.015
PRI Part Number (PN): 9908665
PRI Revision: 001.004
Carrier PRI Name: GENERIC
Carrier PRI Revision: 002.095_003
SKU: 1104194
Last Reset Cause: Power Down
Resets Count: Expected: 334 Unexpected: 0
root@swi-mdm9x28-wp:~#

```

[gvrp.ko](https://forum.legato.io/uploads/short-url/vnK5MK7YSmVpG5aB5a3LEV1xBPI.ko) (200.9 KB)  
[mrp.ko](https://forum.legato.io/uploads/short-url/b1a020RETciuV3XIoV8W0O642Y6.ko) (207.6 KB)

---

<div class="post-metadata">

**Author:** ![amruta](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@amruta](https://forum.legato.io/u/amruta)\
**Post date:** [February 6, 2023, 11:18am UTC](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418/20 "2023-02-06T11:18:39Z")

</div>

I am able to do insmod for mrp but not for garp.  
root@Invendis:~# insmod /home/root/garp.ko  
insmod: can’t insert ‘/home/root/garp.ko’: invalid module format

[2503.134028] garp: module has no symbols (stripped?)  
[2503.134434] garp: module has no symbols (stripped?)

root@Invendis:~# cm info  
Device: WP7608  
IMEI: 352913090489988  
IMEISV: E  
FSN: XG207430230710  
Firmware Version: SWI9X07Y\_02.37.03.00 73df45 jenkins 2020/04/08 10:59:14  
Bootloader Version: SWI9X07Y\_02.37.03.00 73df45 jenkins 2020/04/08 10:59:14  
PRI Part Number (PN): 9908665  
PRI Revision: 001.002  
Carrier PRI Name: GENERIC  
Carrier PRI Revision: 002.095\_003  
SKU: 1104194  
Last Reset Cause: Power Down  
Resets Count: Expected: 25 Unexpected: 0  
root@Invendis:~#

[Next page](https://forum.legato.io/t/unable-to-compile-8021q-module-using-mdef/6418.md?page=2)
