yashsingh1/xdaforums huggingface dataset:
[Nexus 7 General] and_ncuser:
Rebuilding later...

I built the three modules from the kernel source successfully, as well. It does seem like a pretty confusing the first time, since I couldn't actually find a step-by-step that went through all of the steps.

NOTE: Sigh, apparently a new user can't post outside links, which makes it really difficult to provide useful information. So you'll have to fill in these abbreviations in the recipe below.

[HTTPS] = https:

[AGS] = android dot googlesource dot com

[SAC] = source dot android dot com

mkdir android
cd android
git clone [HTTPS]//[AGS]/kernel/tegra.git
cd tegra

[find the kernel version, these are webpages]
[HTTPS]//[AGS]/kernel/tegra.git/
--> leads to android-tegra3-grouper-3.1-jb-mr0---->
[HTTPS]//[AGS]/kernel/tegra.git/+/android-tegra3-grouper-3.1-jb-mr0

[checkout the id]
git checkout android-tegra3-group3.1-jb-mr0

[assuming you've already picked up the prebuild toolchain
check here: [HTTPS]//[SAC]/source/building-kernels.html
...note these instructions....
git clone [HTTPS]//[AGS]/platform/prebuilt
export PATH=$(pwd)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/
from the android build page]

export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:/usr/src/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
make tegra3_android_defconfig
make menuconfig
[enable cifs module, not sure if it was necessary to enable the nls-utf8 module manually, but I did]
make modules

Modules should be built into:
/crypto/md4.ko
/fs/cifs/cifs.ko
/fs/nls/nls_utf8.ko
[Nexus 7 General] vetal_e:
Just registered to say thank you :)

Thank you sooo much, it works!
[Nexus 7 General] Alf.Red:
Thank you :)
[Nexus 7 General] intronauta:
it works perfectly with stock kernel, thanks!!
[Nexus 7 General] rom4you:
Thank you very much for such detailed instructions. I appreciate your help.
[Nexus 7 General] 1200deluxe:
Thanks

Like other members, I prefer to work with the stock kernel, and prefer also to do smb filesharing through loading modules - it's more direct than userspace workarounds, and allows me to remove them when not in use. Thanks also for your explanation of how to compile them.

1200deluxe
[Nexus 7 General] ThurstonX:
Success!

Just wanted to say thanks. Got it working on new, newly rooted 32GB N7, after letting it update to 4.1.2 (JZO54K). This is main reason I rooted it :highfive:
[Nexus 7 General] freecity:
Deleted
[Nexus 7 General] jmdearras:
What permissions need to be set? Mine won't load.
[Nexus 7 General] ThurstonX:
I used the guide here, mostly from the Mount Manager section on:

http://www.reviewlagoon.com/?p=734

It links to these modules:

http://xdaforums.com/attachment.php?attachmentid=1416417&d=1350727368

As long as you're rooted and you set up Mount Manager correctly, it will work. I was able to mount the three shares I have on my NASes. If you know the modules are loaded (per Mount Manager's info) and the share(s) won't mount, check the path. I had a typo in the path the first time I tried to mount a share, and thus it wouldn't mount. My shares use Guest access (i.e., any PC/device on my LAN can access them), so I'm not feeding username/password. So if a share won't mount, check how it's configured.

Mount Manager is great, as it will automount when you boot, if you select that option. I don't know the consequences of using automount when the shares are unavailable. It might only be an issue with apps (e.g., DeaDBeeF) that use a CIFS mount as their main media directory.

If you'd like specifics on how I set up Mount Manager, let me know.

Hope that helps.
[Nexus 7 General] jmdearras:
It's fine, now. Somehow I had the wrong versions of the .ko files, I was certain I had downloaded the right stuff!:cyclops:
[Nexus 7 General] ThurstonX:
CIFS for 4.2?

Not sure if this is the right thread, but any chance of getting the CIFS modules for 4.2? I know it's early...

Thanks :D
[Nexus 7 General] darkuni:
+1 ... I'll need 'em for my Nexus 10 when it gets here.
[Nexus 7 General] phierce:
I need them too
[Nexus 7 General] darkuni:
Wonder what it takes to actually MAKE these files? I know they have to be like RECOMPILED under a certain build - but if we had a tutorial or something, maybe we could empower the people to make them and not have to wait for each new release?

Thoughts?
[Nexus 7 General] pfcsabre:
CIFS 3.1.10-g22b4fcd

Here´s the cifs for stock 3.1.10-g22b4fcd (4.2 JOP40C). Didn´t test it though, I baked mine in my custom kernel.
[Nexus 7 General] ThurstonX:
Thanks a lot :)
[Nexus 7 General] darkuni:
Fantastic! Say, let us know when your custom kernel is out. I'm looking for one for 4.2 :)
[Nexus 7 General] NicoGa:
Thanks a lot,

but I get the following error when trying to load the modules:

insmod: init_module failed cifs.ko (Exec format error)

Anybody else tried the new module for 4.2 ?
[Nexus 7 General] darkuni:
Probably over the next hour I will be. Did you try dropping them in system/libs/modules and rebooting?
[Nexus 7 General] darkuni:
Yeah, no go here. I tried both ways.

Sigh ... Appreciate the effort!
[Nexus 7 General] sensboston:
pfcsabre, your modules has incorrect vermagic=3.1.10-g22b4fcd-dirty, should be just vermagic=3.1.10-g22b4fcd (without dirty).

Update: I've fixed vermagic (fixed files in attachment), but looks like we have another problem: all modules are loaded without errors, share also mounted successfully (according to log) but mount point has no files :(
[Nexus 7 General] Shadohd:
Tried this and no luck, getting empty directories after a successful mount like above. Damn...
[Nexus 7 General] intronauta:
I think that it's the same problem that we're suffering with stickmount....

Maybe is it related to the mutiuser structure and permissions included in 4.2?
[Nexus 7 General] NicoGa:
thanks!

I wonder if this second bug has to do with permissions and multiuser?

edit: intronauta, we had the same idea at the same time but I was slightly slower. :-\

Envoyé depuis mon Nexus 7
[Nexus 7 General] glimmling:
Same problem with the kernel from faux123:

http://xdaforums.com/showthread.php?t=1804374&page=118

I think, CIFS-Manager needs an update to work with 4.2.

Mounting with busybox seems to work.

Gesendet von meinem Nexus 7 mit Tapatalk 2
[Nexus 7 General] vw_mkv:
How were you able to mount via busybox? The mounted directory is empty when viewed with es file explorer. Can you provide your steps, thanks.
[Nexus 7 General] glimmling:
I'm not at home, so I didn't test it myself. But see post #1175 in the linked thread.

Or maybe this way: http://xdaforums.com/showthread.php?t=733490

Gesendet von meinem Nexus 7 mit Tapatalk 2
[Nexus 7 General] vw_mkv:
Thanks I'll check that thread.
[Nexus 7 General] jmtw000:
I think this is definitely related to the new multi user BS. I tried with modules I compiled myself and get the same thing, mounts fine but can't see any files. Here's the weird thing though, I can mount my CIFS shares manually from the terminal just fine, and can even see my files in the terminal. But, if I go to the mount point with a file manager it's empty. If I use CIFS Manager to mount the share, I can't see any files in either the terminal or the file manager apps. I even tried with the nls_utf8 module but got the same thing. When I look at the permissions and user/group of the mount point and sub directories, they are EXACTLY the same as the permissions of the sdcard's mount point and sub directories. I think Google ****ed us. They changed something in the way the API gets directory listings I think. But how can you find out what aside from digging through the code? Could there a config file somewhere laying out which mount points the app API has access to? How are they preventing apps from getting the directory listing? Is it so much to ask that they document this kind of stuff? Google seems to have systemic problems with documentation. i.e. They just do a **** job at it. WTF Google? http://source.android.com/tech/storage doesn't exist.
[Nexus 7 General] darkuni:
According to the word, all device access is handled on the PROCESS level. That's why it works in busybox's process, but not when you change processes.

