Closed iDoka closed 10 years ago
Hi!
So, the module should be distribution agnostic, but back then I was using Slackware with -git kernels (I now, not the answer you was hoping for :-).
Anyway, the RHEL log is for a very old kernel, but you can still make it build by removing everything that refer to led, ONE_SHOT, and other funny fields (really, just delete that stuff). You will lose some functionality, but you probably don't care anyway.
As for the second log, you just miss CAN-LED support, which was merged in 3.9... Again, you can just remove all the references.
Coincidentally, I'm on the same situation on my current laptop, so I quickly hacked the LED stuff out and pushed a new no-led branch with the modification, feel free to check it out, it should probably work on Ubuntu, and you can easily fix it for RHEL.
https://github.com/fabiobaltieri/open-usb-can/commit/274cb9b811ee43544d42ba47639ab588d700e1f8
Cheers, Fabio
Ok. I run
grep -n LED open-usb-can.c
and commented this string. Also I exclude ONE_SHOT from 'OR' equation.
But my main system is RHEL. As I know SocketCAN support were added in the 2.6.25 Linux kernel. I guess that I need to take some header-files to make the driver from Ubuntu 12.04? And replace section include, e.g.: before:
#include <linux/can.h>
after
#include "can.h"
Which header-files I need?
Thanks!
Uh - linux/can.h should be ok, there was no error for that in your logs!
I tried using for build on RHEL header files from Ubuntu 12.04: linux/can/dev.h linux/usb.h
$ make KERNELDIR=/usr/src/kernels/2.6.32-358.23.2.el6.x86_64
make -C /usr/src/kernels/2.6.32-358.23.2.el6.x86_64 M=/home/idoka/open-usb-can/kernel-module modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-358.23.2.el6.x86_64'
CC [M] open-usb-can.o
In file included from open-usb-can.c:36:
usb.h: In function ‘usb_mark_last_busy’:
usb.h:549: error: implicit declaration of function ‘pm_runtime_mark_last_busy’
usb.h: In function ‘usb_maxpacket’:
usb.h:1618: error: implicit declaration of function ‘usb_endpoint_maxp’
In file included from open-usb-can.c:41:
dev.h: At top level:
dev.h:51: warning: ‘struct can_berr_counter’ declared inside parameter list
dev.h:51: warning: its scope is only this definition or declaration, which is probably not what you want
open-usb-can.c: In function ‘open_usb_can_probe’:
open-usb-can.c:700: warning: assignment discards qualifiers from pointer target type
open-usb-can.c: At top level:
open-usb-can.c:788: warning: data definition has no type or storage class
open-usb-can.c:788: warning: type defaults to ‘int’ in declaration of ‘module_usb_driver’
open-usb-can.c:788: warning: parameter names (without types) in function declaration
make[2]: *** [open-usb-can.o] Error 1
make[1]: *** [_module_/home/idoka/proj/open-usb-can/kernel-module] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.32-358.23.2.el6.x86_64'
make: *** [default] Error 2
I guess that different kernel version using different kernel/driver API. Suppose is right?
Can I just move the compiled *.ko driver from Ubuntu to RHEL? Will it work?
PS: Sorry for my questions. I'm really a newbee.
Uh - I can't understand what's going on but it looks like your headers are messed up... this should not happen if you just installed the kernel header package for your distro unless something it screwed up with the kernel configuration. Does it work on the Ubuntu? The errors you posted in the first report were looking better than this...
In any case, you can't copy the module binary from a different kernel.
$ make KERNELDIR=/usr/src/kernels/2.6.32-358.23.2.el6.x86_64
make -C /usr/src/kernels/2.6.32-358.23.2.el6.x86_64 M=/home/idoka/open-usb-can/kernel-module modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-358.23.2.el6.x86_64'
CC [M] open-usb-can.o
open-usb-can.c: In function ‘open_usb_can_read_bulk_callback’:
open-usb-can.c:206: error: implicit declaration of function ‘alloc_can_skb’
open-usb-can.c:206: warning: assignment makes pointer from integer without a cast
open-usb-can.c: In function ‘open_usb_can_write_bulk_callback’:
open-usb-can.c:260: error: implicit declaration of function ‘usb_free_coherent’
open-usb-can.c: In function ‘open_usb_can_setup_rx_urbs’:
open-usb-can.c:327: error: implicit declaration of function ‘usb_alloc_coherent’
open-usb-can.c:328: warning: assignment makes pointer from integer without a cast
open-usb-can.c: In function ‘open_usb_can_start_xmit’:
open-usb-can.c:463: error: implicit declaration of function ‘can_dropped_invalid_skb’
open-usb-can.c:474: warning: assignment makes pointer from integer without a cast
open-usb-can.c: In function ‘open_usb_can_probe’:
open-usb-can.c:686: error: too many arguments to function ‘alloc_candev’
open-usb-can.c:700: warning: assignment discards qualifiers from pointer target type
open-usb-can.c:703: error: ‘struct can_priv’ has no member named ‘do_get_berr_counter’
open-usb-can.c:704: error: ‘struct can_priv’ has no member named ‘ctrlmode_supported’
make[2]: *** [open-usb-can.o] Error 1
make[1]: *** [_module_/home/doka/proj/can/open-usb-can/kernel-module] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.32-358.23.2.el6.x86_64'
make: *** [default] Error 2
Hi, so I've dig a bit deeper into the revision history and unfortunately it turns out that in v2.6.32 the can-dev APIs were still under heavy development and differs a lot from the current ones, hence the errors with alloc_can_skb and alloc_candev. Add possible similar issues with usb and other stuff.
At this point I would really suggest you to consider updating the kernel to something more modern... 2.6.32 was released in Dec 2012 after all...
Sorry about that!
firmware-sources nice and build perfectly fine, but i have troubles with kernel-module build:
I have RHEL 6.5 64bit with kernel version 2.6.32-358.23.2.el6.x86_64 and I think that my system is not fully integrated SocketCAN.
By path /usr/src/kernels/2.6.32-358.23.2.el6.x86_64/include/linux/can necessary file led.h is absent. And I have problem with others include files when building module (e.g. CAN_CTRLMODE_ONE_SHOT define) :
I tried to make the assembly on another system - Ububntu 12.04 64bit:
The same result..
== Two ask: ==
Fabio Thanks!