Vero 4K+ nat-rtsp dkms

Hi, I need nat-rtsp kenel module and I’m trying to build it on vero 4k+ with dkms but it fails:

# dkms build -m nat-rtsp -v 0.7+4.18

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...(bad exit status: 2)
make -j4 KERNELRELEASE=3.14.29-160-osmc -C /lib/modules/3.14.29-160-osmc/build M=/var/lib/dkms/nat-rtsp/0.7+4.18/build...(bad exit status: 2)
Error! Bad return status for module build on kernel: 3.14.29-160-osmc (aarch64)
Consult /var/lib/dkms/nat-rtsp/0.7+4.18/build/make.log for more information.

with error:

# cat /var/lib/dkms/nat-rtsp/0.7+4.18/build/make.log
    DKMS make.log for nat-rtsp-0.7+4.18 for kernel 3.14.29-160-osmc (aarch64)
    Sun Apr  4 02:12:54 CEST 2021
    make: Entering directory '/usr/src/vero364-headers-3.14.29-160-osmc'
    gcc: error: unrecognized command line option '-mstrict-align'; did you mean '-Wstrict-aliasing'?
    KBUILD_CFLAGS_MODULE:-DMODULE  
      LD      /var/lib/dkms/nat-rtsp/0.7+4.18/build/built-in.o
      CC [M]  /var/lib/dkms/nat-rtsp/0.7+4.18/build/nf_conntrack_rtsp.o
      CC [M]  /var/lib/dkms/nat-rtsp/0.7+4.18/build/nf_nat_rtsp.o
    gcc: error: unrecognized command line option '-mstrict-align'; did you mean '-Wstrict-aliasing'?
    gcc: error: unrecognized command line option '-mstrict-align'; did you mean '-Wstrict-aliasing'?
    gcc: error: unrecognized command line option '-mgeneral-regs-only'
    gcc: error: unrecognized command line option '-mgeneral-regs-only'
    make[1]: *** [scripts/Makefile.build:315: /var/lib/dkms/nat-rtsp/0.7+4.18/build/nf_conntrack_rtsp.o] Error 1
    make[1]: *** Waiting for unfinished jobs....
    make[1]: *** [scripts/Makefile.build:315: /var/lib/dkms/nat-rtsp/0.7+4.18/build/nf_nat_rtsp.o] Error 1
    make: *** [Makefile:1291: _module_/var/lib/dkms/nat-rtsp/0.7+4.18/build] Error 2
    make: Leaving directory '/usr/src/vero364-headers-3.14.29-160-osmc'

what’s the error that I make?

Thanks in advance.

The kernel is Aarch64, so you would need to use the appropriate toolchain for building. The userland is armhf, so this wouldn’t work.

sudo apt-get install aarch64-toolchain-osmc will get you that toolchain, but you’d need to build your module in a chroot.

We don’t recommend using DKMS – it leads to a lot of problems.
If you let me know the CONFIG_ option needed, I can look at getting this included for you in our kernel so you don’t need to build anything yourself.

Keep in mind that we are moving to a 4.9 kernel imminently. You should try this kernel first.

I think that the only CONFIG is CONFIG_NF_CONNTRACK, in the Makefile I can see:

root@vero:/usr/src/nat-rtsp-0.7+4.18# head -5 Makefile 
ifneq ($(KERNELRELEASE),)
# kbuild part of makefile
ifndef CONFIG_NF_CONNTRACK
$(error ** You need to enable NF_CONNTRACK in your kernel **)
endif

At vero kernel conntrack config is:

root@vero:~# grep NF_CONNTRACK /boot/config-3.14.29-160-osmc 
CONFIG_NF_CONNTRACK=m
CONFIG_NF_CONNTRACK_MARK=y
# CONFIG_NF_CONNTRACK_PROCFS is not set
# CONFIG_NF_CONNTRACK_EVENTS is not set
# CONFIG_NF_CONNTRACK_TIMEOUT is not set
# CONFIG_NF_CONNTRACK_TIMESTAMP is not set
CONFIG_NF_CONNTRACK_LABELS=y
# CONFIG_NF_CONNTRACK_AMANDA is not set
CONFIG_NF_CONNTRACK_FTP=m
# CONFIG_NF_CONNTRACK_H323 is not set
CONFIG_NF_CONNTRACK_IRC=m
CONFIG_NF_CONNTRACK_BROADCAST=m
CONFIG_NF_CONNTRACK_NETBIOS_NS=m
# CONFIG_NF_CONNTRACK_SNMP is not set
# CONFIG_NF_CONNTRACK_PPTP is not set
# CONFIG_NF_CONNTRACK_SANE is not set
CONFIG_NF_CONNTRACK_SIP=m
# CONFIG_NF_CONNTRACK_TFTP is not set
CONFIG_NF_CONNTRACK_IPV4=m
CONFIG_NF_CONNTRACK_IPV6=m

