[Q] loading cifs module

Search This thread

enigma0456

Senior Member
Feb 11, 2011
154
10
Vegan ginger - loaded the standard with pershoot kernel but it has no cifs support. Replaced with clemsyn and cifs was great but after rebooting my screen hung and eventually I had to revert to my original without cuts. I think there is a way to instruct the pershoot kernel to load cifs support even thought it isn't compiled into the kernel. I'm looking for some step by step instructions to learn how to do that. Anyone know how?
 

aasoror

Senior Member
Jun 24, 2008
542
72
Kitchener, ON
Xiaomi Mi A2
How about reading the instructions posted by pershoots on the very same page from which you downloaded the kernel ?!?

To use one of the kernel modules:
Pull the one you want from lib-2632.39.tar.gz (winrar can open this),
adb remount
adb push MODULE.ko /system/lib/modules/2.6.32.39-cyanogenmod/
adb shell chmod 644 /system/lib/modules/2.6.32.39-cyanogenmod/MODULE.ko
adb shell insmod /system/lib/modules/2.6.32.39-cyanogenmod/MODULE.ko

- if you don't use adb then just use "terminal emulator" (from the market or preloaded with the some ROMs).
- replace "MODULE" with "cifs"
- use the lib file appropriate to your ROM and bootloader.

Best of luck,
 
Last edited:

enigma0456

Senior Member
Feb 11, 2011
154
10
Yeah - that was helpful !

"How about reading the instructions posted by pershoots on THE VERY SAME PAGE FROM WHICH YOU DOWNLOADED THE KERNEL?!?"
Having a bad day were we???
The kernel came with the rom so I never downloaded a kernel and had no idea where the page was - your link was helpful in that it took me to that page (not on xda forum) so I was able to download the library anyway. Sadly, I am not using cyanogen so the paths listed in the instructions don't apply I don't think. I'm also not using adb yet although I'm working up to it. I can use terminal emulator so that shouldn't be a problem assuming I find where to put the module. Possibly it can go anywhere in the system/lib/modules directory as long as I can point to it? I guess we'll have to try it and see.
The real question that you have raised is "use the lib file appropriate to your ROM and bootloader." How do you determine what is "appropriate"?
So perhaps someone would be willing to share a tad more knowledge and perhaps we will have a thread that other g-tab owners can use to learn from.
 

thebadfrog

Senior Member
Nov 28, 2010
1,584
471
Pushing modules in the kernel is the same no matter the rom and vegan ginger is built from cm source anyway
 

enigma0456

Senior Member
Feb 11, 2011
154
10
Pushing modules in the kernel is the same no matter the rom and vegan ginger is built from cm source anyway
So I downloaded lib-2632.39.tar.gz and unpacked it, searched around and found the cifs.ko file. I'm guessing that I can put that anywhere logical in /system/library and point to it. My app (CIFS Manager) has an option to load via insmod and asks for a path to it. I'm assuming that insmod is available and my app will call it to load the module? I'd also like to know how I would know without someone telling me that the module was in lib-2632.39.tar.gz? Is there some rationale that would tell me how this library and the kernel are related or are these libraries just generic in some way? Thanks for the helping hand.
 

schettj

Senior Member
Nov 17, 2006
655
56
I would know without someone telling me that the module was in lib-2632.39.tar.gz?

The kernel developers who provide the kernels and the extra optional modules provide information on their blogs when they post the availability of the kernel. For example, pershoot's blog has this info, as well as install instructions.

or you ask here.
 

aasoror

Senior Member
Jun 24, 2008
542
72
Kitchener, ON
Xiaomi Mi A2
The kernel came with the rom so I never downloaded a kernel and had no idea where the page was.
Sorry I mistakenly assumed since you mentioned pershoot that you have been to his thread (the most active in the development section).

Possibly it can go anywhere in the system/lib/modules directory as long as I can point to it?
Yes you certainly can.

How do you determine what is "appropriate"?
If you have a gingerbread based ROM download the the lib file with "gb" in its file name.
If you have a the new bootloader on the your gtab use the ones with "newbl" in the file name.

So I downloaded lib-2632.39.tar.gz and unpacked it, searched around and found the cifs.ko file.

Thats the wrong file (this is the one for Froyo ROMs).

I'm assuming that insmod is available and my app will call it to load the module?
True

I'd also like to know how I would know without someone telling me that the module was in lib-2632.39.tar.gz?
You wouldn't.

