[HOWTO] (+2.3.4) build cifs.ko (for stock kernel)

Search This thread

tegrak

Senior Member
Jan 12, 2011
575
346
Seoul
tegrak2x.blogspot.com
Complied cifs.ko and slow-work.ko
2.3.4 I9100-XXKG2-CIFS.zip
2.3.3 cifs-for-GT-I9100.zip

1. get the SHW-M250L kernel source from OSRC.
https://opensource.samsung.com/

2. copy files to fs/cifs folder.
kernel/slow-work.c
kernel/slow-work.h

3. add below codes to top of fs/cifs/slow-work.c (in kernel/timer.c)
Code:
static unsigned long round_jiffies_common(unsigned long j, int cpu,
		bool force_up)
{
	int rem;
	unsigned long original = j;

	/*
	 * We don't want all cpus firing their timers at once hitting the
	 * same lock or cachelines, so we skew each extra cpu with an extra
	 * 3 jiffies. This 3 jiffies came originally from the mm/ code which
	 * already did this.
	 * The skew is done by adding 3*cpunr, then round, then subtract this
	 * extra offset again.
	 */
	j += cpu * 3;

	rem = j % HZ;

	/*
	 * If the target jiffie is just after a whole second (which can happen
	 * due to delays of the timer irq, long irq off times etc etc) then
	 * we should round down to the whole second, not up. Use 1/4th second
	 * as cutoff for this rounding as an extreme upper bound for this.
	 * But never round down if @force_up is set.
	 */
	if (rem < HZ/4 && !force_up) /* round down */
		j = j - rem;
	else /* round up */
		j = j - rem + HZ;

	/* now that we have rounded, subtract the extra skew again */
	j -= cpu * 3;

	if (j <= jiffies) /* rounding ate our timeout entirely; */
		return original;
	return j;
}

unsigned long round_jiffies(unsigned long j)
{
	return round_jiffies_common(j, raw_smp_processor_id(), false);
}

4. edit fs/cifs/Makefile
obj-$(CONFIG_CIFS) += cifs.o slow-work.o

5. make menuconfig
File systems > [*] Network File Systems > <M> CIFS Support

6. make modules

7. put files to your phone.
fs/cifs/slow-work.ko
fs/cifs/cifs.ko

8. insert modules.
insmod slow-work.ko
insmod cifs.ko

Done! Enjoy!
 

Attachments

  • cifs-for-GT-I9100.zip
    105.1 KB · Views: 2,089
  • I9100-XXKG2-CIFS.zip
    108.5 KB · Views: 2,639
Last edited:

m_pascal

Senior Member
Oct 20, 2010
93
5
Parma
I'm on stock KE7+CF Root and I have some problems.
I've downloaded cifs-for-GT-I9100.zip, uncompressed it and put the two files in /fs/cifs

ROOT---cf---cifs---cifs.ko
..................... |__slow-work.ko

I've started ADB SHELL and I typed
Code:
$su
#cd fs
#cd cifs
#insmod slow-work.ko [B](no reply, so I think it goes well)[/B]
#insmod cifs.ko [B](I get two messages of error "[I]insmod: can't insert 'cifs.ko': unknown symbol in module or invalid paramete[/I]r" or "[I]insmod: can't insert 'cifs.ko': invalid parameter[/I]", it depends)[/B]
I'm doing something wrong? I'm sorry but I need this function but I'm not a good hacker :eek:
 

tegrak

Senior Member
Jan 12, 2011
575
346
Seoul
tegrak2x.blogspot.com
I'm on stock KE7+CF Root and I have some problems.
I've downloaded cifs-for-GT-I9100.zip, uncompressed it and put the two files in /fs/cifs

ROOT---cf---cifs---cifs.ko
..................... |__slow-work.ko

