重新make编译DE5a-NET-DDR4的 PCIe driver的时候报错

From Terasic Wiki

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
'''Q''':客户的环境 ubuntu18.04,内核版本5.4.0-150-generic,重新make编译DE5a-NET-DDR4的 PCIe driver的时候报错如下:
'''Q''':客户的环境 ubuntu18.04,内核版本5.4.0-150-generic,重新make编译DE5a-NET-DDR4的 PCIe driver的时候报错如下:
-
''[[make -C /lib/modules/5.4.0-150-generic/build M=/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver
+
'''[[make -C /lib/modules/5.4.0-150-generic/build M=/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver
make[1]: 进入目录“/usr/src/linux-headers-5.4.0-150-generic”
make[1]: 进入目录“/usr/src/linux-headers-5.4.0-150-generic”
   AR      /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/built-in.a
   AR      /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/built-in.a
Line 119: Line 119:
make[1]: 离开目录“/usr/src/linux-headers-5.4.0-150-generic”
make[1]: 离开目录“/usr/src/linux-headers-5.4.0-150-generic”
Makefile:9: recipe for target 'all' failed
Makefile:9: recipe for target 'all' failed
-
make: *** [all] Error 2]]''
+
make: *** [all] Error 2]]'''

Revision as of 17:24, 5 November 2024

Q:客户的环境 ubuntu18.04,内核版本5.4.0-150-generic,重新make编译DE5a-NET-DDR4的 PCIe driver的时候报错如下:

[[make -C /lib/modules/5.4.0-150-generic/build M=/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver make[1]: 进入目录“/usr/src/linux-headers-5.4.0-150-generic”

 AR      /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/built-in.a
 CC [M]  /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.o

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c: In function ‘altera_pcie_ioctl’: /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:26:66: error: macro "access_ok" passed 3 arguments, but takes just 2

  26 |     if (access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd))) {
     |                                                                  ^

In file included from ./include/linux/uaccess.h:11,

                from ./arch/x86/include/asm/fpu/xstate.h:5,
                from ./arch/x86/include/asm/pgtable.h:26,
                from ./include/linux/mm.h:100,
                from ./include/linux/scatterlist.h:8,
                from ./include/linux/dmapool.h:14,
                from ./include/linux/pci.h:1419,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.h:5,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:5:

./arch/x86/include/asm/uaccess.h:93: note: macro "access_ok" defined here

  93 | #define access_ok(addr, size)                                   \
     | 

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:26:9: error: ‘access_ok’ undeclared (first use in this function)

  26 |     if (access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd))) {
     |         ^17:22, 5 November 2024 (CST)Dongliu

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:26:9: note: each undeclared identifier is reported only once for each function it appears in /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:51:79: error: macro "access_ok" passed 3 arguments, but takes just 2

  51 |      if (access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd))) {
     |                                                                    ^

In file included from ./include/linux/uaccess.h:11,

                from ./arch/x86/include/asm/fpu/xstate.h:5,
                from ./arch/x86/include/asm/pgtable.h:26,
                from ./include/linux/mm.h:100,
                from ./include/linux/scatterlist.h:8,
                from ./include/linux/dmapool.h:14,
                from ./include/linux/pci.h:1419,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.h:5,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:5:

./arch/x86/include/asm/uaccess.h:93: note: macro "access_ok" defined here

  93 | #define access_ok(addr, size)                                   \
     | 

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:68:75: error: macro "access_ok" passed 3 arguments, but takes just 2

  68 |      if (access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd))) {
     |                                                                    ^

In file included from ./include/linux/uaccess.h:11,

                from ./arch/x86/include/asm/fpu/xstate.h:5,
                from ./arch/x86/include/asm/pgtable.h:26,
                from ./include/linux/mm.h:100,
                from ./include/linux/scatterlist.h:8,
                from ./include/linux/dmapool.h:14,
                from ./include/linux/pci.h:1419,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.h:5,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:5:

./arch/x86/include/asm/uaccess.h:93: note: macro "access_ok" defined here

  93 | #define access_ok(addr, size)                                   \
     | 

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c: In function ‘altera_pcie_read’: /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:120:63: error: macro "access_ok" passed 3 arguments, but takes just 2

 120 |     if (access_ok(VERIFY_WRITE, (void __user *)buf, bytes_read)) {
     |                                                               ^

In file included from ./include/linux/uaccess.h:11,

                from ./arch/x86/include/asm/fpu/xstate.h:5,
                from ./arch/x86/include/asm/pgtable.h:26,
                from ./include/linux/mm.h:100,
                from ./include/linux/scatterlist.h:8,
                from ./include/linux/dmapool.h:14,
                from ./include/linux/pci.h:1419,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.h:5,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:5:

./arch/x86/include/asm/uaccess.h:93: note: macro "access_ok" defined here

  93 | #define access_ok(addr, size)                                   \
     | 

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:120:9: error: ‘access_ok’ undeclared (first use in this function)

 120 |     if (access_ok(VERIFY_WRITE, (void __user *)buf, bytes_read)) {
     |         ^17:22, 5 November 2024 (CST)Dongliu

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c: In function ‘altera_pcie_write’: /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:154:57: error: macro "access_ok" passed 3 arguments, but takes just 2

 154 |     if (access_ok(VERIFY_READ, (void __user *)buf, count)) {
     |                                                         ^

In file included from ./include/linux/uaccess.h:11,

                from ./arch/x86/include/asm/fpu/xstate.h:5,
                from ./arch/x86/include/asm/pgtable.h:26,
                from ./include/linux/mm.h:100,
                from ./include/linux/scatterlist.h:8,
                from ./include/linux/dmapool.h:14,
                from ./include/linux/pci.h:1419,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.h:5,
                from /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:5:

./arch/x86/include/asm/uaccess.h:93: note: macro "access_ok" defined here

  93 | #define access_ok(addr, size)                                   \
     | 

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:154:9: error: ‘access_ok’ undeclared (first use in this function)

 154 |     if (access_ok(VERIFY_READ, (void __user *)buf, count)) {
     |         ^17:22, 5 November 2024 (CST)Dongliu

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c: In function ‘altera_pci_remove’: /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:490:77: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]

 490 | _err(&dev->dev, ": altera_pcie_remove(), " __DATE__ " " __TIME__ "\n");
     |                                                                      ^

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:490:51: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]

 490 |     dev_err(&dev->dev, ": altera_pcie_remove(), " __DATE__ " " __TIME__ "\n");
     |                                                   ^17:22, 5 November 2024 (CST)~~

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c: In function ‘altera_pcie_init’: /home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:509:72: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]

 509 | KERN_DEBUG ALTERA_PCIE_DRIVER_NAME ": altera_pcie_init(), " __DATE__ " " __TIME__ "\n");
     |                                                             ^17:22, 5 November 2024 (CST)~~

/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.c:509:85: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]

 509 | TERA_PCIE_DRIVER_NAME ": altera_pcie_init(), " __DATE__ " " __TIME__ "\n");
     |                                                             ^17:22, 5 November 2024 (CST)~~

cc1: some warnings being treated as errors scripts/Makefile.build:270: recipe for target '/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.o' failed make[2]: *** [/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver/altera_pcie.o] Error 1 Makefile:1767: recipe for target '/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver' failed make[1]: *** [/home/v726726/DE5a-Net-DDR4_v.1.0.9_SystemCD/Demonstrations/PCIe_SW_KIT/Linux/PCIe_Driver] Error 2 make[1]: 离开目录“/usr/src/linux-headers-5.4.0-150-generic” Makefile:9: recipe for target 'all' failed make: *** [all] Error 2]]


A:内核版本搞了 之前的驱动不支持5.4以上的内核版本,

修改方式: 1.将altera_pcie.c中,access_ok函数中的,第一个参数(VERIFY_READ或者VERIFY_WRITE)都拿掉 2.修改Makefile,添加:

       EXTRA_FLAGS += -Wno-error=date-time
       EXTRA_CFLAGS += -Wno-date-time -I$(PWD)

Example.jpg

Example.jpg

Personal tools