So, pretty much, every app is going to have to have CIFS baked into it. :(
[Nexus 7 General] sensboston:
Hmm, I see a very bad tendency: first, Amazon f&%*d all whitehats from MobileRead and closed all software holes in Kindle Paperwhite firmware; now Google "improved" Android OS :( As mentioned at MobileRead forum, DMCA exception about tablets "hacking" will expire soon (or already expired) so a bad times are coming, probably... :(
[Nexus 7 General] jmtw000:
Well, that about sucks. I'm guessing they did that in the kernel?
[Nexus 7 General] darkuni:
I'm no developer. That's what Chain fire said though.
[Nexus 7 General] ea_:
Is this related to NFS as well?

As far as I'm concerned this means that I will stay on 4.1.2 for as long as possible.
[Nexus 7 General] zrangel:
Downgrade to 4.1.2 in 3...2...1....
[Nexus 7 General] ea_:
Is there a place where I can open a bug report on the android development tree?

Or has any already been open?
[Nexus 7 General] ea_:
OMG it seems like they ****ed up big time, this is going to be hard to revert in the main tree.

Damm I got a nexus in order to develop some apps on the original environment and now I will have to install a custom ROM if I want to use the device for personal use.

This is sad.

I know, closed development makes me sad...

That said, beeing root can we just mount the cifs block device as shared:

mount --make-shared [origin] [mount-point]

as in:

149	4) Use cases
150	------------
151
152	A) A process wants to clone its own namespace, but still wants to
153	access the CD that got mounted recently.
154
155	Solution:
156
157	The system administrator can make the mount at /cdrom shared
158	mount --bind /cdrom /cdrom
159	mount --make-shared /cdrom

If I understand it right the new system makes the mounts 'private' as defaults, so a utility as cifsmanger has to include the flag "--make-shared "

Maybe busybox will need a patch to support this flag?

Could some one please try to use this flag "--make-shared " (as root) and see if it helps?
[Nexus 7 General] H3g3m0n:
Don't loose hope, it is possible to get CIFS to work in Android applications (at least for me)!

The problem is I'm just not exactly sure how :/. It sometimes works and sometimes doesn't.

Possibly it's because I am doing it manually after boot, or maybe I am running something like cifsmanager which is fixing something but not doing the actual mount so then I forget about it, maybe it's something unrelated like AdbWireless. There is some Voodoo that I have to figure out.

I'm actually on a Nexus 10 and have been having all kinds of problems getting it setup.

Compiled my own modules, needed to get the magic version right.

For the Nexus 10, I needed a patched busybox binary for UNC support (The new Linux kernel requires some UNC flag to be passed along, busybox doesn't do that). There is a rom in the Nexus 10 Android development forums with that in there, U just grabbed the binary and copied it across. This is only on the newer kernel used on the Nexus 10 so shouldn't be an ussue with the Nexus 7.

I manually ran:

insmod md4.ko
insmod cifs.ko
busybox mount -t cifs -o username=MYUSER,password=MYPASS,unc=\\\\192.168.1.1\\storage //192.168.1.1/storage /data/media/0/cifs/Storage

Got it to show up in the Android apps, rebooted, tried again, not working :(

---------- Post added 21st November 2012 at 12:22 AM ---------- Previous post was 20th November 2012 at 11:49 PM ----------

So with some more testing, I have found that if I mount it manually via adb it actually works (either via USB or Wireless). Looks like adb either has some extra security permissions or settings. If I mount it manually without adb it doesn't show up. adb should be outside of the new multiuser stuff.

First I tried:

1) Turn on Nexus 10

2) Swipe to unlock screen

3) Touch ADB Wireless icons to start it <- Note this is the Holo version (white icons, not green).