I've started ADB SHELL and I typed
Code:
$su
#cd fs
#cd cifs
#insmod slow-work.ko [B](no reply, so I think it goes well)[/B]
#insmod cifs.ko [B](I get two messages of error "[I]insmod: can't insert 'cifs.ko': unknown symbol in module or invalid paramete[/I]r" or "[I]insmod: can't insert 'cifs.ko': invalid parameter[/I]", it depends)[/B]
I'm doing something wrong? I'm sorry but I need this function but I'm not a good hacker :eek:

Download it again. I've just uploaded rebuilt modules and it worked on KE7 kernel.
 

richyy74

Senior Member
Dec 24, 2010
166
29
Budapest
Working for me.

Thanks

Just a quick question because I failed with it: did you do any config other than enabling cifs?

Sent from my GT-I9100 using XDA App
 

m_pascal

Senior Member
Oct 20, 2010
93
5
Parma
Now "insmod cifs.ko" command has been accepted but "insmod slow-work.ko" tell me that that module has been inserited.
If the actual module is the same of yesterday there are no problem because yesterday I inserited it, otherwise I need the command for to remove the old module.

Let's go for try this hack!!! Thanks!!!
 

jps1974

Senior Member
Nov 8, 2009
108
47
Vienna
The new version is working for me on stock KE2 (now Mount Manager isn't working with the Galaxy S II, but that's a different story ;) -> CifsManager works fine). Thanks!

May I ask what was changed in the latest version to make it work?
 

m_pascal

Senior Member
Oct 20, 2010
93
5
Parma
Grrrr!!!! I've installed Astro and his SMB module but, when I click on wifi button in the program, Astro crashes.
On Galaxy S I had the same problem.
Is there another program for to try this cifs.ko with pc?

Question 2: With this hack is possible to stream videos from pc to SGS2, viceversa, or both the directions? And It's the same for http/ftp connections?
 

jps1974

Senior Member
Nov 8, 2009
108
47
Vienna
Grrrr!!!! I've installed Astro and his SMB module but, when I click on wifi button in the program, Astro crashes.
On Galaxy S I had the same problem.
Is there another program for to try this cifs.ko with pc?

Question 2: With this hack is possible to stream videos from pc to SGS2, viceversa, or both the directions? And It's the same for http/ftp connections?
You don't need the SMB module - that's the whole point of the cifs module, so you can mount your shares within the phone's file system. Try CifsManager from the market, it will mount your shares to /mnt/cifs/<share> by default so you can access it with any file manager, and yes, any video player. It can also load the modules - put in the following to load both (my modules are in /sdcard/):

Code:
slow-work.ko;insmod /sdcard/cifs.ko
 
  • Like
Reactions: CekMTL and mdalacu

mdalacu

Senior Member
Dec 13, 2006
880
197
Bucharest
dmsimpleapps.blogspot.ro
I've used Android Terminal and Cifs Manager to get this working. And really works!
Can we increase the read ahead buffer for cifs, does such a thing even exists? I need this because i've tried to play a 480p avi with mobo player and it was choppy because of constant buffering.
Thank you.

This is what i've used with Android Terminal after i've extracted the contents of cifs-for-GT-I9100.zip (from first post) to the root of my internal sdcard (/mnt/sdcard):
$su
#insmod /mnt/sdcard/slow-work.ko
#insmod /mnt/sdcard/cifs.ko

Note: After i have disabled wifi and put the phone in standbay for 30 minutes, it was very hot so i have restated it. Any ideeas?
 
Last edited:
  • Like
Reactions: CekMTL

jackleung

Inactive Recognized Developer
Apr 10, 2005
2,307
47
USA
nls_utf8.ko for Galaxy SII?

Hi I have some files/folders in Chinese. Where can I find the nls_utf8.ko for Galxay SII, thx?
 

adverse

New member
Sep 27, 2006
4
0
All of this quiet over whelming is there a simpler way to enable this for stock kernel?

the *nood* way. Just wondering, not trying to piss anyone off.
 

jackleung