Is there some rationale that would tell me how this library and the kernel are related or are these libraries just generic in some way?
There isn't any, just the developers choice.
 
  • Like
Reactions: enigma0456

enigma0456

Senior Member
Feb 11, 2011
154
10
Thanks - that was really helpful. I like direct answers to questions. So I went and got the right library (looked for gb in name as directed). Moved the module onto my tab into a download directory via usb. Went to /System/Lib via terminal and there was no modules directory. I tried to make one and got an error that the file system is mounted read only. Arghhh I remember fighting with this when I was trying to install another keyboard. I never was able to resolve it. Theoretically "remount" should work but I searched and tried all different examples and I was never able to get it to work for me. I tested my cifs manager and it errors out - providing a base that cifs doesn't work without the module. I'm going to try pointing it at my download folder for now to see if the module would work. That is pretty messy so I would still like to put it in the proper place - if you feel up to it would you instruct me on how to overcome the deadly "mounted read only" file system problem?
________________________________
Update - put the cifs.ko file in /sdcard/download. Went into cifs manager and told it to load via insmod. Made path to cifs.ko = /sdcard/download (also tried /sdcard/download/cifs.ko) In all cases I get the message "... failed no such device". If I turn off the insmod feature I get the same message which leads me to believe that the cifs.ko isn't loading. As a test, I am using the exact same path to share, mount point, etc. on my other tab running Clemsyn/Calkulin that has cifs built into the kernel and it connects almost instantly. It is likely therefor that my problem revolves around this kernel loading cifs. Not sure what I'm doing wrong but suggestions are welcome.
 
Last edited:

rajeevvp

Senior Member
Aug 20, 2010
1,315
406
Bangalore
I'm guessing that I can put that anywhere logical in /system/library and point to it.
It's better if you put it in the standard place. What's the standard place? The paths in the kernel zip file and the module tar file should give you a clue:

Code:
$ tar -tzvf /mnt/sdcard/kernel/lib-2632.39_gb.tar.gz 
drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/
drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/
drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/
-rw-r--r-- root/root        73 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/modules.ieee1394map
-rw-r--r-- root/root     10709 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/modules.symbols.bin
-rw-r--r-- root/root       271 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/modules.alias
drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/
drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/
drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/
drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/auth_gss/
-rw-r--r-- root/root    408035 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/auth_gss/rpcsec_gss_krb5.ko
-rw-r--r-- root/root    532157 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko
-rw-r--r-- root/root   3424305 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/sunrpc.ko
Looks like the kernel modules need to be in a lib/modules/KERNEL-VERSION/ directory. That looks very Linux-ish. Can we just untar it to / as we do in Linux? Better check:

Code:
$ ls -l / | /system/xbin/fgrep lib
$
Yikes! No /lib directory at all on Android. Where the heck do the kernel modules go? Let's look at the kernel zip file to see if there is a clue--the unzip on the gTablet doesn't understand this zip file format, so check on a Linux system:

Code:
$ unzip -l boot-cm_2632.39_gb-oc-uv-xtra-vfp_fp-043011.zip 
Archive:  boot-cm_2632.39_gb-oc-uv-xtra-vfp_fp-043011.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
     1123  2008-02-28 21:33   META-INF/MANIFEST.MF
     1176  2008-02-28 21:33   META-INF/CERT.SF
     1714  2008-02-28 21:33   META-INF/CERT.RSA
   252000  2008-02-28 19:33   META-INF/com/google/android/update-binary
     1015  2098-06-15 19:23   META-INF/com/google/android/updater-script
    88544  2098-01-27 05:41   kernel/dump_image
    76132  2098-01-27 05:54   kernel/mkbootimg
      303  2098-03-22 09:35   kernel/mkbootimg.sh
    70992  2098-01-27 05:53   kernel/unpackbootimg
       56  2098-01-27 06:09   kernel/unpackbootimg.sh
  2219848  2098-06-22 03:05   kernel/zImage
    12234  2098-03-04 12:32   system/lib/hw/wlan/LICENSE.TXT
   258778  2011-04-30 16:14   system/lib/hw/wlan/bcm4329.ko
   249144  2011-04-11 01:13   system/lib/hw/wlan/fw_bcm4329.bin
   249467  2011-04-11 01:13   system/lib/hw/wlan/fw_bcm4329_apsta.bin
        0  2011-01-07 02:11   system/lib/modules/2.6.32.39-cyanogenmod/placeholder
