Qnap [ Domoticz ] [ 2022.2.14606 ] lightweight Home Automation System

bon aprés avoir combattu avec le ELF de Bionic pour adapter...

semblerait que le python embarqué du firmware foute pas mal la grouille

du coup je dois forcer l'utilisation de Apache74 en dépendance

et tout semble rouler

Code:
[~] # /etc/init.d/domoticz.sh start
[~] # 2020-11-02 19:11:10.111  Status: Domoticz V2020.2 (c)2012-2020 GizMoCuz
2020-11-02 19:11:10.111  Status: Build Hash: b63341bc0, Date: 2020-04-26 13:47:55
2020-11-02 19:11:10.122  Status: Startup Path: /share/CACHEDEV1_DATA/.qpkg/domoticz/lib_elf/
2020-11-02 19:11:10.163  Status: PluginSystem: Started, Python version '3.7.5'.
2020-11-02 19:11:10.165  Active notification Subsystems: fcm, http (2/13)
2020-11-02 19:11:10.165  Status: WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2020-11-02 19:11:10.168  Status: WebServer(SSL) started on address: 0.0.0.0 with port 443
2020-11-02 19:11:10.169  Starting shared server on: 0.0.0.0:6144
2020-11-02 19:11:10.169  Status: TCPServer: shared server started...
2020-11-02 19:11:10.169  Status: RxQueue: queue worker started...
2020-11-02 19:11:12.170  Status: NotificationSystem: thread started...
2020-11-02 19:11:12.170  Status: EventSystem: reset all events...
2020-11-02 19:11:12.170  Status: EventSystem: reset all device statuses...
2020-11-02 19:11:12.197  Status: Python EventSystem: Initalizing event module.
2020-11-02 19:11:12.197  Status: EventSystem: Started
2020-11-02 19:11:12.197  Status: EventSystem: Queue thread started...
2020-11-02 19:11:12.629  Status: PluginSystem: Entering work loop.

j'essaye d’approfondir demain et créerai un nouveau qpkg
 
updated to latest 20.2.11995

becarefull, run under libc 2.27... not sure of the impact on NAS with lib 2.21 (or others)
require Apache74 as dependency (due to python3 required with some special extension)
 
Heuu, :? Excusez mon ignorance.
Le nouveau QPKG demande que Apache 74 soit installé et tourne.
Comment se procurer ceci ?

Bonne journée
 
Hi,

Did anyone still have this file in his backup?
http://www.qoolbox.fr/ch34.ko_x86_64_kernel_4.2.8.tgz

I'm facing an issue with an USB Serial device on a TS-870 Pro under QTS 4.3.6.1446 (Linux Kernel 4.2.8). This is the last firmware because the NAS is already EOL :'( so QTS 4.4 is not an option.
The device is QinHeng Electronics HL-340 USB-Serial adapter and supported with ch341.ko module
Thanks to the GPL QTS linux kernel I have been able to compile the drivers but I am not able to install it. Modinfo give me the right vermagic.
I have compile the driver directly from the QNAP with GCC installed by opkg. I have compile the ch341.c provided in the GPL QTS folder as well as the one provided by the manufacturer and I got the same issue. I have also tested to compile on a Debian Jessie with 4.2.8 kernel. But same issue...

# modinfo ch341.ko
filename: ch341.ko
license: GPL
author: <tech@wch.cn>
description: WCH CH34x USB to serial adaptor driver
alias: usb:v1A86p5523d*dc*dsc*dp*ic*isc*ip*in*
depends: usbserial
vermagic: 4.2.8 SMP mod_unload

But when installing:
# insmod ch341.ko
insmod: can't insert 'ch341.ko': invalid module format

Thanks for your help.
 
Thanks a lot!
I will give a try at home.
Could you please explain the main lines to achieve this? I mean compiling modules from GPL sources code. If yours is working I have probably done something wrong.
Thanks for advance.
 
Hey Qoolbox!

Seems to work like a charme. At least the module is loaded correctly. Thanks again!!!
Could you please tell me more about the way to patch GPL / Compile module, if that not bother you too much. ;) The main lines could be enought.

Edit: Confirmed. Module is 100% working! :giggle: Thanks again for that.
 