Inactive Recognized Developer
Apr 10, 2005
2,307
47
USA
Should not be necessary, AFAIK the kernel has this built in. You do need to use the mount option 'iocharset=utf8' though.
I am root and using stock KE7 kernel. Once I use this option in CifsManager, it reports segmentation fault error. Without such option, I can mount ok but with garbage characters for those Chinese named folder.

edit: you are right. It's built-in and I can mount properly with CLI. Probably something wrong with CifsManager. Someone already report this issue to the developer (http://forum.xda-developers.com/showpost.php?p=13480264&postcount=351)
 
Last edited:

Toss3

Senior Member
May 13, 2008
2,305
703
Stockholm
All of this quiet over whelming is there a simpler way to enable this for stock kernel?

the *nood* way. Just wondering, not trying to piss anyone off.

This is all really simple(requires root) - download the cifs. ko and slow-work.ko files and put them on your sdcard. Then just download "terminal emulator" from the market and "cifs manager". Now open up the terminal and input the following:
$su
# insmod /mnt/sdcard/slow-work.ko
# insmod /mnt/sdcard/cifs.ko
(remember to click "Allow" at the root privlidges popup)

Then open cifs manager and click "Add new share.." and input the ip adress and folder for your share and voila you're done! Shouldn't take you more than a minute or so! ;)

Note: I got an input/output error when I tried mounting a shared folder on an account without a password(Windows 7 64-bit).
 
  • Like
Reactions: Mujja

Slick_42

Member
Aug 17, 2009
34
8
All of this quiet over whelming is there a simpler way to enable this for stock kernel?

the *nood* way. Just wondering, not trying to piss anyone off.

Copy the two files to the sdcard and use cifsmanager from the Android market. Add the line "/mnt/sdcard/slow-work.ko:/mnt/sdcard/cifs.ko" to the advanced settings. Activate the "load per insmod " and the load on start options.

Sent from my GT-I9100 using XDA Premium App
 
  • Like
Reactions: pierro78 and thanku

thanku

Member
Apr 2, 2008
42
1
Many thanks this made very simple for me too.

However for me I have to type the the following in cisfs manger to get it to work

/sdcard/slow-work.ko:/sdcard/cifs.ko

Many Thanks

Copy the two files to the sdcard and use cifsmanager from the Android market. Add the line "/mnt/sdcard/slow-work.ko:/mnt/sdcard/cifs.ko" to the advanced settings. Activate the "load per insmod " and the load on start options.

Sent from my GT-I9100 using XDA Premium App
 

huzz

Senior Member
Apr 1, 2005
454
70
AlAin
Great Stuff, thanks for tegrak!

Thought is it me or streaming files is laggy on the other hand plex works great, odd :/ Also on the same network my XOOM streams just fine via cifs itself.

Cheers.
 

Slick_42

Member
Aug 17, 2009
34
8
The only solution for the lag I found so far is using the rock player in software mode.

