[Email protected]:~/vm_disk_dpdk/study/drive/examples/scull# sudo lsb_release-a
No LSB modules is available.
Description: Ubuntu 14.04.3 LTS
release:14.04
Codename:trusty
[Email protected]:~/vm_disk_dpdk/study/drive/examples/scull# uname-a
Linux ubuntu 3.13.0-66-generic #108-ubuntu SMP Wed Oct 7 15:20:27 UTC x86_64 x86_64 x86_64 gnu/linux
- Issue One: scripts/makefile.build:49: * * * CFLAGS was changed in "/home/enjoy/vm_disk_dpdk/study/drive/examples/scull/ Makefile ". Fix it to use ccflags-y. Stop.
Change
CFLAGS + = $ (pstn_def)-wall-o $ (includes)-FNO-COMMON-DTARGET_CATAWBA
To
extra_cflags + = $ (pstn_def)-wall-o $ (includes)-FNO-COMMON-DTARGET_CATAWBA
and try
You could use something like this:
Sed-i ' s/^cflags/extra_cflags/' Makefile
- Question two:/home/enjoy/vm_disk_dpdk/study/drive/examples/scull/main.c:17:26:fatal error: linux/config.h:no such file or directory
Not config.h now, but autoconf.h.
[Email protected]:/usr/src/linux-headers-3.13.0-66-generic/include/linux# ln-s. /generated/autoconf.h config.h
[Email protected]:/usr/src/linux-headers-3.13.0-66-generic/include/linux# ll Config.h
lrwxrwxrwx 1 root root: 01:01 config.h. /generated/autoconf.h
- Question three:/home/enjoy/vm_disk_dpdk/study/drive/examples/scull/main.c:32:46:fatal error:asm/system.h:no such file or Directory
Direct comment, there is a problem followed by adding another header file
This file is removed in Linux 3.4, commit f05e798ad4c0; Its contents has been moved into various and other headers.
It ' s possible that just removing #include <asm/system.h>
the might work, but it's much more likely that your driver is simply incom Patible with the current Linux versions.
- Question four:/home/enjoy/vm_disk_dpdk/study/drive/examples/scull/main.c:556:2: Error:unknown field ' IOCTL ' specified in Initializer
This error online search found 2.6. Version 38 kernel file_operation The IOCTL function has been removed and replaced by:
Long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
Long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
File_operation structure in INCLUDE/LINUX/FS.H definition
Solution:
Replace with Unlocked_ioctl, pay attention to the function prototype, the first parameter does not need (the code is useless), and the return value is a long type.
- Question five:/home/enjoy/vm_disk_dpdk/study/drive/examples/scull/main.c:652:3: error:implicit declaration of function ' Init_ MUTEX ' [-werror=implicit-function-declaration]
2.6.25 and later Linux kernel versions abolished the Init_mutex function, and the new version uses the Sema_init function
Static void Init_mutex (struct semaphore *sem) { 1); }
- Question six: include/linux/wait.h:307:31:error: ' Task_interruptible ' undeclared (first use of this function)
Add header file: #include <linux/sched.h>
- Question seven:/usr/src/linux-source-3.2.0/drivers/scull/access.c:98:34:error: ' spin_lock_unlocked ' is not declared (not within the function)
Will: static spinlock_t scull_u_lock = spin_lock_unlocked;
Instead: Static Define_spinlock (Scull_u_lock);
/USR/SRC/LINUX-SOURCE-3.2.0/DRIVERS/SCULL/ACCESS.C:107:29: Error: Lift pointer to an incomplete type
The workaround is to add two header files to the ACCESS.C #include <linux/sched.h>
- Issue nine: ' struct task_struct ' has no member named ' UID ', ' euid '
/home/enjoy/vm_disk_dpdk/study/drive/examples/scull/access.c:107:29:error: ' struct task_struct ' has no member named ' Uid
/home/enjoy/vm_disk_dpdk/study/drive/examples/scull/access.c:108:29:error: ' struct task_struct ' has no member named ' Euid '
Current->uid modified to Current->cred->uid.val
Current->euid modified to Current->cred->euid.val
Compile OK:
[Email protected]:~/vm_disk_dpdk/study/drive/examples/scull# ls
ACCESS.C main.c Makefile module.symvers pipe.o scull.init scull_load scull.mod.o scull_unload
ACCESS.O main.o modules.order pipe.c scull.h scull.ko scull.mod.c SCULL.O
Linux Device driver Learning Note one: Debug LDD scull code under Ubuntu 14.04.3 LTS