[Octoprint] multiple USB serial modules for 5.13.x kernel

Who doesn't love third-party apps? Get together and talk about them here.
User avatar
father.mande
Posts: 1818
youtube meble na wymiar Warszawa
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: [Octoprint] multiple USB serial modules for 5.13.x kernel

Post by father.mande »

Hi,
DQ4HNyBp wrote:I tried both of these but I am still unable to connect. I also tried adding the device mapping to the config.json in the Octoprint app directory and that did not work either.

Thanks for testing ...
my problem is : all works as expected with my Ender 3 (ch431 USB serial driver) ... so I need to get some hardware to generate a ttyACM0 device ... to understand why it's not proposed in Octoprint list of device ... when no error is returned in dmesg ...

Thanks again.
Philippe.
AS6602T / AS5202T /AS5002T / AS1002T / FS6706T
DQ4HNyBp
Posts: 5
Joined: Mon Sep 05, 2022 11:04 pm

Re: [Octoprint] multiple USB serial modules for 5.13.x kernel

Post by DQ4HNyBp »

Thank you again!

And just to clarify: my Prusa printer does not generate a ttyACM0 device, it generates /dev/usbdev1.6

ttyACM0 is listed in my Octoprint app list of devices but since my printer is not mapped to it or any of the tty ones, it cannot connect.
User avatar
father.mande
Posts: 1818
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: [Octoprint] multiple USB serial modules for 5.13.x kernel

Post by father.mande »

Hi,
DQ4HNyBp wrote:Thank you again!

And just to clarify: my Prusa printer does not generate a ttyACM0 device, it generates /dev/usbdev1.6

ttyACM0 is listed in my Octoprint app list of devices but since my printer is not mapped to it or any of the tty ones, it cannot connect.
Strange is like driver not loaded ... only EHCI USB driver identify the USB printer ??? but NOT the cdc-acm driver ...

I will check, thanks for this information. I will generate the driver and see if it load or not (no trace of cdc-acm in /proc/kallsyms

Philippe.
AS6602T / AS5202T /AS5002T / AS1002T / FS6706T
beb
Posts: 3
Joined: Sat Sep 16, 2023 10:20 pm

Re: [Octoprint] multiple USB serial modules for 5.13.x kernel

Post by beb »

Hi father.mande. How do you build kernel modules for ADM? I downloaded the linux 5.13.x source, the ADM toolchain and the driver source. But how do I combine them? To build the driver it seems that I need the kernel headers. Where can I find them? Is there some documentation I am missing? It could be something very straight-forward that I am missing, because I am not experience with building kernel modules :|
User avatar
father.mande
Posts: 1818
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: [Octoprint] multiple USB serial modules for 5.13.x kernel

Post by father.mande »

Hi,
beb wrote:Hi father.mande. How do you build kernel modules for ADM? I downloaded the linux 5.13.x source, the ADM toolchain and the driver source. But how do I combine them? To build the driver it seems that I need the kernel headers. Where can I find them? Is there some documentation I am missing? It could be something very straight-forward that I am missing, because I am not experience with building kernel modules :|
As I know, Asustor don't provide full help and documentation on building kernel module ... (perhaps it's not true)
BUT some info exist (ex. in the developer guide (one for each kernel and sub-level sometimes) ... you can get it in dev. corner : https://developer.asustor.com/ )
generally it's :
... the kernel source with potential change done by Asustor (ex. with sub-level at .x ... not really a standard)
... the Ubuntu version to use at base (in real or virtual system)
... the cross-compiler need to generate the correct architecture modules, kernels and program (ex. for 4.2+ only x86_64 and arm64 are usable, for older arm and x86 also can be used)
... the full kernel header to download in fact kernel source (GPL source in sourceforge.net)
... the kernel config file ... also in sourceforge

... so after the scheme is as usual :
create the Ubuntu and update it, install cross-compiler, get the kernel config file and do change you want, don't forgot to verify the CONFIG_CROSS_COMPILE value in, generate modules ... then test it on real NAS.
... you can't change (easily) the modules.dep file, so use modinfo and insmod, lsmod and not modprobre for your own modules.

If you own the NAS target of your modules and don't want to provide the module for all kernels and sub-level, you can use an Ubuntu chroot to do all (with or without cross-compile) locally on NAS

For the modules itslef, you must know what you do the depends and the how-to load after boot the modules, because A.D.M. restart at boot with its initial content.

Philippe.
NB if your request is short (a special modules) don't hesitate to ask for builder in the forum, some people have lot of experience on doing this, including my small expertise when I have some free time to do it)
NB1 don't also forgot to ask to Asustor (through support) ... sometimes they have the response immediately ...
AS6602T / AS5202T /AS5002T / AS1002T / FS6706T
beb
Posts: 3
Joined: Sat Sep 16, 2023 10:20 pm

Re: [Octoprint] multiple USB serial modules for 5.13.x kernel

Post by beb »

Thank you for your reply. I used a precompiled version I found somewhere for the time being. It worked well until I updated ADM to 4.2.6.ROR2. Now the module can no longer be inserted. This time I am trying (once again) to compile the module myself. I spent a lot of time trying various things but I just have no experience with kernel modules and I am getting nowhere.

I have the toolchain, the kernel source and config and the driver source. I am also running an ubuntu:18.04 docker container on my AS6602T and copied all the stuff inside. This is where I am quite lost and cannot find any additional information on what to do next.

I would like to build the module against the running kernel as I do not plan to release cross-compiled versions. I found this guide on how that is supposed to work. However, there is no build directory inside /lib/modules/5.13.x on the ADM system.

This leads me to believe that I have to compile the kernel source first. However, after installing make and copying the kernel config as .config inside the kernel source and running make, I get:

Makefile:663: include/config/auto.conf: No such file or directory
Makefile:708: include/config/auto.conf.cmd: No such file or directory
make: gcc: Command not found
SYNC include/config/auto.conf.cmd
HOSTCC scripts/basic/fixdep
/bin/sh: 1: gcc: not found
scripts/Makefile.host:95: recipe for target 'scripts/basic/fixdep' failed
make[2]: ***[scripts/basic/fixdep] Error 127
Makefile:550: recipe for target 'scripts_basic' failed
make[1]: *** [scripts_basic] Error 2
Makefile:730: recipe for target 'include/config/auto.conf.cmd' failed
make: *** [include/config/auto.conf.cmd] Error 2

Where do I get the missing auto.conf file from? Also how am I supposed to install the toolchain on the ubuntu container such that e.g. gcc is found?

I would appreciate all the help I can get.
User avatar
Nazar78
Posts: 2084
Joined: Wed Jul 17, 2019 10:21 pm
Location: Singapore
Contact:

Re: [Octoprint] multiple USB serial modules for 5.13.x kernel

Post by Nazar78 »

Just sharing...
beb wrote:I have the toolchain, the kernel source and config and the driver source. I am also running an ubuntu:18.04 docker container on my AS6602T and copied all the stuff inside. This is where I am quite lost and cannot find any additional information on what to do next.
First of all you don't need the toolchain unless you're cross-compiling i.e. from host: x86_x64 to target: arm64.

You'll also need to prepare your build environment i.e. `sudo apt update && sudo apt install build-essentials`. This is to install the normal prerequisites for compiling. If you're building 3rd party modules, some other tools may be required such as autoconf, just install them using the apt package manager.

If you want to preserve the build environment for future use, I don't recommend building on docker because if you have an auto update system for the docker images, the build environment will revert. You can do it in LXC (Linux Center) or chroot environment. If you're compiling on the NAS itself, use tools like tmux or screen so that when your SSH session gets accidentally disconnected, you can reconnect easily. Also you can do it from a more powerful system such as the PC running Virtualbox, this is to speed up the process. I do the compiling on Windows WSL build environment (lesser overhead) using all the available cores/threads on the PC.

To compile additional in-tree modules, enable them the .config, by editing the file manually (=m) or using `make menuconfig`. Then just run `make -j$(cat /proc/cpuinfo|grep processor|wc -l) modules`. After that find your modules in the source tree *.ko. You can strip the modules `strip --strip-debug module.ko` if you're distributing them or just want to save space (insignificant). To compile 3rd party modules, just follow its instructions.

Hope it helps.
AS5304T - 16GB DDR4 - ADM-OS modded on 2GB RAM
Internal:
- 4x10TB Toshiba RAID10 Ext4-Journal=Off
External 5 Bay USB3:
- 4x2TB Seagate modded RAID0 Btrfs-Compression
- 480GB Intel SSD for modded dm-cache (initramfs auto update patch) and Apps

When posting, consider checking the box "Notify me when a reply is posted" to get faster response
Post Reply

Return to “Developer's Corner”