---------                     -------
  3482526                     16 files
Hmm, there is a placeholder file in system/lib/modules/KERNEL-VERSION/, so /system's where the modules are supposed to go.

Code:
$ su
# /system/xbin/mount -w -o remount /system
# cd /system
# /system/xbin/tar -xzvf /mnt/sdcard/kernel/lib-2632.39_gb.tar.gz
# /system/xbin/mount -r -o remount /system
My app (CIFS Manager) has an option to load via insmod and asks for a path to it. I'm assuming that insmod is available and my app will call it to load the module?
Asks a path to what? Insmod or the kernel module?

I'd also like to know how I would know without someone telling me that the module was in lib-2632.39.tar.gz?
Kernel functionality, like filesystems, are either built into the kernel or added using kernel modules. (You can also have filesystems implemented in userspace, but, we'll skip that complexity for now). So, the guy who gave you the kernel would either have compiled the filesystem in or must supply the module file for it. First, check if the filesystem is built-in:

Code:
$ cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   bdev
nodev   proc
nodev   tmpfs
nodev   debugfs
nodev   sockfs
nodev   usbfs
nodev   pipefs
nodev   anon_inodefs
nodev   inotifyfs
nodev   configfs
nodev   devpts
        ext3
        ext2
        ext4
nodev   ramfs
        vfat
        msdos
        yaffs
        yaffs2
No CIFS, so it's not compiled in; we'll have to load the module:

Code:
$ su
# insmod /system/lib/modules/2.6.32.39-cyanogenmod/kernel/fs/cifs/cifs.ko
# cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   bdev
nodev   proc
nodev   tmpfs
nodev   debugfs
nodev   sockfs
nodev   usbfs
nodev   pipefs
nodev   anon_inodefs
nodev   inotifyfs
nodev   configfs
nodev   devpts
        ext3
        ext2
        ext4
nodev   ramfs
        vfat
        msdos
        yaffs
        yaffs2
nodev   cifs
Yup, CIFS is there now. But, this sort of thing gets tedious. You can use a shell script to make things easier. Here's what I use to mount my external USB HDD:

Code:
#!/system/bin/sh

PATH=/system/bin:/system/xbin

lsmod | fgrep -q nls_utf8 || insmod /system/lib/modules/`uname -r`/kernel/fs/nls/nls_utf8.ko
lsmod | fgrep -q ntfs     || insmod /system/lib/modules/`uname -r`/kernel/fs/ntfs/ntfs.ko

exec mount -r -t ntfs -o fmask=0111,dmask=0022,nls=utf8 /dev/block/sda1 /mnt/usbdisk
Just save the file somewhere and make it executable and run the script as superuser to mount the USB HDD.

Is there some rationale that would tell me how this library and the kernel are related or are these libraries just generic in some way?
Since these are kernel modules, they are by definition related, no?

Note that you need a Terminal Emulator and the Superuser app (both from Market) and busybox (also from Market) for the above commands to work. Also, do not type in the prompts (the '$' and '#' characters) at the beginning of the commands. They are there as a reference to show you when you're in superuser mode and when you're a normal user.
 
Last edited:

aasoror

Senior Member
Jun 24, 2008
542
72
Kitchener, ON
Xiaomi Mi A2
I tried to make one and got an error that the file system is mounted read only.

remount is specific to "adb", the equivalent in terminal emulator is:
Code:
su root
mount -o remount,rw /system
cp /sdcard/download/cifs.ko /system/lib/modules/cifs.ko
chmod 644 /system/lib/modules/cifs.ko
mount -o remount,ro /system

Then just use "Mount Manager" to load the copied CIFS module, might want to reboot if mount manager failed to do the insmod.

I have been using the above procedure with all pershoot's kernels without a problem.

This should solve your problem,
Best of luck,
 
  • Like
Reactions: enigma0456

SoNic67

Senior Member
Apr 10, 2011
1,065
201
I coludn't make it work either. It was in the right folder, suposedly "loaded" but it wasn't working.
I am on the Caulkin/Clemsyn ver 5 (the 1.5GHz) now - exactly because of this inability to load that module. I don't know why pershoot doesn't make it part of the kernel, maybe he doesn't have a PC in the house :)

Sure, the whole typing thingie in linux/android looks easy if that is what you do 24/7. But for less accustomed with that, all this is likely a turn-off.
 
Last edited:

schettj

Senior Member
Nov 17, 2006
655
56
I coludn't make it work either. It was in the right folder, suposedly "loaded" but it wasn't working.
I am on the Caulkin/Clemsyn ver 5 (the 1.5GHz) now - exactly because of this inability to load that module. I don't know why pershoot doesn't make it part of the kernel, maybe he doesn't have a PC in the house :)

Sure, the whole typing thingie in linux/android looks easy if that is what you do 24/7. But for less accustomed with that, all this is likely a turn-off.

GScript lite can automate the "whole typing thingie" - just put the insmod command there.

The nice thing about it being a module for the functions you rarely use is, for the 99.999% of the time that you don't need the functionality, it's not taking up memory since its not loaded.
 

enigma0456

Senior Member
Feb 11, 2011
154
10
I was just shutting down to get some zzzzs but I fired my PC back up to have a go at this. I worked through part of it - did get the remount working and was able to copy things to the directory and then remount ro. It didn't work yet but I was tired and I may have made a typo. I REALLY appreciate the detailed explanation and examples. This is a page I will refer back to over and over until it becomes second nature. Thanks. Questions:
1. I follow how you arrived at the location (although I don't have a kernel zip file) - is "placeholder" a standard or was that just experience and intuition that informed you?
2. The whole section about un-tarring lib-2632.39_gb.tar.gz - Linux is not my primary language so how did you know that it would un-tar to the proper kernel module directory? Did I miss something?
3. I have to go back and retrace my steps but I tried using both cifs manager and mount manager and they both fail claiming "there is no such device" I tried the manual steps for loading insmod and the cifs.ko as the example described and I get "failed (Exec format error)
Please dispense more wisdom as needed.
 

rajeevvp

Senior Member
Aug 20, 2010
1,315
406
Bangalore
Questions:
1. I follow how you arrived at the location (although I don't have a kernel zip file) - is "placeholder" a standard or was that just experience and intuition that informed you?
Experience and intuition.

The `placeholder' file is not a standard. On Linux, kernel modules are placed in /lib/modules/KERNEL-VERSION/, and the standard utility (or, program) which we use to load modules, modprobe, looks there for kernel modules. In fact, it's normally unnecessary to manually load modules like we have done. Usually on Linux, because of the standardized module locations, the appropriate modules are automatically loaded when needed.

Things are irritatingly (and unnecessarily) different on Android. There is no modprobe supplied with the system and the busybox modprobe still attempts to use the /lib/modules/... path as on Linux. Which is why you have to resort to insmod and the long-winded path to the kernel module.

I am new to Android myself, and the steps I outlined above are what I used to determine where things should go on the gTablet.

2. The whole section about un-tarring lib-2632.39_gb.tar.gz - Linux is not my primary language so how did you know that it would un-tar to the proper kernel module directory? Did I miss something?
You didn't notice the 'cd /system' command before the tar command extracting the kernel modules.

You move to the directory where things should be placed before untar'ing; and when you untar, tar will re-create the directory structure you see in the tar file in the directory you're currently in. Some versions of tar have a `-C' flag which you can use to change the current directory; sort-of like the 'Extract to directory' option you have in GUIs. If you had one of those tar commands you'd do this:

Code:
# /system/xbin/tar -C /system -xzvf /mnt/sdcard/kernel/lib-2632.39_gb.tar.gz
instead of this:

Code:
# cd /system
# /system/xbin/tar -xzvf /mnt/sdcard/kernel/lib-2632.39_gb.tar.gz
3. I have to go back and retrace my steps but I tried using both cifs manager and mount manager and they both fail claiming "there is no such device" I tried the manual steps for loading insmod and the cifs.ko as the example described and I get "failed (Exec format error)
Please dispense more wisdom as needed.
The error messages are helpful clues.

The "Exec format error" probably means that you've downloaded the wrong version of the kernel and/or modules. Pershoot supplies 4 versions: for Froyo-ROMs, for Gingerbread-ROMs, for tablets with the new Bootloader and Froyo-ROMs, and tablets with the new Bootloader and Gingerbread-ROMs. Use the correct version for your hardware and ROM.

The "no such device" error message is also a clue. The output of 'cat /proc/filesystems', above, after the cifs module was loaded has a line like:

Code:
nodev   cifs
which means that the cifs filesystem is not associated with an actual device file. The "no such device" means that you're (or the program you use is) incorrectly supplying a /dev/... parameter to the mount command, or have screwed up or incorrect options somewhere.

Here's how I mounted a Win 7 share on the gTablet just now. In a Terminal Emulator window:

Code:
$ su
# insmod /system/lib/modules/2.6.32.39-cyanogenmod/kernel/fs/cifs/cifs.ko
# mkdir /mnt/cifs
# mount -t cifs //SERVER-IP-ADDRESS/SHARE-NAME /mnt/cifs -o domain=DOMAIN,username=USERNAME,password=PASSWORD
This method is slightly insecure, though. It's better to create a file with

Code:
domain=DOMAIN
username=USERNAME
password=PASSWORD
and then pass the `credentials=filename' option instead of the `domain=...' above:

Code:
mount -t cifs //SERVER-IP-ADDRESS/SHARE-NAME /mnt/cifs -o credentials=/SOME/PATH/cifs-cred.txt
I know typing all this is a chore, but my goal is to help you troubleshoot things on your own in the future. Linux, and by extension, Android, is good in this regard. It's transparent and very inspectable--if something goes wrong, you can look around, and usually fix things up.

Cheers!
 
Last edited:
  • Like
Reactions: enigma0456

enigma0456

Senior Member
Feb 11, 2011
154
10
OK - well I tried the manual insmod as in your example and I get the "failed (Exec format error) so I'm going to assume that I still have the wrong module. I'm trying to avoid getting into the changing my kernel project right now so I'll go back and check again on Pershoots page to try and find the version of the kernel that is currently running in my g-tab and the appropriate library that goes with it. The problem must lie there. I was sure I had the right library to go with my 2.6.32.36-cynaogenmod root@pershoot-ubuntu #1 but then again, the labeling on his site doesn't reflect a name like that. The best I can find is boot-cm_2632.36_gb-xtra-vfp_fp-032711.zip and the associated lib-2632.36_gb.tar.gz (kernel modules). Is this really the kernel in my g-pad? Don't know how to tell but sems to be the only gingerbread one with that numbering series.
 

rajeevvp

Senior Member
Aug 20, 2010
1,315
406
Bangalore
If you use some kernel version X.Y.Z, you have to use the modules that were compiled with that kernel. It's not just the version numbers that have to match--the compilation options might matter too.

I.e., Make sure, you are running the kernel first, then install the modules. Just pick the latest GB (you mentioned you were running VEGAn-gingerbread) kernel from pershoot's page.

1. Download this kernel zip file: boot-cm_2632.39_gb-oc-uv-xtra-vfp_fp-043011.zip

2. Download the associated kernel module file: lib-2632.39_gb.tar.gz

3. Boot into ClockworkMod recovery to install the kernel. At the main menu, choose, "install zip from sdcard". Then select, "choose zip from sdcard", navigate to where you put the kernel zip file, then choose the zip file and apply it.

4. Reboot back into the normal system.

5. Now, follow the steps outlined above to untar the modules in /system. Do *not* use `chmod -R 644' to change permissions recursively. This command *removes* the execute permission from directories which *must* be present. The module tar file should, generally, have the correct permissions already.

6. Try the manual method first: insmod /SOME/PATH/cifs.ko must work, then try the mount command.

7. Unmount using `umount /MOUNT/POINT'.

You can troubleshoot the CIFS manager later.
 
Last edited:

enigma0456

Senior Member
Feb 11, 2011
154
10
Coda

This investigation lead me to the kernel naming investigation and the discovery that the module library must be compiled with the kernel that you are using. Obvious now but ... Anyway, in the process of learning about kernels I stumbled upon cyanogenmod so I loaded that onto my tab. I liked the way it works so I took another run at the cifs - and it did not work. I went back and followed these steps and made sure that I found the lib module that matched the kernel that came with my release of cyanogen. I extracted cifs.ko and copied it to the /system/lib/modules directory (I had to make the modules directory) and then I used cifsmanager to try and mount the share and it worked. Next I deleted the modules directory with the module in it and tried to mount the share and it failed. I put it all back and it worked again. So - the instructions preceding this post are sound and, if followed carefully, will work. The key seems to be making sure the lib module is the one that goes with your kernel. Thanks again to all those that contributed to my education!
 

rajeevvp

Senior Member
Aug 20, 2010
1,315
406
Bangalore
swan song

I went back and followed these steps and made sure that I found the lib module that matched the kernel that came with my release of cyanogen...

The key seems to be making sure the lib module is the one that goes with your kernel.
That may only have worked because CyanogenMod uses pershoot's kernel as its default kernel. Had it used Clemsyn's kernel instead, you may very well have ended up back at square one.

The golden rule is: Get the kernel and the kernel modules from the same guy, because he can (and probably does) build both at the same time. And because of this you can be sure that:

a) The modules were compiled with the correct kernel sources, header files and configuration options.

b) The same compiler was used to compile both the kernel and the modules.

c) The same compiler flags, like optimizations, were used for the compilations. In rare cases, I've seen mismatches here causing problems.