Here are what I have done but still not work. What do I miss?


# Install Ubuntu 15.04

# Edit /etc/ apt/ sources.list

deb http://old-releases.ubuntu.com/ubuntu/ vivid main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ vivid main restricted
deb http://old-releases.ubuntu.com/ubuntu/ vivid-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ vivid-updates main restricted

# Update packages and install dev tools
apt-get update
apt-get install make binutils gcc-4.9 libssl-dev libelf-dev libncurses5-dev

# Create directories in home dir
cd /home/user
mkdir build
mkdir build/kernel
mkdir build/qts
mkdir build/compiled

# Download and extract kernel sources
cd build/kernel
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.2.8.tar.xz
tar -xvzf linux-4.2.8.tar.xz

# Download and extract GPL sources
cd ../qts
wget https://sourceforge.net/projects/qosgpl/files/QNAP%20NAS%20GPL%20Source/QTS%204.3.5/GPL_QTS-4.3.5-20181105.tar.gz
tar -xvzf GPL_QTS-4.3.5-20181105.tar.gz

# Copy config file
cd ..
cp qts/GPL_QTS/kernel_cfg/TS-X71/linux-4.2-x86_64.config kernel/linux-4.2.8/.config

# Compiling
cd linux-4.2.8
make menuconfig

Device Drivers --> USB Adapters ---> USB --> Serial --> CH341

make
make modules_install INSTALL_MOD_PATH=/home/user/build/compiled

# Compiled drivers
/home/user/build/compiled/lib/modules/4.2.8/kernel/drivers/usb/serial/ch341.ko


Thanks for your help.
 
there is an header to modify before compiling in Kernel 4.2.8 due to UTS Release

you can see the problem when loading your driver and immediatly do a dmesg

Code:
GPL_TS/src/linux-4.2/include/generated/utsrelease.h

modify

Code:
#define UTS_RELEASE "4.2.8+"
into
Code:
#define UTS_RELEASE "4.2.8"

mv linux-4.2-x86_64.config .config #config file provided from QNAP directory kernel source tree

Code:
make ARCH=x86_64 prepare
make ARCH=x86_64 scripts

ARCH=x86_64 make menuconfig  ..... etc , etc...


:geek:
 
Yes but...

insmod ch341.ko
insmod: can't insert 'ch341.ko': invalid module format

dmesg
[441121.414530] Module len 16390 truncated

cat GPL_QTS_4.3.6/src/linux-4.2/include/generated/utsrelease.h
#define UTS_RELEASE "4.2.8"

cat kernel/linux-4.2.8/include/generated/utsrelease.h
#define UTS_RELEASE "4.2.8"

Still lock at the same point...

So I wonder if I have to compile inside the QTS folder? The kernel folder? Copy QTS to Kernel then compile?
 
How can I by-pass this error when compiling?