but i don’t know if any config is needit. At my debian server where i have this module working is:

# grep NF_CONNTRACK /boot/config-4.19.0-16-amd64 
CONFIG_NF_CONNTRACK=m
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_CONNTRACK_SECMARK=y
CONFIG_NF_CONNTRACK_ZONES=y
CONFIG_NF_CONNTRACK_PROCFS=y
CONFIG_NF_CONNTRACK_EVENTS=y
CONFIG_NF_CONNTRACK_TIMEOUT=y
CONFIG_NF_CONNTRACK_TIMESTAMP=y
CONFIG_NF_CONNTRACK_LABELS=y
CONFIG_NF_CONNTRACK_AMANDA=m
CONFIG_NF_CONNTRACK_FTP=m
CONFIG_NF_CONNTRACK_H323=m
CONFIG_NF_CONNTRACK_IRC=m
CONFIG_NF_CONNTRACK_BROADCAST=m
CONFIG_NF_CONNTRACK_NETBIOS_NS=m
CONFIG_NF_CONNTRACK_SNMP=m
CONFIG_NF_CONNTRACK_PPTP=m
CONFIG_NF_CONNTRACK_SANE=m
CONFIG_NF_CONNTRACK_SIP=m
CONFIG_NF_CONNTRACK_TFTP=m


# lsmod | grep rtsp
nf_nat_rtsp            20480  0
nf_nat                 36864  3 nf_nat_ipv4,xt_nat,nf_nat_rtsp
nf_conntrack_rtsp      16384  2 nf_nat_rtsp
nf_conntrack          172032  9 xt_conntrack,nf_nat,xt_state,ipt_MASQUERADE,nf_nat_ipv4,xt_nat,nf_conntrack_rtsp,nf_nat_rtsp,xt_CT

Thanks a lot

This is the old kernel. See osmc/vero364-000-add-kernel-config.patch at master · osmc/osmc · GitHub for 4.9 config. You could check and see if what you need is already enabled in this newer kernel

Sam

i think yes, CONFIG_NF_CONNTRACK=m is set as module

Try the new kernel. If anything is missing, I can add it for you.

I follow [TESTING] Linux 4.9 kernel and improved video stack for Vero 4K / 4K + I added to /etc/apt/sources.list:

deb http://apt.osmc.tv videoimprovevero49 main

and dist-upgrade

Now i have a system unable to do anything, the network is slow too slow, i can’t play anything with nfs and another machines conected to the same switch is affected

how can i get back safely to the old kernel?

The eth0 interface speed is 10Mb/s, before upgrade was 1000Mb/s

