Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am quite new to Linux and I am trying to make the usb.c file, but it comes up with a long list of errors (shown below). I have downloaded the kernel source and got the usb.c code from there - /home/user/ubuntu-jaunty/drivers/usb/storage.
I have a makefile, which seems to try and make the files but fails and I get a load of errors.
/home/user/Documents/Tests/usb_tests/usb1/usb.c:975: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_data’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:975: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_data’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:975: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_data’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:976: error: dereferencing pointer to incomplete type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:977: error: dereferencing pointer to incomplete type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:978: error: dereferencing pointer to incomplete type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:979: error: dereferencing pointer to incomplete type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:980: error: dereferencing pointer to incomplete type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:983: warning: passing argument 1 of ‘associate_dev’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:983: warning: passing argument 2 of ‘associate_dev’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:994: warning: passing argument 1 of ‘get_device_info’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:999: warning: passing argument 1 of ‘get_transport’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1002: warning: passing argument 1 of ‘get_protocol’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1005: warning: passing argument 1 of ‘get_pipes’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1010: warning: passing argument 1 of ‘usb_stor_acquire_resources’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1013: error: implicit declaration of function ‘scsi_add_host’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1013: error: dereferencing pointer to incomplete type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1015: error: expected ‘)’ before ‘USB_STORAGE’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1023: error: expected ‘)’ before ‘USB_STORAGE’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1025: error: dereferencing pointer to incomplete type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1026: warning: passing argument 1 of ‘quiesce_and_remove_host’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1038: warning: passing argument 1 of ‘release_everything’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c: At top level:
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1043: warning: ‘struct usb_interface’ declared inside parameter list
/home/user/Documents/Tests/usb_tests/usb1/usb.c: In function ‘storage_disconnect’:
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1045: warning: initialisation makes pointer from integer without a cast
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1048: warning: passing argument 1 of ‘quiesce_and_remove_host’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1049: warning: passing argument 1 of ‘release_everything’ from incompatible pointer type
/home/user/Documents/Tests/usb_tests/usb1/usb.c: At top level:
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1056: error: variable ‘usb_storage_driver’ has initialiser but incomplete type
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1057: error: unknown field ‘name’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1057: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1057: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1058: error: unknown field ‘probe’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1058: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1058: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1059: error: unknown field ‘disconnect’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1059: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1059: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1061: error: unknown field ‘suspend’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1061: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1061: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1062: error: unknown field ‘resume’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1062: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1062: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1063: error: unknown field ‘reset_resume’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1063: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1063: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1065: error: unknown field ‘pre_reset’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1065: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1065: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1066: error: unknown field ‘post_reset’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1066: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1066: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1067: error: unknown field ‘id_table’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1067: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1067: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1068: error: unknown field ‘soft_unbind’ specified in initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1068: warning: excess elements in struct initialiser
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1068: warning: (near initialisation for ‘usb_storage_driver’)
/home/user/Documents/Tests/usb_tests/usb1/usb.c: In function ‘usb_stor_init’:
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1077: error: implicit declaration of function ‘usb_register’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1080: error: implicit declaration of function ‘usb_usual_set_present’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1080: error: ‘USB_US_TYPE_STOR’ undeclared (first use in this function)
/home/user/Documents/Tests/usb_tests/usb1/usb.c: In function ‘usb_stor_exit’:
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1094: error: implicit declaration of function ‘usb_deregister’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1096: error: implicit declaration of function ‘usb_usual_clear_present’
/home/user/Documents/Tests/usb_tests/usb1/usb.c:1096: error: ‘USB_US_TYPE_STOR’ undeclared (first use in this function)
make[2]: *** [/home/user/Documents/Tests/usb_tests/usb1/usb.o] Error 1
make[1]: *** [_module_/home/user/Documents/Tests/usb_tests/usb1] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-17-generic'
make: *** [default] Error 2
I am not sure what is causing these errors, but any help will be appreciated.
I am using:
Linux version 2.6.28-17-generic (buildd@rothera) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #58-Ubuntu SMP
No, I am creating it within a folder called 'usb1' in my home directory.
I copied the usb.c from the kernel tree, as I want to make sure I have original copy... just in case.
Would this be an issue?
Because I have made the usb-skeleton.c in this directory and that works with the same makefile.
I am sorry if I am a pain, but do you mean typing:
depmod $MODULE
insmod $MODULE
or
depmod $usb.ko
insmod $usb.ko
Because the top one works, but does not load the module when I look at the loaded modules (using lsmod).
The bottom command does not work as it says:
FATAL: modules must be specified using absolute paths.
".ko" is a relative path
you're not being a pain, just not get used to "nix" posting (even thou it's used a lot of places over the years now. even in windows with basic style).
what i meant by $MODULE was that you but module name here .
and secondly how's your usb support in the kernel. is it compiled in, or is it module only?
So when you say "what i meant by $MODULE was that you but module name here ." - Do you mean $usb.c?
Its a module I just want to load into the kernel. When I get it loaded I want it to print a message like "HELLO" (for example), but I will only add this once I get it loaded.
I get:
FATAL: modules must be specified using absolute paths.
".c" is a relative path
So I then tried putting in the full path (/home/user/ubuntu-jaunty/drivers/usb/storage/usb.c) and it still comes up with the same error, saying that it is a relative path - even though it isn't.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.