drivers/scsi/sd.c: In function 'qnap_is_iscsi_disk':
or
scsi_sysfs.c:(.text+0xf6e25): undefined reference to `qnap_is_iscsi_disk'

Thanks for helping.
 
Thanks for th link but even if it is written ${VERSION} :=4.14 I think this HOW-TO is for 4.41. Just a typing mistake.
It help for compiling GPL but still get the same error when insmod.
 
Hey!
I have made some few other test on an Ubuntu 14.04 x64 server VM but still have

Code:
# insmod ch341.ko
insmod: can't insert 'ch341.ko': invalid module format

I'm using QNAP GPL 4.3.6 and latest Crosstool x86 from sourceforge.

What I need is only compling drivers.

What I have done

Code:
export CROSS=/to/crosstools/folder/cross-prefix

export CXX=${CROSS}-g++                 
export LD=${CROSS}-ld                 
export AS=${CROSS}-as               
export AR=${CROSS}-ar                  
export CC=${CROSS}-gcc

cp -af /to/qnap/gpl/kernel_cfg/model/linux-4.2-x86_64.config /to/qnap/gpl/src/linux-4.2.8/.config

cd /to/qnap/gpl/src/linux-4.2

make ARCH=x86_64 CROSS_COMPILE=${CROSS}- prepare
make ARCH=x86_64 CROSS_COMPILE=${CROSS}- scripts

make M=drivers/usb/serial ARCH=x86_64 \
CROSS_COMPILE=${HOST}- \
CONFIG_USB_SERIAL=m \
CONFIG_USB_SERIAL_CH341=m \
modules

I think I am almost at my goal but I do have missing a little things...

@qoolbox: I have compare with modinfo my ch34x.ko and the on you have provided and the difference is the depends fiel. Mine have usbserial and yours have anythings. How did you do that? Maybe it is on of the cause of my issue?

Thanks for helping.
 
found my old archives

was :

Code:
RIAL DRIVER

make ARCH=x86_64 prepare
make ARCH=x86_64 scripts

make M=drivers/usb/serial ARCH=x86_64    \
CONFIG_USB_SERIAL_AIRCABLE=m 		\
CONFIG_USB_SERIAL_ARK3116=m    \
CONFIG_USB_SERIAL_BELKIN=m	     \
CONFIG_USB_SERIAL_CH341=m         \
CONFIG_USB_SERIAL_CP210X=m        \
CONFIG_USB_SERIAL_CYBERJACK=m	      \
CONFIG_USB_SERIAL_CYPRESS_M8=m       \
CONFIG_USB_SERIAL_DEBUG=m	        \
CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m       \
CONFIG_USB_SERIAL_EDGEPORT=m        	\
CONFIG_USB_SERIAL_EDGEPORT_TI=m	       \
CONFIG_USB_SERIAL_EMPEG=m      	 \
CONFIG_USB_SERIAL_F81232=m     \
CONFIG_USB_SERIAL_F8153X=m	             \
CONFIG_USB_SERIAL_FTDI_SIO=m         	\
CONFIG_USB_SERIAL_GARMIN=m          	\
CONFIG_USB_SERIAL_IPAQ=m           	\
CONFIG_USB_SERIAL_IPW=m	          \
CONFIG_USB_SERIAL_IR=m	             \
CONFIG_USB_SERIAL_IUU=m            	\
CONFIG_USB_SERIAL_KEYSPAN=m             \
CONFIG_USB_SERIAL_KEYSPAN_PDA=m            \
CONFIG_USB_SERIAL_KLSI=m              	\
CONFIG_USB_SERIAL_KOBIL_SCT=m          \
CONFIG_USB_SERIAL_MCT_U232=m      	\
CONFIG_USB_SERIAL_METRO=m	        \
CONFIG_USB_SERIAL_MOS7720=m               \
CONFIG_USB_SERIAL_MOS7840=m	            \
CONFIG_USB_SERIAL_MXUPORT=m	            \
CONFIG_USB_SERIAL_NAVMAN=m          	\
CONFIG_USB_SERIAL_OMNINET=m	            \
CONFIG_USB_SERIAL_OPTICON=m	       \
CONFIG_USB_SERIAL_OPTION=m           	\
CONFIG_USB_SERIAL_OTI6858=m         	\
CONFIG_USB_SERIAL_PL2303=m        	\
CONFIG_USB_SERIAL_QCAUX=m	        \
CONFIG_USB_SERIAL_QUALCOMM=m              	\
CONFIG_USB_SERIAL_QT2=m	          \
CONFIG_USB_SERIAL_SAFE=m           	\
CONFIG_USB_SERIAL_SIERRAWIRELESS=m	           \
CONFIG_USB_SERIAL_SIMPLE=m	       \
CONFIG_USB_SERIAL_SPCP8X5=m	             \
CONFIG_USB_SERIAL_SSU100=m              	\
CONFIG_USB_SERIAL_SYMBOL=m            	\
CONFIG_USB_SERIAL_WWAN=m          	\
CONFIG_USB_SERIAL_TI=m           	\
CONFIG_USB_SERIAL_UPD78F0730=m          	\
CONFIG_USB_SERIAL_VISOR=m        	\
CONFIG_USB_SERIAL_WISHBONE=m           	\
CONFIG_USB_SERIAL_WHITEHEAT=m             	\
CONFIG_USB_SERIAL_XIRCOM=m              	\
CONFIG_USB_SERIAL_XSENS_MT=m          	\