root@vero:~# ethtool eth0
Settings for eth0:
	Supported ports: [ TP MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	                                     1000baseT/Half 1000baseT/Full 
	Link partner advertised pause frame use: Symmetric Receive-only
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 10Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 0
	Transceiver: external
	Auto-negotiation: on
	Supports Wake-on: ug
	Wake-on: d
	Current message level: 0x0000003f (63)
			       drv probe link timer ifdown ifup
	Link detected: yes

driver now meson6-dwmac:

osmc@vero:~$ ls -laF /sys/class/net/eth0/device/
total 0
drwxr-xr-x  5 root root    0 abr  4 06:00 ./
drwxr-xr-x 98 root root    0 ene  1  2017 ../
lrwxrwxrwx  1 root root    0 abr  4 05:14 driver -> ../../../bus/platform/drivers/meson6-dwmac/

before stmmaceth:

osmc@vero2:~# ls -laF /sys/class/net/eth0/device/
total 0
drwxr-xr-x  7 root root    0 abr  2 16:32 ./
drwxr-xr-x 87 root root    0 abr  2 16:32 ../
lrwxrwxrwx  1 root root    0 abr  4 06:05 driver -> ../../bus/platform/drivers/stmmaceth/

Can you post some logs?

Sam

here it is https://paste.osmc.tv/ixiwepixaq

the eth0 interface is 10Mbs:

root@vero:~# dmesg | grep eth
[    0.000000] psci: probing for conduit method from DT.
[    0.814460] meson6-dwmac c9410000.ethernet: Unable to get resource(264)
[    0.814569] meson6-dwmac c9410000.ethernet: no reset control found
[    0.817789] eth%d: PHY ID 001cc916 at 0 IRQ POLL (stmmac-0:00) active
[    0.817793] eth%d: PHY ID 001cc916 at 7 IRQ POLL (stmmac-0:07)
[    8.425311] meson6-dwmac c9410000.ethernet eth0: fail to init PTP.
[   29.929359] meson6-dwmac c9410000.ethernet eth0: Link is Up - 10Mbps/Full - flow control rx/tx

I’m so sorry, I change the ethernet cable and now i get 1000. When i upgraded the system i didn’t touch it. The same cable with other vero works well, i don’t know why.

root@vero:~# ethtool eth0
Settings for eth0:
   ...
   Speed: 1000Mb/s
	Duplex: Full
   ...
	Link detected: yes

I’m so sorry about your lost time

But now :frowning: I don’t hear anything: https://paste.osmc.tv/ineyirugus

I think a separate post would be best regarding this.

Is the module you needed now available, or do we still need to make changes to include it.

that’s right

the kernel that i have installed is 4.9.113-29 but i don’t find his headers

root@vero:~# aptitude search 4.9.113
p   vero364-headers-4.9.113-22-osmc:arm64      - Header files related to Linux kernel, specifically,
p   vero364-headers-4.9.113-23-osmc:arm64      - Header files related to Linux kernel, specifically,
p   vero364-headers-4.9.113-24-osmc:arm64      - Header files related to Linux kernel, specifically,
p   vero364-headers-4.9.113-25-osmc:arm64      - Header files related to Linux kernel, specifically,
i   vero364-headers-4.9.113-26-osmc:arm64      - Header files related to Linux kernel, specifically,                                              
p   vero364-image-4.9.113-22-osmc:arm64        - Linux kernel binary image for version 4.9.113-22-osmc                                            
p   vero364-image-4.9.113-23-osmc:arm64        - Linux kernel binary image for version 4.9.113-23-osmc                                            
p   vero364-image-4.9.113-24-osmc:arm64        - Linux kernel binary image for version 4.9.113-24-osmc                                            
p   vero364-image-4.9.113-25-osmc:arm64        - Linux kernel binary image for version 4.9.113-25-osmc                                            
p   vero364-image-4.9.113-26-osmc:arm64        - Linux kernel binary image for version 4.9.113-26-osmc                                            
p   vero364-image-4.9.113-27-osmc:arm64        - Linux kernel binary image for version 4.9.113-27-osmc                                            
p   vero364-image-4.9.113-28-osmc:arm64        - Linux kernel binary image for version 4.9.113-28-osmc                                            
i A vero364-image-4.9.113-29-osmc:arm64        - Linux kernel binary image for version 4.9.113-29-osmc

anyway i tried it with headers-4.9.113-26 but it failed with:

root@vero# mount -o bind /usr/src /opt/osmc-tc/aarch64-toolchain-osmc/usr/src/
root@vero# chroot /opt/osmc-tc/aarch64-toolchain-osmc
root@vero# cd /usr/src/nat-rtsp-0.7+4.18
root@vero:/usr/src/nat-rtsp-0.7+4.18# make KERNELDIR=/usr/src/vero364-headers-4.9.113-26-osmc
make -C /usr/src/vero364-headers-4.9.113-26-osmc M=`pwd` modules
make[1]: Entering directory '/usr/src/vero364-headers-4.9.113-26-osmc'
  CC [M]  /usr/src/nat-rtsp-0.7+4.18/nf_conntrack_rtsp.o
In file included from ./arch/arm64/include/asm/sysreg.h:25,
                 from ./arch/arm64/include/asm/cputype.h:108,
                 from ./arch/arm64/include/asm/cachetype.h:19,
                 from ./arch/arm64/include/asm/cache.h:19,
                 from ./include/linux/cache.h:5,
                 from ./include/linux/printk.h:8,
                 from ./include/linux/kernel.h:13,
                 from ./include/linux/list.h:8,
                 from ./include/linux/module.h:9,
                 from /usr/src/nat-rtsp-0.7+4.18/nf_conntrack_rtsp.c:37:
./arch/arm64/include/asm/opcodes.h:5:10: fatal error: ../../arm/include/asm/opcodes.h: No such file or directory
 #include <../../arm/include/asm/opcodes.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:341: /usr/src/nat-rtsp-0.7+4.18/nf_conntrack_rtsp.o] Error 1
make[1]: *** [Makefile:1620: _module_/usr/src/nat-rtsp-0.7+4.18] Error 2
make[1]: Leaving directory '/usr/src/vero364-headers-4.9.113-26-osmc'
make: *** [Makefile:14: all] Error 2

Headers packages are being re-worked. For now you could take the source package which is a bit larger.

But I would suggest checking if the module can just be added to the kernel config, then I can include it on the next build.

how i can do that?

I’ve had a quick check and I don’t think it’s in tree.
The next kernel will have headers which are more complete, but you can use the source package for now.

CC @dillthedog - this could be a good way to verify the header improvements.

No, the nat-rtsp module is not in the tree kernel. I always compiled it apart, at debian with dkms or with:

make KERNELDIR=/usr/src/linux-headers-xxxxx

root@vero:# aptitude search nat-rtsp
i   nat-rtsp-dkms         - Connection tracking and NAT support for RTSP

I don’t mind compiling it myself, as long as I can. I guess not many people need it

I have copied from source what it was missing into the headers:

root@vero:/usr/src/vero364-headers-4.9.113-26-osmc# cp -R ../vero364-source-4.9.113-26-osmc/arch/arm/include  arch/arm/
root@vero:/usr/src/vero364-headers-4.9.113-26-osmc# cp ../vero364-source-4.9.113-26-osmc/arch/arm64/kernel/module.lds arch/arm64/kernel/

and now i can compile it

root@vero:/usr/src/nat-rtsp-0.7+4.18# make KERNELDIR=/usr/src/vero364-headers-4.9.113-26-osmc 
make -C /usr/src/vero364-headers-4.9.113-26-osmc M=`pwd` modules
make[1]: Entering directory '/usr/src/vero364-headers-4.9.113-26-osmc'
  CC [M]  /usr/src/nat-rtsp-0.7+4.18/nf_conntrack_rtsp.o
/usr/src/nat-rtsp-0.7+4.18/nf_conntrack_rtsp.c: In function 'help':
/usr/src/nat-rtsp-0.7+4.18/nf_conntrack_rtsp.c:474:2: warning: enumeration value 'IP_CT_DIR_MAX' not handled in switch [-Wswitch]
  switch (CTINFO2DIR(ctinfo)) {
  ^~~~~~
  CC [M]  /usr/src/nat-rtsp-0.7+4.18/nf_nat_rtsp.o
  Building modules, stage 2.
  MODPOST 2 modules
  CC      /usr/src/nat-rtsp-0.7+4.18/nf_conntrack_rtsp.mod.o
  LD [M]  /usr/src/nat-rtsp-0.7+4.18/nf_conntrack_rtsp.ko
  CC      /usr/src/nat-rtsp-0.7+4.18/nf_nat_rtsp.mod.o
  LD [M]  /usr/src/nat-rtsp-0.7+4.18/nf_nat_rtsp.ko
make[1]: Leaving directory '/usr/src/vero364-headers-4.9.113-26-osmc'

and it loads

root@vero:/usr/src/nat-rtsp-0.7+4.18# modinfo nf_nat_rtsp
filename:       /lib/modules/4.9.113-29-osmc/extra/nf_nat_rtsp.ko
license:        GPL
description:    RTSP network address translation module
author:         Tom Marshall <tmarshall at real.com>
depends:        nf_conntrack_rtsp
vermagic:       4.9.113-26-osmc SMP preempt mod_unload modversions aarch64
parm:           stunaddr:Address for detecting STUN (charp)
parm:           destaction:Action for destination parameter (auto/strip/none) (charp)


root@vero:/usr/src/nat-rtsp-0.7+4.18# lsmod | grep rtsp
nf_nat_rtsp            16384  0
nf_conntrack_rtsp      16384  1 nf_nat_rtsp

Only i just need to try it, maybe tomorrow.

Thanks a lot

I tested nat-rtsp and i need CONFIG_IP_NF_RAW to make nat-rtsp work:

iptables-legacy -A PREROUTING -t raw -p tcp --dport 554 -j CT --helper rtsp

also i need another configuration,
therefore i think the best is that i should create an enviroment to compile the kernel.

I don’t see logic asking for configuration by configuration.

When I have checked all the necessary configurations I will inform you and if you think it is convenient you will add them.

the next question is how to create an environment to compile aarm64 kernel for vero 4k+ from a debian 64b?, and the more important question is how to upgrade and downgrade kernel at vero device safely?

thanks in advance

You seem to be on 4.9.113-29. I downloaded the “image” package and extracted the contents. According to the config file, CONFIG_IP_NF_RAW is built-in to the kernel.

user@disp7538:~/img/boot$ grep RAW config-4.9.113-29-osmc 
CONFIG_IP_NF_RAW=y
CONFIG_IP6_NF_RAW=m
# CONFIG_RAW_DRIVER is not set
CONFIG_SND_RAWMIDI=y
# CONFIG_SND_RAWMIDI_SEQ is not set
CONFIG_HIDRAW=y
CONFIG_USB_SERIAL_SIERRAWIRELESS=m
CONFIG_USB_GADGET_VBUS_DRAW=2

CONFIG_IP_MROUTE doesn’t seem to be in the 4.9.133 kernel but, given that it was in the 3.14 kernel and also appears in the Pi kernels, this is probably just an oversight.

1 Like