Add ch341 and cp210x modules to a precompiled Auvidea kernel

Hi everyone,

I am pretty much starting using Tegra TX1, I have an Auvidea 106 board [url]https://auvidea.com/j106/[/url] and I want to connect two devices that depend on ch341 and cp210x modules, In my newbie experience I understand that I have to crosscompile in some way the precompiled firmware version 2.2 from auvidea: [url]https://auvidea.com/firmware/[/url] (the other versions doesn’t work fully for me, for example the fan does not work in 2.4) and compile it again to add the ch341 and cp210.

I have tried to crosscompile it using this instructions: [url]https://gist.github.com/chutsu/9bb6abe6f61924c88521adec859c7006[/url] but I have errors when compiling the kernel due to linkage of the dt-binding library:

arch/arm64/boot/dts/tegra210-soc-base.dtsi:16:54: fatal error: dt-bindings/interrupt-controller/arm-gic.h: No such file or directory
compilation terminated.

I have expend a lot on time on this and do not know if I am in the correct pad, please can anyone give me a hand or hints about this?.

Thanks.

I don’t have that board, so I don’t have details, but what was your compile command which had this result?

Hi, thanks for answering,

The step where the error shows is: “make dtbs” , on the cross_compile_tx1.bash file of the guide.

I am in the correct path*? Is this the way I can compile a kernel that already has some added firmware (Auvidea’s in this case)?. So far I am only using the kernel provided by auvidea but not using the boot, modules or patch_sources folders they provide, how should I take them on count?.

Thanks for helping this newbie.

The complete error is:

CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTLD scripts/mod/modpost
DTC arch/arm64/boot/dts/tegra210-grenada.dtb
In file included from arch/arm64/boot/dts/tegra210-soc-shield.dtsi:16:0,
from arch/arm64/boot/dts/tegra210-grenada.dts:25:
arch/arm64/boot/dts/tegra210-soc-base.dtsi:16:54: fatal error: dt-bindings/interrupt-controller/arm-gic.h: No such file or directory
compilation terminated.
scripts/Makefile.lib:278: recipe for target ‘arch/arm64/boot/dts/tegra210-grenada.dtb’ failed
make[1]: *** [arch/arm64/boot/dts/tegra210-grenada.dtb] Error 1
/home/user/JetsonPack/64_TX1/Linux_for_Tegra_64_tx1/sources/kernel_source/arch/arm64/Makefile:85: recipe for target ‘dtbs’ failed
make: *** [dtbs] Error 2

The dtbs target doesn’t actually build a kernel. I can’t guarantee it, but likely the device tree provided by Auvidea is correct even if you change the kernel configuration itself. The device tree would be unlikely to change unless you changed the hardware of the carrier board. If the drivers you mention are for serial UARTs via a USB connection then you only need to add the kernel modules and no device tree change is required. What is the exact hardware you need the drivers for…is it USB? Is it custom wired to a GPIO?

Alright, yes they are serial UART via a USB, the ch341 I need it to connect an arduino and the cp210x to connect a Lidar, no custom wired GPIO, can you describe how should I add the kernel modules?

Keep in mind that if you cross compile you will want the “O=/some/where” for output, and that you’d use this in all of your commands, e.g., “make -j4 O=/some/where Image”, “make O=/some/where nconfig”, or “make -j4 O=/some/where modules”. And instead of “make modules_install” you’d use a different output location via something like “make O=/some/where INSTALL_MOD_PATH=/some/where_mod”.

You should start with the copy of the “/proc/config.gz” file from the running system you will add drivers to, set the CONFIG_LOCALVERSION, and then do the nconfig or other editor changes. Here is an example of more details with one of my cross compilers named (it’s the 4.8.5 version):

export CROSS_COMPILE=/usr/local/crosstool-ng/4.8.5/bin/aarch64-unknown-linux-gnu-
export ARCH=arm64
export SRC=/home/me/Documents/embedded/L4T/R28.1/src/kernel/kernel-4.4
export STAGE=/home/me/Documents/embedded/L4T/build
export TEGRA_KERNEL_OUT=/home/me/Documents/embedded/L4T/build/stage
export TEGRA_MODULES_OUT=/home/me/Documents/embedded/L4T/build/modules
export TEGRA_FIRMWARE_OUT=/home/me/Documents/embedded/L4T/build/firmware

# These are up to you...these are temporary output locations.
# STAGE: /home/me/Documents/embedded/L4T/build
rm -Rf /home/me/Documents/embedded/L4T/build/stage/*
rm -Rf /home/me/Documents/embedded/L4T/build/stage/.[a-z]*
rm -Rf /home/me/Documents/embedded/L4T/build/modules/*
rm -Rf /home/me/Documents/embedded/L4T/build/firmware/*

cd /home/dan/Documents/embedded/L4T/R28.1/src/kernel/kernel-4.4

make mrproper
make O=$TEGRA_KERNEL_OUT mrproper
make O=$TEGRA_KERNEL_OUT clean
gzcat /where/ever/config.gz > "${TEGRA_KERNEL_OUT}"/.config
chmod u+w "${TEGRA_KERNEL_OUT}"/.config
# I use vi, you might just use the "make nconfig" or nano or some other editor...probably it is "-tegra" for CONFIG_LOCALVERSION.
vi "${TEGRA_KERNEL_OUT}"/.config

# This is to verify you changed it to something like "-tegra".
egrep CONFIG_LOCALVERSION "${TEGRA_KERNEL_OUT}"/.config

make O=$TEGRA_KERNEL_OUT nconfig

make -j4 O=$TEGRA_KERNEL_OUT Image
make -j4 O=$TEGRA_KERNEL_OUT modules
make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT

If you start with “/proc/config.gz” and set CONFIG_LOCALVERSION to match the current running system’s suffix in “uname -r”, then the Image does not change and you don’t need to add this. Assuming your only change was via module additions, then look after this is done at “$TEGRA_MODULES_OUT” (it’ll have a “lib/modules/$(uname -r)/” subdirectory.

Hi, thanks,

I solved the issue with arm-gic.h by adding a symlink:

$ cd arch/arm/arm64/boot/dts/include/
$ ln -s …/…/…/…/…/include/dt-bindings .

Anyway, I tried to compile the kernel both ways, with dtbs and the way you just recommend me, when testing the kernel, I have the auvidea board working and the modules for ch341 and cp210x, just one problem, with this kernel version I can’t access the fan, I tried to fix it with with the patch to “drivers/platform/tegra/tegra21_clocks.c” like this:

@@ -1062,7 +1062,7 @@
  */
 static void tegra21_cpu_clk_init(struct clk *c)
 {
-	c->state = (!is_lp_cluster() == (c->u.cpu.mode == MODE_G)) ? ON : OFF;
+	c->state = ((!is_lp_cluster()) == (c->u.cpu.mode == MODE_G)) ? ON : OFF;
 }

But no success on having the fan back, do you know what may be wrong?

I’ve never used one of those boards, so I have no way of giving any advice specific to those. Sorry :(

No problem, you just help me a lot here, I can work with an external powered fan at least, thanks a lot!.