4) Tap button (I have to do it twice since it starts in the Red position but isn't actually working, it goes red green red and then works).

5) adb connect tablet

6) adb shell

7) cd /sdcard

8) su

9) insmod modules-just-cifs/md4.ko

10) insmod modules-just-cifs/cifs.ko

11) busybox mount -t cifs -o username=USERNAME,password=PASSWORD,unc=\\\\192.168.1.1\\storage //192.168.1.1/storage /data/media/0/cifs/Storage

12) Home Button

13) Astro File Manager (Also the CyanogenMod one I installed via apk).

14) Go to /sdcard/cifs/Storage

15) Everything shows up OK!

Second I did everything the same, but with a runme.sh script for steps 9->11, worked OK.

Third, instead of steps 3->7 I used terminal emulator. DID NOT WORK!!, shown in terminal but not in Astro.

Forth, activated ADB Wireless but didn't actually connect to it, used terminal emulator instead. DID NOT WORK!!

Fifth, used USB Debugging, didn't start ADB wireless just a basic 'adb shell'. WORKED!!

So maybe as a total hack someone can put a version adb onto the devices themselfs and use it in a script. Otherwise just use a computer to start it up. But there should be a better way of narrowing down what's different between the adb shell and a local shell.
[Nexus 7 General] jmtw000:
I wish it were that easy :(

mount --make-shared [origin] [mount-point]

doesn't work. The mount from toolbox doesn't support the "--make-*" syntax. You can however pass the shared/slave options to it with the "-o " switch and the remount option. That said, it still doesn't work. I think it's because / has already been marked as slave by dalvik. The shell you run the mount commands from is started by dalvik and is under the slave namespace, so making the mount shared under that namespace will only affect processes spawned by the shell. Today, I'm going to mess around with disabling this shared garbage altogether. I'll report back on my findings.
[Nexus 7 General] jmtw000:
Setting init.rc to mount / as private instead of shared does not work :(
[Nexus 7 General] ea_:
Hmm as this is a new user privilege system I think that many utilities will have to change in order to work with the new system.

1. I guess that busybox will need a patch to work with the --make-shared flag, I'm not positivie that a -o flag could be enought.

I've seen this ROM where they claims that CIFS works so maybe we could look in it:

- http://rootzwiki.com/topic/36519-ro...rooted-deodexedmore-19-nov-2012/#entry1028027

2. User H3g3m0n suggest to mount the share from an ADB debug shell, which I guess starts from a different user priviledge prosition. For those that are root on their device it should be possible to launch a busybox script that mount that share with the highest privileges. Then cifsmanger should be able to do the same thing.
[Nexus 7 General] jmtw000:
The good news: I've got a workaround to mount CIFS shares so that they are accessible to all apps.

The bad news: It's not ideal as it can only mount the shares at boot time and I had to alter the init.rc in the boot.img to do it.

I edited the init.rc on my boot.img and added "mkdir /mnt/cifs 0755 sdcard_rw sdcard_rw" under the "# create mountpoints" section so that the mountpoint will persist through reboots. I then added the following to the service section:

service cifsmnt /system/bin/sh /system/bin/cifsmnt
class late_start
oneshot

I then put the cifs.ko and md4.ko modules into /system/lib/modules and created the following script as /system/bin/cifsmnt:

#!/system/bin/sh

/system/bin/logwrapper /system/bin/toolbox insmod /system/lib/modules/cifs.ko
/system/bin/logwrapper /system/bin/toolbox insmod /system/lib/modules/md4.ko

while ! /system/bin/toolbox ifconfig wlan0 | grep up
do
sleep 1
done

/system/bin/logwrapper /system/bin/toolbox mount -o user=myusername,password=mypassword,uid=1023,gid=1023,rw,nounix -t cifs //x.x.x.x/sharename /mnt/cifs

(I use logwrapper so I can see in the system log if it throws any errors.)

What this does is to run the script /system/bin/cifsmnt as a "oneshot" (does not restart when it finishes) service at boot time. The cifsmnt script loads the modules and then loops until it sees that the wlan0 interface is up (anyone know how to start the service after the wlan0 interface is up? I tried using the on net.change property, but that changes before the network is actually usable). It then mounts my share. Since the share is mounted by a service running under the master namespace the mount is propagated to any slave namespaces and is accessible by all apps. The downside to all of this is that you have to alter your init.rc which requires unpacking and repacking the boot.img, the share will only get mounted at boot time, and your password is sitting on the filesystem in a script. I liked using cifsmanager much better. I'm not sure how the app developers are going to handle this. Aside from creating a service that starts at boot time and then runs mount commands for the app, I don't see a way to have an app mount a filesystem that other apps can see :(
[Nexus 7 General] darkuni:
I've been hard at work trying to make this work with Craig's AOSP ROM. Here is what I've found (maybe this will help).

If you do it from a terminal - EVEN WITH using a uid/pid - it only appears to be accessible to the shell.

I was suggested to try going through ADB with busybox. Oddly enough this worked - but there is a caveat;

It only works with apps that are ALREADY RUNNING at the time the mount occurred! 100% reproducable, too

So... Fire up your favorite file manager. Then mount via busybox via ADB. The mount will work. Then go to your open file manager - poof - it works! Now open a NEW (second favorite) file manager that was NOT previously running. No go. It can't see it.

I'm not a developer; so I don't know what this means. But maybe knowing a 100% reproducable way of making it work/not work will be helpful.
[Nexus 7 General] jmtw000:
1. I'm not sure that ROM allows you to mount CIFS shares that are accessible to all apps.

Anyone know for sure?

2. You can mount filesystems and have them accessible to all apps from ADB because ADB isn't an Android app. It's a service started from init.rc. It's running in the master namespace, so any mounts it makes are propagated to the slaves. All Android apps are started by dalvik, which at it's stat sets / to slave. So any mounts made by Android apps do not propagate to the master namespace and other apps can't access them. Unfortunately, I don't think it's simply a matter of having the "highest privileges" :(
[Nexus 7 General] jmtw000:
If anyone is interested in using this workaround on the Nexus 7 here's my boot.img with the modified init.rc from my post above. This is ONLY for the Nexus 7 running stock Android 4.2 with the required kernel modules added. I take no responsibility if you brick your device, it starts a series of events which lead to the extinction of humanity, or if any other bad things happen. Proceed at your own risk. To use it, you have to have root. Copy the attached boot.img to your sdcard. Open a shell, su to root, and cd to your sdcard. Run

dd if=/dev/block/mmcblk0p2 of=./boot.img.back

to backup your existing boot.img. Then run

dd if=./boot.img of=/dev/block/mmcblk0p2

to install the new boot.img. Now run

mount -o remount,rw /system

to make your /system writable and place the following (adjust the mount line to your needs, the insmod line to point to your modules, and remove logwrapper if you don't want to log errors) in a file named /system/bin/cifsmnt

#!/system/bin/sh

/system/bin/logwrapper /system/bin/toolbox insmod /system/lib/modules/cifs.ko
/system/bin/logwrapper /system/bin/toolbox insmod /system/lib/modules/md4.ko

while ! /system/bin/toolbox ifconfig wlan0 | grep up
do
sleep 1
done

/system/bin/logwrapper /system/bin/toolbox mount -o user=myusername,password=mypassword,uid=1023,gid=1023,rw,nounix -t cifs //x.x.x.x/sharename /mnt/cifs

Now reboot, and you should be able to access your CIFS share in any app :)

If you need to go back to your old boot.img, just run

dd if=./boot.img.back of=/dev/block/mmcblk0p2

as root from the sdcard and reboot.
[Nexus 7 General] H3g3m0n:
Another work around, that doesn't require messing with boot.img or whatever.

The 'adb' binary actually ships with android on the tablets/phones.

You can use that, setup adbd to accept network connections and then connect to localhost.

I have a script on the Nexus 10 modules thread.

But it basically boils down to:

setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb connect localhost
adb -s localhost:5555 shell su root -c "your awesome mount commands go here"
[Nexus 7 General] glimmling:
I tried your script with Script Manager.

First I modifified the settings to my needs:

# Your settings here
USERNAME="xxx"
PASSWORD="xxx"
IPADDRESS="192.168.178.23"
SHARE="public"
MOUNT_POINT="/data/media/0/Shares/public"

Su access is granted But I get the "Mounting failed..." error message:
[Nexus 7 General] jmtw000:
I didn't know you could connect locally to adb like that. I can confirm that this works on my Nexus 7. I like this method better than messing with init.rc :) It also means there is hope for apps like cifsmanager.
[Nexus 7 General] jmtw000:
I have a workaround to get cifsmanager (and mount in general) functional again! Thanks to the ADB info from H3g3m0n I had the idea to replace the mount and umount links in /system/bin with the following. Since cifsmamager just uses the mount/umount commands, it works perfectly on my Nexus 7.

mount:

#!/system/bin/sh

# Starting ADB...
PORT=`getprop service.adb.tcp.port`
setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb connect localhost

# Make sure we only use the first device (sometimes there is more than one)
SERIAL=`adb devices | head -n2 | tail -n1 | cut -f1`
if [ "$SERIAL" = "" ] ; then
echo "ERROR: Could not find ADB device.";
fi

adb -s $SERIAL shell su -c "/system/bin/toolbox mount $@"

# If you started adb, then stop it here for security:
adb disconnect localhost
stop adbd
setprop service.adb.tcp.port $PORT
start adbd

umount:

#!/system/bin/sh

# Starting ADB...
PORT=`getprop service.adb.tcp.port`
setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb connect localhost

# Make sure we only use the first device (sometimes there is more than one)
SERIAL=`adb devices | head -n2 | tail -n1 | cut -f1`
if [ "$SERIAL" = "" ] ; then
echo "ERROR: Could not find ADB device.";
fi

adb -s $SERIAL shell su -c "/system/bin/toolbox umount $@"

# If you started adb, then stop it here for security:
adb disconnect localhost
stop adbd
setprop service.adb.tcp.port $PORT
start adbd
[Nexus 7 General] jsk23:
Is there an easy way for us to get the above working on our N7? You mention changing the unmount/mount links, but they are currently pretty big random text files that I don't fully understand.
[Nexus 7 General] jmtw000:
If there is I haven't heard of it. But please let me know if you find one. I think replacing the mount/umount links with scripts is probably the easiest way right now. Basically, all those scripts do is use adb to run the mount/umount command with whatever arguments you originally passed to them. The mount/umount needs to be done by adb (or any other process started outside the dalvik vm ) for reasons explained above in the thread. The app developers will probably come up with an easier fix at some some point though I'd imagine.
[Nexus 7 General] ThurstonX:
I could be wrong, but I think jsk23 was asking for a detailed guide on how to implement your solution.
[Nexus 7 General] jsk23:
Correct. Id like to get it working, even if just a temporary fix.
[Nexus 7 General] darkuni:
I tried also on my Nexus 10. Mount Manager APPEARS to mount - but just like all the other attempts to access the share - it is simply empty.

I'm dying to get this working again. Any thoughts?

I verified the network location with a SMB connection in X-Plore and it works. Something still isn't jivin' with CIFS :(

---------- Post added at 08:26 PM ---------- Previous post was at 08:05 PM ----------

Wait - do the original MOUNT and UMOUNT need to get moved to the folder /system/bin/toolkit for these scripts to work?
[Nexus 7 General] Hotabych:
any news?

or still only 4.1 ?