LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-11-2010, 02:20 PM   #1
Penguin01
LQ Newbie
 
Registered: Dec 2009
Posts: 23

Rep: Reputation: 15
Question usb.c errors when trying to make file


Hi,

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.

The makefile is:
obj-m := usb.o

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
$(MAKE) -C $(KDIR) M=$(PWD) modules


And the errors I am getting are:

/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

Thanks!
 
Old 01-11-2010, 02:33 PM   #2
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
are you building the usb.c in the kernel tree?
 
Old 01-11-2010, 02:52 PM   #3
Penguin01
LQ Newbie
 
Registered: Dec 2009
Posts: 23

Original Poster
Rep: Reputation: 15
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.
 
Old 01-11-2010, 02:53 PM   #4
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
that's the reason
 
Old 01-12-2010, 10:08 AM   #5
Penguin01
LQ Newbie
 
Registered: Dec 2009
Posts: 23

Original Poster
Rep: Reputation: 15
OK, so I have tried it from within the kernel tree and it makes the files.
But when I try and insert it into the kernel, with: sudo insmod ./usb.ko

I get:
insmod: error inserting './usb.ko': -1 Unknown symbol in module

I have not changed the usb.c file in any way, so I am not sure why there is an error???
 
Old 01-12-2010, 10:34 AM   #6
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
try using depmod before insert

if persist, i'll check something here
 
Old 01-12-2010, 11:02 AM   #7
Penguin01
LQ Newbie
 
Registered: Dec 2009
Posts: 23

Original Poster
Rep: Reputation: 15
Do you mean typing:
sudo depmod insmod ./usb.ko

Because after I do that I get:
FATAL: modules must be specified using absolute paths.
"insmod" is a relative path
 
Old 01-12-2010, 11:10 AM   #8
Penguin01
LQ Newbie
 
Registered: Dec 2009
Posts: 23

Original Poster
Rep: Reputation: 15
Also after typing dmesg | tail, I get:
[ 3094.371873] usb: Unknown symbol usb_stor_freecom_reset
[ 3094.372017] usb: Unknown symbol freecom_init
[ 3094.372157] usb: Unknown symbol usb_stor_euscsi_init
[ 3094.372294] usb: Unknown symbol usb_stor_Bulk_transport
[ 3094.372437] usb: Unknown symbol init_usbat_flash
[ 3094.372666] usb: Unknown symbol usb_stor_ufi_command
[ 3094.372798] usb: Unknown symbol usb_stor_sddr09_init
[ 3094.372938] usb: Unknown symbol usb_stor_set_xfer_buf
[ 3094.373071] usb: Unknown symbol usb_stor_ucr61s2b_init
[ 3094.373203] usb: Unknown symbol usb_stor_sddr09_dpcm_init

I think these may be the symbols it is referring to, but I am not sure.
 
Old 01-12-2010, 11:15 AM   #9
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
depmod $MODULE
insmod $MODULE

depmod makes the dependencies for modules
modprobe actually combines depmod, insmode and others. check its man page.
 
Old 01-12-2010, 11:39 AM   #10
Penguin01
LQ Newbie
 
Registered: Dec 2009
Posts: 23

Original Poster
Rep: Reputation: 15
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

Am I typing in the correct commands?
 
Old 01-12-2010, 11:42 AM   #11
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
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?
 
Old 01-12-2010, 11:50 AM   #12
Penguin01
LQ Newbie
 
Registered: Dec 2009
Posts: 23

Original Poster
Rep: Reputation: 15
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.
 
Old 01-12-2010, 12:00 PM   #13
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
usb.c is your source code. you should load your compiled module
 
Old 01-12-2010, 12:08 PM   #14
Penguin01
LQ Newbie
 
Registered: Dec 2009
Posts: 23

Original Poster
Rep: Reputation: 15
When I type:
sudo depmod $usb.c

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.
 
Old 01-12-2010, 12:10 PM   #15
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
depmod /home/user/ubuntu-jaunty/drivers/usb/storage/usb.ko
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB file transfers make my computer really slow xmrkite Linux - Software 4 03-28-2014 11:42 AM
Edit fstab file to make USB disk writable. AGazzaz Linux - General 2 07-10-2008 05:18 PM
Looking for easy way to make file changes and boot off USB mikedavid00 Linux - Newbie 2 02-07-2008 06:28 PM
How do i make a .img file into a bootable usb in windows xp so i can install fedora7 cwere4 Linux - Newbie 4 06-25-2007 11:49 AM
errors when configuring the make file Idrisk Linux - Software 1 11-18-2005 10:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration