problem with kernel modules

Fuki
Hi, I am trying to compile kernel with USB gadget as a module. while
compiling, I can see it being compiled, but when I upload my zImage to
mini2440, my modules are missing in /lib/modules.
How do I add them there? Do I have to copy them manually?
Thank you for any help :)

PS: I am new to linux, so it may be some really stupid error

Juergen Beisert
Yes, you need some "mechanic" to copy all kernel related files to your
target root filesystem, when the kernel config was changed. Or build the
driver statically, then they are part of the main kernel image and you do
not need to copy more files to your root filesystem.
To get an idea what to copy (at the kernel module side) try "make
modules_install"

Fuki
thank you for your reply.

I tried "make modules_install" and it gave me output something like:
  INSTALL drivers/usb/gadget/g_ether.ko
  INSTALL drivers/usb/gadget/g_file_storage.ko
  ...
  DEPMOD 2.6.32.2-FriendlyARM

Then I tried to run make, make zImage and manually copy these files to
/lib/modules on mini2440, but nothing worked and after command "modprobe
g_file_storage" I am still getting error 
  modprobe: module 'g_file_storage" not found

any ideas please?

Juergen Beisert
The best way is to use some kind of root filesystem build system instead of
doing it manually. But okay:

Rrun a "make ARCH=arm INSTALL_MOD_PATH=<anywhere> modules_install"

Then copy the whole _content_ of path "<anywhere>/" into the root of your
target filesystem (should be
"<anywhere>/lib/modules/2.6.32.2-FriendlyARM/..."). At runtime modprobe
will search at "/lib/modules/2.6.32.2-FriendlyARM/".

Pierp0l
You have to copy the .ko module files in /lib/modules/<kernel name>/
then run "depmod" to register the new modules. Then the modprobe command
can find the modules and loads them..

Fuki
ok, I did everything you told me and it still doesn't work :/
this is what I did:
1. make clean
2. make menuconfig and chose which modules (M) I want to install
3. make
4. make ARCH=arm INSTALL_MOD_PATH=/home/michal/ins_mod modules_install
5. I copied all files from that folder to
/home/michal/Downloads/linux-2.6.32.2/lib/ and
/home/michal/Downloads/linux-2.6.32.2/arch/arm/lib/
6. depmod
7. make zImage
8. copied zImage to my mini2440 and booted
9. modprobe g_zero
Output: modprobe: 'g_zero.ko': No such device
10. modprobe g_file_storage file=/udisk/
Output: modprobe 'g_file_storage.ko': No such device

what am I doing wrong?

PS: Thank you all for your help.. I really appreciate it, since I am lost
:/

Juergen Beisert
Hmm, tried it here and everything is present.

"make ARCH=arm INSTALL_MOD_PATH=~/temp/test_modules modules_install"

is creating the folder "~/temp/test_modules/lib/modules/2.6.39-rc2".
And the part from "~/temp/test_modules/*" is required at the target.

At the target side the new modules must be visible in "/lib/modules/`uname
-r`" and the zImage and the modules must match

Fuki
yes, I did it just like that
I can see those modules in /lib/modules/2.6.32.2-FriendlyARM/
but when I want to use them, it says "no such device"

is it possible that USB gadget is not compatible with this kernel version?
do I have to change something in the source code for Gadget Zero? because
it seems to me that it should be fine, but there are some thing that I dont
understand

Juergen Beisert
So, modprobe works now. But it seems you do not have a USB device driver
running. Try a look into the drivers/usb/gadget directory and grep for
"ENODEV". This is the message you see.

Fuki
Hi, thank you for your help again :)
I tried to grep for "ENODEV", however, it gave me about 140 lines
containing ENODEV in various files and I don't know what to do with this
output.

Anyway, I tried to add some more modules that I thought could help in
menuconfig, recompiled it all and then tried to copy all files from
/drivers/usb/ to /lib/modules in my mini2440 and now it works! 

Well, at least it is running and not complaining anymore, but still nothing
happens when I connect my mini with usb to windows or linux. But I guess it
only needs some config. I will try now to look for something about it.

Thank you very much for all your help :) You really saved me Juergen.

Akshit
root@steadfast:~/Desktop/ARMLAB/linux-2.6.32.2# make modules_install
INSTALL_MOD_PATH:/home/akshit/Desktop/ARMLAB/roots_qtopia_qt4
Warning: you may need to install module-init-tools
See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt
  INSTALL drivers/char/mini2440_hello_module.ko
  INSTALL drivers/misc/eeprom/eeprom_93cx6.ko
  INSTALL drivers/net/wireless/ath/ar9170/ar9170usb.ko
  INSTALL drivers/net/wireless/ath/ath.ko
  INSTALL drivers/net/wireless/rt2x00/rt2500usb.ko
  INSTALL drivers/net/wireless/rt2x00/rt2800usb.ko
  INSTALL drivers/net/wireless/rt2x00/rt2x00lib.ko
  INSTALL drivers/net/wireless/rt2x00/rt2x00usb.ko
  INSTALL drivers/net/wireless/rt2x00/rt73usb.ko
  INSTALL drivers/net/wireless/rtl818x/rtl8187.ko
  INSTALL drivers/net/wireless/zd1201.ko
  INSTALL drivers/net/wireless/zd1211rw/zd1211rw.ko
  INSTALL drivers/scsi/scsi_wait_scan.ko
  INSTALL net/mac80211/mac80211.ko
  INSTALL net/wireless/cfg80211.ko
  INSTALL net/wireless/lib80211.ko
  DEPMOD  2.6.32.2-FriendlyARM
depmod: WARNING: could not open
/lib/modules/2.6.32.2-FriendlyARM/modules.builtin: No such file or
directory
make: *** No rule to make target
`INSTALL_MOD_PATH:/home/akshit/Desktop/ARMLAB/roots_qtopia_qt4'.  Stop.
root@steadfast:~/Desktop/ARMLAB/linux-2.6.32.2#