Unable to compile 8021q module using mdef

I have downloaded source from https://github.com/mangOH/meta-mangoh.

There is no legato folder to do bin/configlegatoenv in mangoh layer. Could you please let me know , Where is the process going wrong.

(lsh) amruta@amruta-HP-348-G3:~/Amruta_workspace/mangOH$ ls
apps components env_test_yellow.sdef green.sdef linux_kernel_modules README.md samples shared.sdef tools
build Dockerfile experimental LICENSE.txt Makefile red.sdef scripts sinc yellow.sdef
(lsh) amruta@amruta-HP-348-G3:~/Amruta_workspace/mangOH$

(lsh) amruta@amruta-HP-348-G3:~/Amruta_workspace/mangOH$ make red_wp76xx
Makefile:86: ==== OCTAVE_ROOT not defined ====
Not building LEGATO due to $LEGATO == 0

NOTE: When using leaf, these TOOLCHAIN_X variables don’t need to be passed to mksys.

TOOLCHAIN_DIR=/opt/swi/SWI9X07Y_02.37.10.00/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi
TOOLCHAIN_PREFIX=arm-poky-linux-gnueabi-
OCTAVE=
mksys -t wp76xx --cflags=-O2 --object-dir=build/red_wp76xx --output-dir=build/update_files red.sdef
** ERROR:
/home/amruta/Amruta_workspace/mangOH/shared.sdef:21:4: error: Can’t find definition file (dataHub.adef) or binary app (dataHub.wp76xx.app) for app specification ‘/home/amruta/Amruta_workspace/mangOH/apps/DataHub/dataHub’.
Note: Looked in the following places:
‘.’

Makefile:115: recipe for target ‘red_wp76xx’ failed
make: *** [red_wp76xx] Error 1
(lsh) amruta@amruta-HP-348-G3:~/Amruta_workspace/mangOH$
(lsh) amruta@amruta-HP-348-G3:~/Amruta_workspace/mangOH$

I have used above link to download layer as I was unable to download source from document.

Why don’t you use my mangoh source?
It should be able to compile…

“. bin/configlegatoenv” is for legato source inside the leaf-data folder where you did “make wp76xx” in leaf shell

I am unable to download from the document provided

maybe your PC problem then

Could you please share github link to download it?

I don’t have github link,I just use that source in the word document

BTW, can you compile the legato.cwe inside the leaf-data folder?
If yes, you can add the driver there in legato source and see if you can compile the binary.
In this way, you don’t need to compile the mangoh layer

Thanks. I could compile the mangoh with given docuement in github link .I will try to compile driver and update the status

I could compile driver with this layer and also able to do insmod. I will test other VLAN functionalities. Thanks.

root@Invendis:~# lsmod
Tainted: G
8021q 24076 0 - Live 0xbf00f000 (O)
mrp 7436 1 8021q, Live 0xbf009000 (O)
garp 5844 1 8021q, Live 0xbf004000 (O)
spisvc 1045 0 - Live 0xbf000000 (O)
root@Invendis:~#

I am getting segmentation fault with driver built using mdef. With yocto build it’s working fine. Could you please let me know whether anything missing in this process.
root@Invendis:~# ip link add link eth1 name eth1.3719 type vlan id 3719
Segmentation fault
root@Invendis:~#

why don’t you just pull out the binary driver from yocto build after loading to module if it is working fine?

We have done this experiment earlier but it’s giving same result as segmentation fault

Then that means there is other driver difference…

Did this vlan driver depend on other driver? (you might check lsmod)

Did you add debug message in the driver to see why there is such crash?

Did you check dmesg to see if there is any clue?

Did you consulte the driver vendor?

Let me explain three testing scenarios :

  1. Built yocto image with 8021q driver. Flashed yocto.cwe file and tested vlan which was working fine. We need IPK for this driver as this is new requirement and we can’t do OTA for yocto image.
  2. To generate IPK for driver , we tried to pull out .ko file from yocto build and directly copied in device overlay. While doing insmod for driver , it was failing with Unknown symbol errors. So we decided to use solution of .mdef file as symbols were seen un Module.symverse file.
  3. Built .ko files with Mangoh layer and legato 11.2 (rel 16 toolchain). Driver got built successfully and also insmod was successful. But when trying use vlan related commands , commands were failing either as segmentation fault or command got stuck and it’s not returing to promp. In logread -f message , no error logs found.
    Could you please help to debug this further?

With yocto image:

root@Invendis:~# modinfo garp
filename: /lib/modules/3.18.140/kernel/net/802/garp.ko
license: GPL
parm: garp_join_time:Join time in ms (default 200ms)
depends:
intree: Y
vermagic: 3.18.140 preempt mod_unload ARMv7 p2v8
root@Invendis:~#

root@Invendis:~# modinfo mrp
filename: /lib/modules/3.18.140/kernel/net/802/mrp.ko
license: GPL
parm: mrp_periodic_time:Periodic time in ms (default 1s)
parm: mrp_join_time:Join time in ms (default 200ms)
depends:
intree: Y
vermagic: 3.18.140 preempt mod_unload ARMv7 p2v8
root@Invendis:~#

root@Invendis:~# modinfo 8021q
filename: /lib/modules/3.18.140/kernel/net/8021q/8021q.ko
license: GPL
version: 1.8
alias: rtnl-link-vlan
srcversion: 533BB7E5866E52F63B9ACCB
depends: mrp,garp
intree: Y
vermagic: 3.18.140 preempt mod_unload ARMv7 p2v8
root@Invendis:~#

================================================================================================
Out of tree

root@Invendis:~# modinfo /reap/Invendis/lib/garp.ko
filename: /reap/Invendis/lib/garp.ko
license: GPL
parm: garp_join_time:Join time in ms (default 200ms)
depends:
vermagic: 3.18.140 preempt mod_unload ARMv7 p2v8
root@Invendis:~#
root@Invendis:~#
root@Invendis:~#
root@Invendis:~# modinfo /reap/Invendis/lib/mrp.ko
filename: /reap/Invendis/lib/mrp.ko
license: GPL
parm: mrp_periodic_time:Periodic time in ms (default 1s)
parm: mrp_join_time:Join time in ms (default 200ms)
depends:
vermagic: 3.18.140 preempt mod_unload ARMv7 p2v8
root@Invendis:~# modinfo /reap/Invendis/lib/8021q.ko
filename: /reap/Invendis/lib/8021q.ko
license: GPL
version: 1.8
alias: rtnl-link-vlan
srcversion: F7F588650418F42A1BFDFA9
depends: mrp,garp
vermagic: 3.18.140 preempt mod_unload ARMv7 p2v8
root@Invendis:~#

dmesg logs for out of tree module :

