Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile a driver #1

Open
frasou opened this issue Jul 27, 2022 · 3 comments
Open

Unable to compile a driver #1

frasou opened this issue Jul 27, 2022 · 3 comments

Comments

@frasou
Copy link

frasou commented Jul 27, 2022

Hello, when I try to compile this driver a got this error message:

rm -f *.mod.c *.o .ko ..cmd *.symvers
make -C /lib/modules/5.15.52-gentoo-dist/build/ M=/tmp/ccc/asix_ax99100_linux modules

make[1]: Entering directory '/usr/src/linux-5.15.52-gentoo-dist'
CC [M] /tmp/ccc/asix_ax99100_linux/ax99100_spi.o
CC [M] /tmp/ccc/asix_ax99100_linux/ax99100_sp.o
CC [M] /tmp/ccc/asix_ax99100_linux/parport_pc.o
/tmp/ccc/asix_ax99100_linux/ax99100_sp.c: In function ‘serial99100_dma_rx_tasklet’:
/tmp/ccc/asix_ax99100_linux/ax99100_sp.c:2502:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
2502 | if (up->k_lsr & UART_LSR_OE)
| ^~
/tmp/ccc/asix_ax99100_linux/ax99100_sp.c:2505:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
2505 | up->k_lsr &= up->port.read_status_mask;
| ^~
/tmp/ccc/asix_ax99100_linux/ax99100_sp.c: At top level:
/tmp/ccc/asix_ax99100_linux/ax99100_sp.c:3124:25: error: expected declaration specifiers or ‘...’ before string constant
3124 | MODULE_SUPPORTED_DEVICE("Asix serial 99100");
^~~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:288: /tmp/ccc/asix_ax99100_linux/ax99100_sp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:1871: /tmp/ccc/asix_ax99100_linux] Error 2
make[1]: Leaving directory '/usr/src/linux-5.15.52-gentoo-dist'
make: *** [Makefile:41: default] Error 2

Can you help me please with this issue?

@tonykew
Copy link

tonykew commented Mar 4, 2023

Comment the line defining MODULE_SUPPORTED_DEVICE

//MODULE_SUPPORTED_DEVICE("Asix serial 99100");

The only reference I could find to MODULE_SUPPORTED_DEVICE is here:
https://elixir.bootlin.com/linux/v5.11.22/source/include/linux/module.h#L34

/* Not Yet Implemented */
#define [MODULE_SUPPORTED_DEVICE]

looks like "MODULE_SUPPORTED_DEVICE" was never used.

@junkbustr
Copy link

Same issue as OP.

Commenting out the MODULE_SUPPORTED_DEVICE allows the build to proceed (with warnings). However, it fails to install:

$ make
rm -f *.mod.c *.o .ko ..cmd *.symvers
make -C /lib/modules/5.15.0-56-generic/build/ M=/home/thisguy/Downloads/asix_ax99100_linux-master modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-56-generic'
CC [M] /home/thisguy/Downloads/asix_ax99100_linux-master/ax99100_spi.o
CC [M] /home/thisguy/Downloads/asix_ax99100_linux-master/ax99100_sp.o
/home/thisguy/Downloads/asix_ax99100_linux-master/ax99100_sp.c: In function ‘serial99100_dma_rx_tasklet’:
/home/thisguy/Downloads/asix_ax99100_linux-master/ax99100_sp.c:2502:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
2502 | if (up->k_lsr & UART_LSR_OE)
| ^~
/home/thisguy/Downloads/asix_ax99100_linux-master/ax99100_sp.c:2505:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
2505 | up->k_lsr &= up->port.read_status_mask;
| ^~
LD [M] /home/thisguy/Downloads/asix_ax99100_linux-master/ax99100.o
CC [M] /home/thisguy/Downloads/asix_ax99100_linux-master/parport_pc.o
In file included from ./include/linux/kernel.h:19,
from ./include/linux/list.h:9,
from ./include/linux/module.h:12,
from /home/thisguy/Downloads/asix_ax99100_linux-master/parport_pc.c:45:
/home/thisguy/Downloads/asix_ax99100_linux-master/parport_pc.c: In function ‘parport_ECP_supported’:
./include/linux/printk.h:450:44: warning: this statement may fall through [-Wimplicit-fallthrough=]
450 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##VA_ARGS)
| ^
./include/linux/printk.h:422:3: note: in definition of macro ‘printk_index_wrap’
422 | _p_func(_fmt, ##VA_ARGS);
| ^~~~~~~
/home/thisguy/Downloads/asix_ax99100_linux-master/parport_pc.c:1675:3: note: in expansion of macro ‘printk’
1675 | printk(KERN_WARNING "0x%lx: Unknown implementation ID\n",
| ^~~~~~
/home/thisguy/Downloads/asix_ax99100_linux-master/parport_pc.c:1678:2: note: here
1678 | case 1:
| ^~~~
MODPOST /home/thisguy/Downloads/asix_ax99100_linux-master/Module.symvers
CC [M] /home/thisguy/Downloads/asix_ax99100_linux-master/ax99100.mod.o
LD [M] /home/thisguy/Downloads/asix_ax99100_linux-master/ax99100.ko
CC [M] /home/thisguy/Downloads/asix_ax99100_linux-master/parport_pc.mod.o
LD [M] /home/thisguy/Downloads/asix_ax99100_linux-master/parport_pc.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-56-generic'
gcc -pthread select_BR.c -o select_BR
gcc -pthread advanced_BR.c -o advanced_BR
gcc -pthread gpio_99100.c -o gpio_99100
gcc -I /usr/include spi_test.c -o spi_test
rm -f .mod.c .o ..cmd .symvers
rm -rf .tmp_version
*~
rm -rf Module.markers modules.

However, the 'make install' step breaks:
$ sudo make install
[sudo] password for thisguy:
cp ax99100.ko /lib/modules/5.15.0-56-generic/kernel/drivers/tty/serial
depmod -A
chmod +x ax99100
cp ax99100 /etc/init.d/
ln -s /etc/init.d/ax99100 /etc/rcS.d/Sax99100 || true
modprobe ax99100
modprobe: ERROR: could not insert 'ax99100': Exec format error
make: *** [Makefile:56: install] Error 1

Likewise attempting to load manually with 'insmod' fails:

$ sudo insmod ax99100.ko
insmod: ERROR: could not insert module ax99100.ko: Invalid module format

System - Linux Mint 20.3
$ uname -a
Linux midgard 5.15.0-56-generic #62~20.04.1-Ubuntu SMP Tue Nov 22 21:24:20 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Soooo close! Any assistance is appreciated.

@will-hanna
Copy link

I patched up some of this repo with the manufacturers drivers and have got the kernel module to work.

Running on Ubuntu 22.04.3 LTS

The new serial ports are:

/dev/ttyF0
/dev/ttyF1
/dev/ttyF2
/dev/ttyF3

Repo is here:
https://bitbucket.org/abravegnuworld/ax99100_linux_driver_fix/src/main/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants