Unable to compile 8021q module using mdef

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 (53.9 KB)

are you able to compile the legato.cwe ?

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.

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

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

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.

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.

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

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

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

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

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’?

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

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.

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

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

you need to see what is missing in insmod:

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.

then why does yocto build has no problem?

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

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?

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



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 (200.9 KB)
mrp.ko (207.6 KB)

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:~#