What's new

Help needed for cross-compiling driver

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

svollebregt

Occasional Visitor
I want to enable support for the RT5370 by compiling a kernel driver module. Natively, the used 2.6.36 kernel doesn't seem to have these drivers in the source, but I found a driver package from the manufacturer which should work with the 2.6.36 kernel: https://harkko.lattu.biz/notes/rt5370_ubuntu.html (direct link to package: https://harkko.lattu.biz/notes/rt53...3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.bz2)

I set up my cross-compile build environment using Ubuntu 18.04, downloaded the git source of the latest Merlin release and the toolchains, set up the paths, and can now successfully build the RT-AC68u image. So far for the easy part...

I noticed the Makefile of the driver package includes many different platforms, so I added one to help it point to the toolchain:

Code:
ifeq ($(PLATFORM),MERLIN)
LINUX_SRC = /home/router/asuswrt-merlin.ng/release/src-rt-6.x.4708/linux/linux-2.6.36/
CROSS_COMPILE = /opt/brcm-arm/bin/arm-linux-
CROSS_COMPILE_INCLUDE = /opt/brcm-arm/lib/
endif

It seems to find the cross-compiler, but it has troubles finding some libraries, adding the cross_compile_include variable didn't seem to fix this... I now get the following error:

Code:
make -C tools
make[1]: Entering directory '/home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/tools'
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory '/home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/tools'
/home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/tools/bin2h
cp -f os/linux/Makefile.6 /home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/Makefile
make -C /home/router/asuswrt-merlin.ng/release/src-rt-6.x.4708/linux/linux-2.6.36/ SUBDIRS=/home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux modules
make[1]: Entering directory '/home/router/asuswrt-merlin.ng/release/src-rt-6.x.4708/linux/linux-2.6.36'
  CC [M]  /home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../common/crypt_md5.o
/home/router/am-toolchains/brcm-arm-sdk/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/../libexec/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
scripts/Makefile.build:233: recipe for target '/home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../common/crypt_md5.o' failed
make[2]: *** [/home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../common/crypt_md5.o] Error 1
Makefile:1387: recipe for target '_module_/home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux' failed
make[1]: *** [_module_/home/router/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux] Error 2
make[1]: Leaving directory '/home/router/asuswrt-merlin.ng/release/src-rt-6.x.4708/linux/linux-2.6.36'
Makefile:363: recipe for target 'LINUX' failed
make: *** [LINUX] Error 2
Probably I am missing something trivial, anyone who can help to get this working?
 
Last edited:
I managed to build the driver by setting the library path with
export LD_LIBRARY_PATH="bla" and enabling support for various 802.11 options as module in the kernel source and rebuilding the kernel in my build environment.

However, loading the 802.11 modules on which the driver surely depends gives all kind of 'disagrees about version of symbol X' errors, suggesting that enabling these kernel modules also changes stuff in the kernel itself.

Did anyone actually manage to get USB Wifi support enabled on Asus routers without having to load a firmware image with 802.11 support enabled? Would this conflict with the configuration of Asus his closed-source modules?
 
svollebregt,

Would you be willing to help me, work with me or teach me how to compile irqbalance for ARM64? I have wanted to get that running on my device for ages now.

Thanks,
J
 
Would that be for an Asus device or something else? If something else, do you have access to the cross-compile toolchain? On first look irqbalance should be able to be compiled for AArch64 (ARM64), just need to know if you need a specific toolchain and then set the .configure to point to the toolchain.

Irqbalance source: https://github.com/Irqbalance/irqbalance
 
I was able to build the complete firmware image for RT-AC68u, but also having a problem just using the cross-compiler tools to build a simple program.

mhorn@merlin:~/uhubctl$ which arm-brcm-linux-uclibcgnueabi-gcc
/opt/brcm-arm/bin/arm-brcm-linux-uclibcgnueabi-gcc
mhorn@merlin:~$ cat hello.c
#include "stdio.h"

int main(void) {
printf("Hello world !\n");
return 0;
}
mhorn@merlin:~$ arm-brcm-linux-uclibcgnueabi-gcc hello.c
cleardot.gif

/home/mhorn/am-toolchains/brcm-arm-sdk/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/../libexec/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory


Most cross-compilers you would be able to compile such a simple program, but this tool chain is not working.

Is there some basic set of environment variables that need to be set to use the cross compiler?
 
Last edited:

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top