In most cases however, esp. on an architecture like the x86 which is very forgiving, slightly mismatched kernels and modules won't cause problems, but, this is not the sort of thing you should be futzing around with--unless you're a wizard.

I have 4 different versions of GCC (2 each for x86 and x86-64--stable and latest), the Intel C compiler v11, and 3 different compilers for the ARM (Android NDK, the prebuilt one from the Aboriginal Linux project and the latest GCC cross-compiled for the ARM). I use different version for different things and stick to each consistently.

OK, so kernels and modules have to be compiled together, but, what about userspace? Do normal programs have to be recompiled if you change the kernel?

No, not (generally) required. The Linux kernel developers have gone to great lengths to make sure that the kernel interface to userspace stay the same--in fact, it would only be a mild exaggeration to say that the kernel guys would rather give away their first-borns than break the userspace API.

This is the reason why you can run Clemsyn kernels on TnT-Lite, or pershoot kernels on VEGAn-Gingerbread, or whatever other combo you prefer.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    I'm guessing that I can put that anywhere logical in /system/library and point to it.
    It's better if you put it in the standard place. What's the standard place? The paths in the kernel zip file and the module tar file should give you a clue:

    Code:
    $ tar -tzvf /mnt/sdcard/kernel/lib-2632.39_gb.tar.gz 
    drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/
    drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/
    drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/
    -rw-r--r-- root/root        73 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/modules.ieee1394map
    -rw-r--r-- root/root     10709 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/modules.symbols.bin
    -rw-r--r-- root/root       271 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/modules.alias
    drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/
    drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/
    drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/
    drwxr-xr-x root/root         0 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/auth_gss/
    -rw-r--r-- root/root    408035 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/auth_gss/rpcsec_gss_krb5.ko
    -rw-r--r-- root/root    532157 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko
    -rw-r--r-- root/root   3424305 2011-04-30 20:14:37 lib/modules/2.6.32.39-cyanogenmod/kernel/net/sunrpc/sunrpc.ko
    Looks like the kernel modules need to be in a lib/modules/KERNEL-VERSION/ directory. That looks very Linux-ish. Can we just untar it to / as we do in Linux? Better check:

    Code:
    $ ls -l / | /system/xbin/fgrep lib
    $
    Yikes! No /lib directory at all on Android. Where the heck do the kernel modules go? Let's look at the kernel zip file to see if there is a clue--the unzip on the gTablet doesn't understand this zip file format, so check on a Linux system:

    Code:
    $ unzip -l boot-cm_2632.39_gb-oc-uv-xtra-vfp_fp-043011.zip 
    Archive:  boot-cm_2632.39_gb-oc-uv-xtra-vfp_fp-043011.zip
      Length      Date    Time    Name
    ---------  ---------- -----   ----
         1123  2008-02-28 21:33   META-INF/MANIFEST.MF
         1176  2008-02-28 21:33   META-INF/CERT.SF
         1714  2008-02-28 21:33   META-INF/CERT.RSA
       252000  2008-02-28 19:33   META-INF/com/google/android/update-binary
         1015  2098-06-15 19:23   META-INF/com/google/android/updater-script
        88544  2098-01-27 05:41   kernel/dump_image
        76132  2098-01-27 05:54   kernel/mkbootimg
          303  2098-03-22 09:35   kernel/mkbootimg.sh
        70992  2098-01-27 05:53   kernel/unpackbootimg
           56  2098-01-27 06:09   kernel/unpackbootimg.sh
      2219848  2098-06-22 03:05   kernel/zImage
        12234  2098-03-04 12:32   system/lib/hw/wlan/LICENSE.TXT
       258778  2011-04-30 16:14   system/lib/hw/wlan/bcm4329.ko
       249144  2011-04-11 01:13   system/lib/hw/wlan/fw_bcm4329.bin
       249467  2011-04-11 01:13   system/lib/hw/wlan/fw_bcm4329_apsta.bin
            0  2011-01-07 02:11   system/lib/modules/2.6.32.39-cyanogenmod/placeholder
    ---------                     -------
      3482526                     16 files
    Hmm, there is a placeholder file in system/lib/modules/KERNEL-VERSION/, so /system's where the modules are supposed to go.

    Code:
    $ su
    # /system/xbin/mount -w -o remount /system
    # cd /system
    # /system/xbin/tar -xzvf /mnt/sdcard/kernel/lib-2632.39_gb.tar.gz
    # /system/xbin/mount -r -o remount /system
    My app (CIFS Manager) has an option to load via insmod and asks for a path to it. I'm assuming that insmod is available and my app will call it to load the module?
    Asks a path to what? Insmod or the kernel module?

    I'd also like to know how I would know without someone telling me that the module was in lib-2632.39.tar.gz?
    Kernel functionality, like filesystems, are either built into the kernel or added using kernel modules. (You can also have filesystems implemented in userspace, but, we'll skip that complexity for now). So, the guy who gave you the kernel would either have compiled the filesystem in or must supply the module file for it. First, check if the filesystem is built-in:

    Code:
    $ cat /proc/filesystems
    nodev   sysfs
    nodev   rootfs
    nodev   bdev
    nodev   proc
    nodev   tmpfs
    nodev   debugfs
    nodev   sockfs
    nodev   usbfs
    nodev   pipefs
    nodev   anon_inodefs
    nodev   inotifyfs
    nodev   configfs
    nodev   devpts
            ext3
            ext2
            ext4
    nodev   ramfs
            vfat
            msdos
            yaffs
            yaffs2
    No CIFS, so it's not compiled in; we'll have to load the module:

    Code:
    $ su
    # insmod /system/lib/modules/2.6.32.39-cyanogenmod/kernel/fs/cifs/cifs.ko
    # cat /proc/filesystems
    nodev   sysfs
    nodev   rootfs
    nodev   bdev
    nodev   proc
    nodev   tmpfs
    nodev   debugfs
    nodev   sockfs
    nodev   usbfs
    nodev   pipefs
    nodev   anon_inodefs
    nodev   inotifyfs
    nodev   configfs
    nodev   devpts
            ext3
            ext2
            ext4
    nodev   ramfs
            vfat
            msdos
            yaffs
            yaffs2
    nodev   cifs
    Yup, CIFS is there now. But, this sort of thing gets tedious. You can use a shell script to make things easier. Here's what I use to mount my external USB HDD:

    Code:
    #!/system/bin/sh
    
    PATH=/system/bin:/system/xbin
    
    lsmod | fgrep -q nls_utf8 || insmod /system/lib/modules/`uname -r`/kernel/fs/nls/nls_utf8.ko
    lsmod | fgrep -q ntfs     || insmod /system/lib/modules/`uname -r`/kernel/fs/ntfs/ntfs.ko
    
    exec mount -r -t ntfs -o fmask=0111,dmask=0022,nls=utf8 /dev/block/sda1 /mnt/usbdisk
    Just save the file somewhere and make it executable and run the script as superuser to mount the USB HDD.

    Is there some rationale that would tell me how this library and the kernel are related or are these libraries just generic in some way?
    Since these are kernel modules, they are by definition related, no?

    Note that you need a Terminal Emulator and the Superuser app (both from Market) and busybox (also from Market) for the above commands to work. Also, do not type in the prompts (the '$' and '#' characters) at the beginning of the commands. They are there as a reference to show you when you're in superuser mode and when you're a normal user.
    1
    The kernel came with the rom so I never downloaded a kernel and had no idea where the page was.
    Sorry I mistakenly assumed since you mentioned pershoot that you have been to his thread (the most active in the development section).

    Possibly it can go anywhere in the system/lib/modules directory as long as I can point to it?
    Yes you certainly can.

    How do you determine what is "appropriate"?
    If you have a gingerbread based ROM download the the lib file with "gb" in its file name.
    If you have a the new bootloader on the your gtab use the ones with "newbl" in the file name.

    So I downloaded lib-2632.39.tar.gz and unpacked it, searched around and found the cifs.ko file.

    Thats the wrong file (this is the one for Froyo ROMs).

    I'm assuming that insmod is available and my app will call it to load the module?
    True

    I'd also like to know how I would know without someone telling me that the module was in lib-2632.39.tar.gz?
    You wouldn't.

    Is there some rationale that would tell me how this library and the kernel are related or are these libraries just generic in some way?
    There isn't any, just the developers choice.
    1
    I tried to make one and got an error that the file system is mounted read only.

    remount is specific to "adb", the equivalent in terminal emulator is:
    Code:
    su root
    mount -o remount,rw /system
    cp /sdcard/download/cifs.ko /system/lib/modules/cifs.ko
    chmod 644 /system/lib/modules/cifs.ko
    mount -o remount,ro /system

    Then just use "Mount Manager" to load the copied CIFS module, might want to reboot if mount manager failed to do the insmod.

    I have been using the above procedure with all pershoot's kernels without a problem.

    This should solve your problem,
    Best of luck,
    1
    Questions:
    1. I follow how you arrived at the location (although I don't have a kernel zip file) - is "placeholder" a standard or was that just experience and intuition that informed you?
    Experience and intuition.

    The `placeholder' file is not a standard. On Linux, kernel modules are placed in /lib/modules/KERNEL-VERSION/, and the standard utility (or, program) which we use to load modules, modprobe, looks there for kernel modules. In fact, it's normally unnecessary to manually load modules like we have done. Usually on Linux, because of the standardized module locations, the appropriate modules are automatically loaded when needed.

    Things are irritatingly (and unnecessarily) different on Android. There is no modprobe supplied with the system and the busybox modprobe still attempts to use the /lib/modules/... path as on Linux. Which is why you have to resort to insmod and the long-winded path to the kernel module.

    I am new to Android myself, and the steps I outlined above are what I used to determine where things should go on the gTablet.

    2. The whole section about un-tarring lib-2632.39_gb.tar.gz - Linux is not my primary language so how did you know that it would un-tar to the proper kernel module directory? Did I miss something?
    You didn't notice the 'cd /system' command before the tar command extracting the kernel modules.

    You move to the directory where things should be placed before untar'ing; and when you untar, tar will re-create the directory structure you see in the tar file in the directory you're currently in. Some versions of tar have a `-C' flag which you can use to change the current directory; sort-of like the 'Extract to directory' option you have in GUIs. If you had one of those tar commands you'd do this:

    Code:
    # /system/xbin/tar -C /system -xzvf /mnt/sdcard/kernel/lib-2632.39_gb.tar.gz
    instead of this:

    Code:
    # cd /system
    # /system/xbin/tar -xzvf /mnt/sdcard/kernel/lib-2632.39_gb.tar.gz
    3. I have to go back and retrace my steps but I tried using both cifs manager and mount manager and they both fail claiming "there is no such device" I tried the manual steps for loading insmod and the cifs.ko as the example described and I get "failed (Exec format error)
    Please dispense more wisdom as needed.
    The error messages are helpful clues.

    The "Exec format error" probably means that you've downloaded the wrong version of the kernel and/or modules. Pershoot supplies 4 versions: for Froyo-ROMs, for Gingerbread-ROMs, for tablets with the new Bootloader and Froyo-ROMs, and tablets with the new Bootloader and Gingerbread-ROMs. Use the correct version for your hardware and ROM.

    The "no such device" error message is also a clue. The output of 'cat /proc/filesystems', above, after the cifs module was loaded has a line like:

    Code:
    nodev   cifs
    which means that the cifs filesystem is not associated with an actual device file. The "no such device" means that you're (or the program you use is) incorrectly supplying a /dev/... parameter to the mount command, or have screwed up or incorrect options somewhere.

    Here's how I mounted a Win 7 share on the gTablet just now. In a Terminal Emulator window:

    Code:
    $ su
    # insmod /system/lib/modules/2.6.32.39-cyanogenmod/kernel/fs/cifs/cifs.ko
    # mkdir /mnt/cifs
    # mount -t cifs //SERVER-IP-ADDRESS/SHARE-NAME /mnt/cifs -o domain=DOMAIN,username=USERNAME,password=PASSWORD
    This method is slightly insecure, though. It's better to create a file with

    Code:
    domain=DOMAIN
    username=USERNAME
    password=PASSWORD
    and then pass the `credentials=filename' option instead of the `domain=...' above:

    Code:
    mount -t cifs //SERVER-IP-ADDRESS/SHARE-NAME /mnt/cifs -o credentials=/SOME/PATH/cifs-cred.txt
    I know typing all this is a chore, but my goal is to help you troubleshoot things on your own in the future. Linux, and by extension, Android, is good in this regard. It's transparent and very inspectable--if something goes wrong, you can look around, and usually fix things up.

    Cheers!