Sent from my GT-I9100 using XDA Premium App
 

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    Complied cifs.ko and slow-work.ko
    2.3.4 I9100-XXKG2-CIFS.zip
    2.3.3 cifs-for-GT-I9100.zip

    1. get the SHW-M250L kernel source from OSRC.
    https://opensource.samsung.com/

    2. copy files to fs/cifs folder.
    kernel/slow-work.c
    kernel/slow-work.h

    3. add below codes to top of fs/cifs/slow-work.c (in kernel/timer.c)
    Code:
    static unsigned long round_jiffies_common(unsigned long j, int cpu,
    		bool force_up)
    {
    	int rem;
    	unsigned long original = j;
    
    	/*
    	 * We don't want all cpus firing their timers at once hitting the
    	 * same lock or cachelines, so we skew each extra cpu with an extra
    	 * 3 jiffies. This 3 jiffies came originally from the mm/ code which
    	 * already did this.
    	 * The skew is done by adding 3*cpunr, then round, then subtract this
    	 * extra offset again.
    	 */
    	j += cpu * 3;
    
    	rem = j % HZ;
    
    	/*
    	 * If the target jiffie is just after a whole second (which can happen
    	 * due to delays of the timer irq, long irq off times etc etc) then
    	 * we should round down to the whole second, not up. Use 1/4th second
    	 * as cutoff for this rounding as an extreme upper bound for this.
    	 * But never round down if @force_up is set.
    	 */
    	if (rem < HZ/4 && !force_up) /* round down */
    		j = j - rem;
    	else /* round up */
    		j = j - rem + HZ;
    
    	/* now that we have rounded, subtract the extra skew again */
    	j -= cpu * 3;
    
    	if (j <= jiffies) /* rounding ate our timeout entirely; */
    		return original;
    	return j;
    }
    
    unsigned long round_jiffies(unsigned long j)
    {
    	return round_jiffies_common(j, raw_smp_processor_id(), false);
    }

    4. edit fs/cifs/Makefile
    obj-$(CONFIG_CIFS) += cifs.o slow-work.o

    5. make menuconfig
    File systems > [*] Network File Systems > <M> CIFS Support

    6. make modules

    7. put files to your phone.
    fs/cifs/slow-work.ko
    fs/cifs/cifs.ko

    8. insert modules.
    insmod slow-work.ko
    insmod cifs.ko

    Done! Enjoy!
    3
    I'm on stock KE7+CF Root and I have some problems.
    I've downloaded cifs-for-GT-I9100.zip, uncompressed it and put the two files in /fs/cifs

    ROOT---cf---cifs---cifs.ko
    ..................... |__slow-work.ko

    I've started ADB SHELL and I typed
    Code:
    $su
    #cd fs
    #cd cifs
    #insmod slow-work.ko [B](no reply, so I think it goes well)[/B]
    #insmod cifs.ko [B](I get two messages of error "[I]insmod: can't insert 'cifs.ko': unknown symbol in module or invalid paramete[/I]r" or "[I]insmod: can't insert 'cifs.ko': invalid parameter[/I]", it depends)[/B]
    I'm doing something wrong? I'm sorry but I need this function but I'm not a good hacker :eek:

    Download it again. I've just uploaded rebuilt modules and it worked on KE7 kernel.
    2
    Grrrr!!!! I've installed Astro and his SMB module but, when I click on wifi button in the program, Astro crashes.
    On Galaxy S I had the same problem.
    Is there another program for to try this cifs.ko with pc?

    Question 2: With this hack is possible to stream videos from pc to SGS2, viceversa, or both the directions? And It's the same for http/ftp connections?
    You don't need the SMB module - that's the whole point of the cifs module, so you can mount your shares within the phone's file system. Try CifsManager from the market, it will mount your shares to /mnt/cifs/<share> by default so you can access it with any file manager, and yes, any video player. It can also load the modules - put in the following to load both (my modules are in /sdcard/):

    Code:
    slow-work.ko;insmod /sdcard/cifs.ko
    2
    All of this quiet over whelming is there a simpler way to enable this for stock kernel?

    the *nood* way. Just wondering, not trying to piss anyone off.

    Copy the two files to the sdcard and use cifsmanager from the Android market. Add the line "/mnt/sdcard/slow-work.ko:/mnt/sdcard/cifs.ko" to the advanced settings. Activate the "load per insmod " and the load on start options.

    Sent from my GT-I9100 using XDA Premium App
    1
    I've used Android Terminal and Cifs Manager to get this working. And really works!
    Can we increase the read ahead buffer for cifs, does such a thing even exists? I need this because i've tried to play a 480p avi with mobo player and it was choppy because of constant buffering.
    Thank you.

    This is what i've used with Android Terminal after i've extracted the contents of cifs-for-GT-I9100.zip (from first post) to the root of my internal sdcard (/mnt/sdcard):
    $su
    #insmod /mnt/sdcard/slow-work.ko
    #insmod /mnt/sdcard/cifs.ko

    Note: After i have disabled wifi and put the phone in standbay for 30 minutes, it was very hot so i have restated it. Any ideeas?