Skip to content

Instantly share code, notes, and snippets.

Created January 24, 2018 06:09
Show Gist options
  • Save anonymous/8c2f7fd050696f6986ba22750c57fe67 to your computer and use it in GitHub Desktop.
Save anonymous/8c2f7fd050696f6986ba22750c57fe67 to your computer and use it in GitHub Desktop.
Compiling driver for kernel: 4.10.0-42-generic with the following values
NAME: 'riffa'
MAJNUM: '100'
VENDOR_ID0: '10EE'
VENDOR_ID1: '1172'
sed -i 's/#define MAJOR_NUM [^\n]*/#define MAJOR_NUM 100/g' riffa_driver.h
sed -i 's/#define DEVICE_NAME [^\n]*/#define DEVICE_NAME "riffa"/g' riffa_driver.h
sed -i 's/#define VENDOR_ID0 [^\n]*/#define VENDOR_ID0 0x10EE/g' riffa_driver.h
sed -i 's/#define VENDOR_ID1 [^\n]*/#define VENDOR_ID1 0x1172/g' riffa_driver.h
sed -i 's/#define DEBUG [^\n]*/#define DBUG 1/g' riffa_driver.h
sed -i 's/#define DBUG [^\n]*/#define DBUG 1/g' riffa_driver.h
make -C /lib/modules/`uname -r`/build SUBDIRS=`pwd` modules
make[1]: Entering directory '/usr/src/linux-headers-4.10.0-42-generic'
CC [M] /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.o
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c: In function ‘fill_sg_buf’:
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:447:59: error: passing argument 5 of ‘get_user_pages’ from incompatible pointer type [-Werror=incompatible-pointer-types]
num_pages = get_user_pages(udata, num_pages_reqd, 1, 0, pages, NULL);
^
In file included from ./include/linux/scatterlist.h:7:0,
from ./include/linux/dmapool.h:14,
from ./include/linux/pci.h:1287,
from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:
./include/linux/mm.h:1293:6: note: expected ‘struct vm_area_struct **’ but argument is of type ‘struct page **’
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:447:15: error: too many arguments to function ‘get_user_pages’
num_pages = get_user_pages(udata, num_pages_reqd, 1, 0, pages, NULL);
^
In file included from ./include/linux/scatterlist.h:7:0,
from ./include/linux/dmapool.h:14,
from ./include/linux/pci.h:1287,
from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:
./include/linux/mm.h:1293:6: note: declared here
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c: At top level:
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1533:8: error: type defaults to ‘int’ in declaration of ‘DEFINE_PCI_DEVICE_TABLE’ [-Werror=implicit-int]
static DEFINE_PCI_DEVICE_TABLE(fpga_ids) = {
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1533:1: warning: parameter names (without types) in function declaration
static DEFINE_PCI_DEVICE_TABLE(fpga_ids) = {
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1533:1: error: function ‘DEFINE_PCI_DEVICE_TABLE’ is initialized like a variable
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:2: warning: braces around scalar initializer
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:2: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
In file included from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:0:
./include/linux/pci.h:725:2: error: field name not in record or union initializer
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:725:2: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:725:12: error: invalid initializer
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:725:12: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:725:20: error: field name not in record or union initializer
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:725:20: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:725:30: warning: excess elements in scalar initializer
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:725:30: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:726:2: error: field name not in record or union initializer
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:726:2: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
In file included from ./include/linux/pci.h:20:0,
from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:
./include/linux/mod_devicetable.h:16:20: warning: excess elements in scalar initializer
#define PCI_ANY_ID (~0)
^
./include/linux/pci.h:726:15: note: in expansion of macro ‘PCI_ANY_ID’
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/mod_devicetable.h:16:20: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
#define PCI_ANY_ID (~0)
^
./include/linux/pci.h:726:15: note: in expansion of macro ‘PCI_ANY_ID’
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
In file included from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:0:
./include/linux/pci.h:726:27: error: field name not in record or union initializer
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/pci.h:726:27: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
In file included from ./include/linux/pci.h:20:0,
from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:
./include/linux/mod_devicetable.h:16:20: warning: excess elements in scalar initializer
#define PCI_ANY_ID (~0)
^
./include/linux/pci.h:726:40: note: in expansion of macro ‘PCI_ANY_ID’
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
./include/linux/mod_devicetable.h:16:20: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
#define PCI_ANY_ID (~0)
^
./include/linux/pci.h:726:40: note: in expansion of macro ‘PCI_ANY_ID’
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1534:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:2: warning: braces around scalar initializer
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:2: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
In file included from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:0:
./include/linux/pci.h:725:2: error: field name not in record or union initializer
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:725:2: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:725:12: error: invalid initializer
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:725:12: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:725:20: error: field name not in record or union initializer
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:725:20: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:725:30: warning: excess elements in scalar initializer
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:725:30: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.vendor = (vend), .device = (dev), \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:726:2: error: field name not in record or union initializer
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:726:2: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
In file included from ./include/linux/pci.h:20:0,
from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:
./include/linux/mod_devicetable.h:16:20: warning: excess elements in scalar initializer
#define PCI_ANY_ID (~0)
^
./include/linux/pci.h:726:15: note: in expansion of macro ‘PCI_ANY_ID’
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/mod_devicetable.h:16:20: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
#define PCI_ANY_ID (~0)
^
./include/linux/pci.h:726:15: note: in expansion of macro ‘PCI_ANY_ID’
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
In file included from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:0:
./include/linux/pci.h:726:27: error: field name not in record or union initializer
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/pci.h:726:27: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
In file included from ./include/linux/pci.h:20:0,
from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:52:
./include/linux/mod_devicetable.h:16:20: warning: excess elements in scalar initializer
#define PCI_ANY_ID (~0)
^
./include/linux/pci.h:726:40: note: in expansion of macro ‘PCI_ANY_ID’
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
./include/linux/mod_devicetable.h:16:20: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
#define PCI_ANY_ID (~0)
^
./include/linux/pci.h:726:40: note: in expansion of macro ‘PCI_ANY_ID’
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:3: note: in expansion of macro ‘PCI_DEVICE’
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:2: warning: excess elements in scalar initializer
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1535:2: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1536:2: warning: braces around scalar initializer
{0},
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1536:2: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1536:3: error: invalid initializer
{0},
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1536:3: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1536:2: warning: excess elements in scalar initializer
{0},
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1536:2: note: (near initialization for ‘DEFINE_PCI_DEVICE_TABLE’)
In file included from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:46:0:
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1539:26: error: ‘fpga_ids’ undeclared here (not in a function)
MODULE_DEVICE_TABLE(pci, fpga_ids);
^
./include/linux/module.h:213:21: note: in definition of macro ‘MODULE_DEVICE_TABLE’
extern const typeof(name) __mod_##type##__##name##_device_table \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1533:8: warning: ‘DEFINE_PCI_DEVICE_TABLE’ defined but not used [-Wunused-function]
static DEFINE_PCI_DEVICE_TABLE(fpga_ids) = {
^
In file included from /home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:46:0:
./include/linux/module.h:213:27: error: ‘__mod_pci__fpga_ids_device_table’ aliased to undefined symbol ‘fpga_ids’
extern const typeof(name) __mod_##type##__##name##_device_table \
^
/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.c:1539:1: note: in expansion of macro ‘MODULE_DEVICE_TABLE’
MODULE_DEVICE_TABLE(pci, fpga_ids);
^
cc1: some warnings being treated as errors
scripts/Makefile.build:294: recipe for target '/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.o' failed
make[2]: *** [/home/phung/Documents/fpga_overlay/riffa/driver/linux/riffa_driver.o] Error 1
Makefile:1524: recipe for target '_module_/home/phung/Documents/fpga_overlay/riffa/driver/linux' failed
make[1]: *** [_module_/home/phung/Documents/fpga_overlay/riffa/driver/linux] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.10.0-42-generic'
Makefile:94: recipe for target 'riffa.ko' failed
make: *** [riffa.ko] Error 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment