Iscsitarget-0.4.15 compilation Error Problem summary and solution under 2.6.24 Kernel
Source: Internet
Author: User
Iscsitarget-0.4.15 in 2.6.24 kernel compilation Error Problem summary and solution-Linux general technology-Linux programming and kernel information, the following is a detailed reading. Platform Description: I use FC8 for linux and 2.6.23 for kernel. However, considering that iscsitarget has special requirements for the kernel, I re-compiled a 2.6.24 kernel.
2.6.24 kernel compiled under/home/lianxi1999/linux-2.6.24. The iscsitarget-0.4.15 needs to modify the kernel, so the root permission is required during compilation. The source file is stored in/home/lianxi1999/iscsitarget-0.4.15. At first, I compiled it under the 2.6.24 kernel, and it was difficult to compile it!
First error:
Make [1]: Entering directory '/home/lianxi1999/linux-2.6.24'
CC [M]/home/lianxi1999/iscsitarget-0.4.15/kernel/tio. o
/Home/lianxi1999/iscsitarget-0.4.15/kernel/tio. c: In function 'tio _ init ':
/Home/lianxi1999/iscsitarget-0.4.15/kernel/tio. c: 114: Error: too many arguments are provided to the 'kmem _ cache_create 'function
Make [2]: *** [/home/lianxi1999/iscsitarget-0.4.15/kernel/tio. o] Error 1
Make [1]: *** [_ module _/home/lianxi1999/iscsitarget-0.4.15/kernel] Error 2
Make [1]: Leaving directory '/home/lianxi1999/linux-2.6.24' make: *** [kernel] Error 2
The error message shows that when calling the kmem_cache_create function of tio. c, too many parameters are passed to it! Find tio. call Statement in c: tio_cache = kmem_cache_create ("tio", sizeof (struct tio), 0, 0, NULL, NULL); search for and view kernel development books through the network, the kernel function kmem_cache_create is used to create a new cache. This is usually executed during kernel initialization or when the kernel module is loaded for the first time.
Its prototype is defined as follows: struct kmem_cache * kmem_cache_create (const char * name, size_t size,
Size_t align, unsigned long flags;
Void (* ctor) (void *, struct kmem_cache *, unsigned long ),
Void (* dtor) (void *, struct kmem_cache *, unsigned long ));
The function prototype shows that the function is indeed a six-Parameter Function. What is going on? It seems that the problem can only be solved by finding the kernel source code! Find the source file defining the function:/home/lianxi1999/linux-2.6.24/include/linux/slab. h found that the function prototype is:
Obviously, the function definition has changed in the new kernel version! Found the problem! (In fact, the definition of the function is modified in 2.6.23.) modify the place where the function is called in the program as prompted! Remove all the last parameters that call this function, compile again, and pass! But there is a new error!
Second error:/root/iscsitarget-0.4.15/kernel/digest. c: In function 'digest _ header ':
/Root/iscsitarget-0.4.15/kernel/digest. c: 185: Error: 'struct scatterlist' no member named 'page'
/Root/iscsitarget-0.4.15/kernel/digest. c: 187: Error: 'struct scatterlist' no member named 'page'
/Root/iscsitarget-0.4.15/kernel/digest. c: In function 'digest _ data':/root/iscsitarget-0.4.15/kernel/digest. c: 239: Error: 'struct scatterlist' no member named 'page'
Make [2]: *** [/root/iscsitarget-0.4.15/kernel/digest. o] Error 1
Make [1]: *** [_ module _/root/iscsitarget-0.4.15/kernel] Error 2
Make [1]: Leaving directory '/home/lianxi1999/linux-2.6.24' make: *** [kernel] Error 2
This error is more strange than the previous one! Actually, no member exists in the struct! In the same order as the first time, the definition of struct scatterlist is as follows:
Struct scatterlist {struct page * page; unsigned int offset; dma_addr_t dma_address; unsigned int length ;};
Obviously, there are page member variables. What is that? Look for the kernel source code! The header file in digest. c is used to open the file in the kernel and its content is as follows:
# Ifdef CONFIG_X86_32
# Include "scatterlist_32.h"
# Else
# Include "scatterlist_64.h"
# Endif
I am using a 32-bit platform and can only find scatterlist_32.h. Fortunately, these two files are very close (very convenient ). The struct is defined as follows in kernel 2.6.24:
Struct scatterlist {# ifdef CONFIG_DEBUG_SG unsigned long sg_magic; # endif unsigned long page_link; unsigned int offset; dma_addr_t dma_address; unsigned int length ;};
No page member (! _!) What should I do! It seems that the system is exhausted. I think there is another 2.6.23 kernel in my system. Hurry up and find out its definition of this struct. Haha, there is no path to death! The definition is the same as that of the old version! Cut it over. This problem does not occur in 2.6.23. But the new problem is coming again. It's really depressing.
It takes half a day to do the above. The third question is to be continued.
Third question:
/Root/iscsitarget-0.4.15/kernel/event. c: In function 'event _ init ':
/Root/iscsitarget-0.4.15/kernel/event. c: 98: Warning: transfer between incompatible pointer types when passing parameter 4 (belonging to 'netlink _ kernel_create ')
/Root/iscsitarget-0.4.15/kernel/event. c: 98: Error: Too few arguments are provided to the function 'netlink _ kernel_create'
Make [2]: *** [/root/iscsitarget-0.4.15/kernel/event. o] Error 1
Make [1]: *** [_ module _/root/iscsitarget-0.4.15/kernel] Error 2
Make [1]: Leaving directory '/usr/src/kernels/2.6.23.1-42. fc8-i686 'make: *** [kernel] Error 2
It is obvious that the netlink_kernel_create function is redefined in the new kernel version.
Find the statement that calls this function in event. c: nl = netlink_kernel_create (NETLINK_IET, 1, event_recv, THIS_MODULE );
Now I am smart. I first wanted to find the definition of this function through the header file. However, after I found all the header files contained in the file, I was a little disappointed that I still did not find the file for this function! Look for Baidu ...... Fortunately, I found it. This function is defined in linux/netlink. h. Finally, haha. Check it out:
Extern struct sock * netlink_kernel_create (int unit, unsigned int groups, void (* input) (struct sock * sk, int len), struct mutex * cb_mutex, struct module * module );
Five parameters are defined in the prototype, and only four parameters are passed during the call. What should we do? Through observation, it was found that the fourth parameter was not passed. The online practice was to set it to NULL, and I made it ^_^. Successful pass! OYEAR! After modifying the preceding three errors, make-> make install-> start. OK, you can start it!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service