[ 284.578757] ------------[ cut here ]------------
[ 284.578788] kernel BUG at /usr/src/kernel/include/linux/if_vlan.h:216!
[ 284.578803] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
[ 284.578818] Modules linked in: 8021q(O) mrp(O) garp(O) spisvc(O)
[ 284.578862] CPU: 0 PID: 3696 Comm: ip Tainted: G O 3.18.140 #1
[ 284.578881] task: c13ab700 ti: cc504000 task.ti: cc504000
[ 284.578910] PC is at dev_disable_lro+0xc/0x154
[ 284.578931] LR is at inetdev_init+0x90/0x158
[ 284.578948] pc : [] lr : [] psr: 20000013
[ 284.578948] sp : cc505aa8 ip : a4f99e99 fp : cc505d04
[ 284.578964] r10: c876a520 r9 : 00000000 r8 : c0f1d490
[ 284.578978] r7 : c0e5b048 r6 : c876a000 r5 : 00000000 r4 : cd301200
[ 284.578992] r3 : 00000001 r2 : 00000001 r1 : c09edec7 r0 : c876a000
[ 284.579009] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 284.579024] Control: 10c53c7d Table: 8c5fc059 DAC: 00000051
[ 284.579038] Process ip (pid: 3696, stack limit = 0xcc504208)
[ 284.579054] Stack: (0xcc505aa8 to 0xcc506000)
[ 284.579074] 5aa0: 00000005 00000000 c876a000 c0e5b048 c0f1d490 c0707484
[ 284.579096] 5ac0: cc505d04 c07d8618 cc505d04 c07d86cc c0e5b048 c0675338 c0f19658 c0f195fc
[ 284.579117] 5ae0: 00000000 c07b888c c0f22554 d2ad9a23 cc505b44 fffffffa 00000000 00000005
[ 284.579138] 5b00: cc505b44 c0f1d490 00000000 c876a520 cc505d04 c00362ec c876a000 00000000
[ 284.579159] 5b20: 00005820 00000000 e039007b c0036368 00000000 00000005 cc505b44 c0680b88
[ 284.579179] 5b40: 00000005 c876a000 00000000 c0687308 c876a000 cc505b5c 00000001 cdb38800
[ 284.579201] 5b60: c876a000 cbda5d80 cbda5d9c 00000e87 00000007 bf00f8dc bf012efc c876a000
[ 284.579222] 5b80: c0f19658 00000000 bf0117a4 cc505ba8 cc505c00 c0695800 cc505c00 cc505ca0
[ 284.579242] 5ba0: 00000004 c025f650 00000000 cbdb1048 00000000 00000000 00000000 00000000
[ 284.579263] 5bc0: c088dfa2 00009000 000005df c29ed0c0 cbdb1010 cc505bc0 00000000 c0f19658
[ 284.579283] 5be0: 00000000 cdb25500 00000000 cbdb103c cbdb1044 00000000 00000000 00000000
[ 284.579303] 5c00: 00000000 00000000 00000000 cbdb1028 00000000 cbdb1020 00000000 00000000
[ 284.579323] 5c20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 284.579342] 5c40: 00000000 00000000 cbdb1038 00000000 00000000 00000000 00000000 00000000
[ 284.579362] 5c60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 284.579382] 5c80: 00000000 00000000 00000000 00000000 31687465 3137332e 00000039 00000000
[ 284.579402] 5ca0: 6e616c76 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 284.579421] 5cc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 d2ad9a23
[ 284.579442] 5ce0: cfc752ac 00000000 cbdb1000 00000000 c29ed0c0 cc505d54 00000000 00000000
[ 284.579464] 5d00: cc505e00 c069597c 00000007 c02525a0 ccd44240 c0252618 cec19000 c0f1a2f8
[ 284.579485] 5d20: cbdb1000 c29ed0c0 c06958d0 ce478c00 cc505d54 c06a5e20 c29ed0c0 c29ed0c0
[ 284.579506] 5d40: 00000050 c0693f3c ced52400 c06a57fc ce478c00 7fffffff 00000000 c29ed0c0
[ 284.579527] 5d60: 00000000 cc505f7c ce478c00 00000050 00000000 c06a5ca8 0000001c c0f2351c
[ 284.579548] 5d80: cc504000 00000008 cbf08700 00000000 00000e70 00000000 00000000 00000000
[ 284.579569] 5da0: 00000000 ce9e5e00 cc505f7c 00000050 c06a5964 00000000 ce9e5e00 cc505e64
[ 284.579589] 5dc0: 00000000 c066e9f0 00000000 00000000 00000000 cc505e00 c13ab700 00000000
[ 284.579609] 5de0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 284.579630] 5e00: c0a0d9cb c09ee774 cfc753c8 00000050 ce9e5e00 cda00aa8 cc505d88 cc505f7c
[ 284.579651] 5e20: cc505ec4 cc505e64 00000051 00000128 00000000 cc505e64 00000008 00000000
[ 284.579672] 5e40: cc505f7c cc505f7c 00000050 00000000 cc505ea4 c066fbb0 c0e5b048 c00af9d0
[ 284.579693] 5e60: 00000119 be8956bc 00000000 cd301e00 00000000 cc504000 cc5fc000 fffffffe
[ 284.579714] 5e80: 0000024c 000005f4 00000080 00000093 cc505fb0 cec0dc00 ce7f7000 cc505fb0
[ 284.579736] 5ea0: be893000 cda00aa8 000000a9 c13ab700 ce7f7000 00000817 cc504000 c00172a4
[ 284.579757] 5ec0: 7f5e6000 00000010 00000000 00000000 c8eb4000 ce7f7048 c0f7fa24 00000800
[ 284.579778] 5ee0: 00000000 c00dee44 00000041 00000817 c0e6489c be893000 cc505fb0 10c53c7d
[ 284.579799] 5f00: be8956b0 7f5e1cf0 be88d5c0 c00084e4 ceb33438 00000011 00000002 00000432
[ 284.579820] 5f20: 00000000 00000000 cc504000 00000001 cc505f44 c003a3a8 cec01b80 00000051
[ 284.579842] 5f40: be88d5c0 d2ad9a23 c000e8a4 ce9e5e00 00000000 be88d5c0 00000128 c000e8a4
[ 284.579863] 5f60: cc504000 00000000 be88d5c0 c0670c8c ce7f7000 00000000 fffffff7 cc505ec4
[ 284.579883] 5f80: 0000000c cc505e64 00000001 00000000 00000000 00000000 be89566c be88d5ac
[ 284.579904] 5fa0: 00000000 c000e6e0 be89566c be88d5ac 00000003 be88d5c0 00000000 00000000
[ 284.579925] 5fc0: be89566c be88d5ac 00000000 00000128 7f5e2008 63e5ebf3 7f5e1cf0 be88d5c0
[ 284.579946] 5fe0: 00000064 be88d568 7f5ac5cc b6e5fa64 600f0010 00000003 00000000 00000000
[ 284.579999] [] (dev_disable_lro) from [] (_raw_spin_lock_irqsave+0x20/0x28)
[ 284.580031] [] (_raw_spin_lock_irqsave) from [] (skb_dequeue+0x64/0x6c)
[ 284.580059] [] (skb_dequeue) from [] (wireless_nlevent_flush+0x70/0x98)
[ 284.580085] [] (wireless_nlevent_flush) from [] (0xc876a520)
[ 284.580111] Code: eaffe757 e590312c e3130001 0a000000 (e7f001f2)
[ 284.580131] —[ end trace 17357dcbf7508d92 ]—
[ 284.580152] BUG: sleeping function called from invalid context at /usr/src/kernel/kernel/locking/rwsem.c:41
[ 284.580167] in_atomic(): 0, irqs_disabled(): 128, pid: 3696, name: ip
[ 284.580184] CPU: 0 PID: 3696 Comm: ip Tainted: G D O 3.18.140 #1
[ 284.580224] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[ 284.580248] [] (show_stack) from [] (down_read+0x18/0x48)
[ 284.580276] [] (down_read) from [] (exit_signals+0x14/0x12c)
[ 284.580303] [] (exit_signals) from [] (do_exit+0xcc/0x8a8)
[ 284.580327] [] (do_exit) from [] (die+0x208/0x240)
[ 284.580350] [] (die) from [] (do_undefinstr+0xec/0x21c)
[ 284.580372] [] (do_undefinstr) from [] (__und_svc_finish+0x0/0x20)
[ 284.580387] Exception stack(0xcc505a58 to 0xcc505aa0)
[ 284.580403] 5a40: c876a000 c09edec7
[ 284.580424] 5a60: 00000001 00000001 cd301200 00000000 c876a000 c0e5b048 c0f1d490 00000000
[ 284.580445] 5a80: c876a520 cc505d04 a4f99e99 cc505aa8 c0706ee0 c0686e3c 20000013 ffffffff
[ 284.580468] [] (__und_svc_finish) from [] (dev_disable_lro+0xc/0x154)
[ 284.580491] [] (dev_disable_lro) from [] (_raw_spin_lock_irqsave+0x20/0x28)
[ 284.580515] [] (_raw_spin_lock_irqsave) from [] (skb_dequeue+0x64/0x6c)
[ 284.580538] [] (skb_dequeue) from [] (wireless_nlevent_flush+0x70/0x98)
[ 284.580559] [] (wireless_nlevent_flush) from [] (0xc876a520)
root@Invendis:~#

which one is crashing?
mrp?garp? 8021q?

BTW, the srcversion is different for 8021q.ko.

8021q is crashing after using command :
ip link add link eth1 name eth1.3719 type vlan id 3719

why the srcversion is different for 8021q.ko?

it says “intree: Y”, so maybe you are using different source code…

It’s different because one is built from yocto build other is out of tree using mdef