intrepidcs / intrepid-socketcan-kernel-module

Kernel-mode SocketCAN module for Intrepid devices
17 stars 6 forks source link

Compilation failed on 4.13.15-sunxi #7

Closed mast closed 4 years ago

mast commented 4 years ago

We are trying to compile latest version of socketcan kernel module with 4.13.15-sunxi. It fails with following log:

make -C /lib/modules/4.13.15-sunxi/build M=/home/orangepi/tmp/intrepid-socketcan-kernel-module modules
make[1]: Entering directory '/usr/src/linux-headers-4.13.15-sunxi'
  CC [M]  /home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.o
In file included from ./include/linux/printk.h:6:0,
                 from ./include/linux/kernel.h:13,
                 from ./include/linux/list.h:8,
                 from ./include/linux/module.h:9,
                 from /home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c:35:
/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c: In function ‘intrepid_netdevice_xmit’:
./include/linux/kern_levels.h:4:18: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘size_t {aka unsigned int}’ [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/kern_levels.h:10:18: note: in expansion of macro ‘KERN_SOH’
 #define KERN_ERR KERN_SOH "3" /* error conditions */
                  ^
./include/linux/printk.h:301:9: note: in expansion of macro ‘KERN_ERR’
  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         ^
/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c:236:3: note: in expansion of macro ‘pr_err’
   pr_err("intrepid: %ld length message caused NETDEV_TX_BUSY (%ld)\n", msg.length, offset);
   ^
./include/linux/kern_levels.h:4:18: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘ssize_t {aka int}’ [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/kern_levels.h:10:18: note: in expansion of macro ‘KERN_SOH’
 #define KERN_ERR KERN_SOH "3" /* error conditions */
                  ^
./include/linux/printk.h:301:9: note: in expansion of macro ‘KERN_ERR’
  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         ^
/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c:236:3: note: in expansion of macro ‘pr_err’
   pr_err("intrepid: %ld length message caused NETDEV_TX_BUSY (%ld)\n", msg.length, offset);
   ^
/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c: In function ‘intrepid_add_can_if’:
/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c:353:33: error: invalid application of ‘sizeof’ to incomplete type ‘struct dev_ifalias’
   dev->ifalias = kzalloc(sizeof(struct dev_ifalias) + aliasLen + 1, GFP_KERNEL);
                                 ^
In file included from ./include/linux/kernel.h:13:0,
                 from ./include/linux/list.h:8,
                 from ./include/linux/module.h:9,
                 from /home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c:35:
/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c:355:76: error: invalid application of ‘sizeof’ to incomplete type ‘struct dev_ifalias’
    pr_alert("intrepid: Could not allocate space for ifalias %lu\n", sizeof(struct dev_ifalias));
                                                                            ^
./include/linux/printk.h:297:35: note: in definition of macro ‘pr_alert’
  printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
                                   ^
/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c:357:24: error: request for member ‘ifalias’ in something not a structure or union
    strncpy(dev->ifalias->ifalias, requestedName, aliasLen + 1);
                        ^
/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c: In function ‘intrepid_dev_ioctl’:
/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.c:588:5: warning: ignoring return value of ‘copy_from_user’, declared with attribute warn_unused_result [-Wunused-result]
     copy_from_user(requestedNameBuffer, (void __user*)arg, IFALIASZ);
     ^
scripts/Makefile.build:308: recipe for target '/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.o' failed
make[2]: *** [/home/orangepi/tmp/intrepid-socketcan-kernel-module/intrepid.o] Error 1
Makefile:1512: recipe for target '_module_/home/orangepi/tmp/intrepid-socketcan-kernel-module' failed
make[1]: *** [_module_/home/orangepi/tmp/intrepid-socketcan-kernel-module] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.13.15-sunxi'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2

Can you have a look, please?

uname -a

Linux ptc_lab_collab3_node1 4.13.15-sunxi #1 SMP Tue Nov 21 23:35:46 MSK 2017 armv7l armv7l armv7l GNU/Linux
hollinsky-intrepid commented 4 years ago

Hi mast,

Currently (v2.0.1) we support kernel 4.15+ as that's where Linux added IFALIASes. The alias is how we tell you what hardware channel maps to what canX interface if you run ip link or etc.

Certainly we can add a guard that removes the aliasing feature for earlier kernels. I'll be able to put that together and test it for a v2.0.2 update shortly.

--Paul

mast commented 4 years ago

Thanks, we will be waiting for that update.

hollinsky-intrepid commented 4 years ago

v2.0.2 released now and should compile against kernel 4.13. I don't have an OrangePi device specifically to test on, but I tested it working on both ARM32 and AARCH64 with newer and older kernels than you've specified, so you should be all set.

Let us know if you need anything else!

--Paul