Related
When I run the android emulator, using the Android 2.2 - API Level 8, by issuing from cmd emulator -avd test (test being the emulator name) I am not given root access. If I open terminal emulator and issue the SU command i recieve permission denied.
I thought the emulator was meant to run in root access?
I wish someone else would shed some light on this as well. I feel like I have been able to gain access to root, using the su command, but I cant remember as it has been a few months since using the emulator.
I also help someone else will look into this...
Sent from my DROIDX using XDA App
ANy update on this topic?
Hey guys, could anyone fill me in on how to get root in the emulator?
Does anyone knows the answer for this?
I tried chaining the commands, but still not working
Code:
try {
Runtime rt = Runtime.getRuntime();
String[] cmd = { "su", "-c", "ls -l /data/data/"};
Process pcs = rt.exec(cmd); //("ls -l /data/data/");
BufferedReader br = new BufferedReader(new InputStreamReader(pcs
.getInputStream()));
String line = null;
while ((line = br.readLine()) != null) {
Log.e("line","line="+line);
}
br.close();
pcs.waitFor();
int ret = pcs.exitValue();
Log.e("ret","ret="+ret);
} catch (Exception e) {
Log.e("Exception", "Exception", e);
}
Hi, i am trying to run adb and su commands in onclicklistener of my button of android app and here is my code
Code:
btnCheckSu.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Process p; String[] st = new String[3];
try {
st[0]="/system/bin/su";
st[1]="-c";
st[2]="reboot";
p = Runtime.getRuntime().exec(st);
Toast.makeText(SUCheck.this, "Rebooting...", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
I do get the prompt for su but then phone does not reboot...any help please
thanks
Well im not sure about the su commands but the reboot intent is restricted to processes signed with the same key as the platform you are using (essentially the key used to sign the rom you are using)
It could be the same with using su to reboot. Not sure though
--------
I tried it on the terminal emulator and it worked after entering the command twice for some reason
From something awesome
Try your commands via adb root shell first. If they work then u know the condemns are good and can try something else. All so without capturing process output there it's no way to know what's going on.
Sent from my MB860 using Tapatalk
Why not use the standard android api?
Code:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
pm.reboot("");
You'll need the REBOOT permission though.
HomerSp said:
Why not use the standard android api?
Code:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
pm.reboot("");
You'll need the REBOOT permission though.
Click to expand...
Click to collapse
Because as i said before the reboot permission is only valid on system apps signed with the platform key
From something awesome
killersnowman said:
Because as i said before the reboot permission is only valid on system apps signed with the platform key
From something awesome
Click to expand...
Click to collapse
You're right, sorry.
Try this instead, it worked fine for me.
Code:
Runtime.getRuntime().exec("su -c /system/bin/reboot");
i guys
thanks for the above replies...
but none of the above suggestion has worked for me...any other clues please
thanks
.../me repeats himself...
CAPTURE UR OUTPUT, without it we cant know what is going wrong.
Try your commands via adb shell first, if they work there they will also work via your phone.
yup, great.... adb working through my pc shell
capturing output...i have to work that out how...cheers
hisheeraz said:
yup, great.... adb working through my pc shell
capturing output...i have to work that out how...cheers
Click to expand...
Click to collapse
from your process create datastreams for your process.getInputStream() and process.getErrorStream(). After execution dump streams to file/logcat/w/e.
hisheeraz said:
yup, great.... adb working through my pc shell
capturing output...i have to work that out how...cheers
Click to expand...
Click to collapse
Try this:
Code:
btnCheckSu.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Process p; String[] st = new String[3];
try {
st[0]="/system/bin/su";
st[1]="-c";
st[2]="reboot";
p = Runtime.getRuntime().exec(st);
[COLOR="Red"] String s;
DataInputStream is=new DataInputStream(p.getInputStream());
DataInputStream er=new DataInputStream(p.getErrorStream());
Log.i("MyApp","stdout:\n");
while((s=is.readLine())!=null){
Log.i("MyApp",s+"\n");
}
Log.i("MyApp","stderr:\n");
while((s=er.readLine())!=null){
Log.i("MyApp",s+"\n");
}
[/COLOR]
Toast.makeText(SUCheck.this, "Rebooting...", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
sorry for being such a pain but my Log.i is empty there is absolutely nothing there
even after reinstalling the app in my phone nothing is in Log.i
help please...
EDIT:1
HERE IS THE LOG.I
sdtout:
stderr:
not permitted!
also i am using REBOOT permission in my manifest...i donot think i need it but just in case
hisheeraz said:
sorry for being such a pain but my Log.i is empty there is absolutely nothing there
even after reinstalling the app in my phone nothing is in Log.i
help please...
EDIT:1
HERE IS THE LOG.I
sdtout:
stderr:
not permitted!
Click to expand...
Click to collapse
bla,
try without -c. then also try...
reboot
reboot -f
busybox reboot
busybox reboot -f
hey thanks
/system/bin/su
-c
busybox reboot -f
is working...but
busybox reboot recovery -f
of
busybox reboot recovery
is not working. thanks for your effort and help,
i will dig into this tomorrow and will post you my feed back, it is really late here in AU :O
regards
Hello I am desperately trying to run a shell script from my java app.
I tried to use http://developer.android.com/reference/java/lang/Runtime.html#exec%28java.lang.String%29 Runtime Exec to run it and it works except nothing really happens and the script is not executed.
My command was "/system/bin/sh /data/local/test.sh", of course properly chmodded. I tried running the test.sh directly, even tried opening a SH instance and pushing commands to the console via output buffer - nothing works.
When I try to run SU for example using any of these methods, I get prompted for superuser access, so it does work, just doesn't work like I want.
Anybody has any idea what's wrong? Or alternative way to run a script post-boot? (init.d executes too early in the startup process for my needs)
Are you capturing the error stream, or just the output stream?
This is everything I tried:
Code:
String[] str = { "/system/bin/sh", "/data/local/test.sh" };
Process p = Runtime.getRuntime().exec(str);
p.waitFor();
Code:
Process p2 = Runtime.getRuntime().exec("/system/bin/sh /data/local/test.sh");
p2.waitFor();
Code:
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("/system/bin/sh");
OutputStream os = p.getOutputStream();
String str = "/data/local/test.sh";
byte[] cmds = str.getBytes();
os.write(cmds);
os.flush();
os.close();
calling just "/system/bin/sh" or "su" works - it actually waits indefinitely in each approach but once I try to execute a script it won't budge. I also attempted to run other parametrized commands like "setprop persist.sys.use_dithering 0" and it also failed. I'll try to intercept the error stream, good point.
nik3r said:
This is everything I tried:
Code:
String[] str = { "/system/bin/sh", "/data/local/test.sh" };
Process p = Runtime.getRuntime().exec(str);
p.waitFor();
Click to expand...
Click to collapse
You need the "-c" option to execute a script:
Sorry I missed that in your first post.
Code:
String[] str = { "/system/bin/sh", [COLOR="Red"]"-c",[/COLOR] "/data/local/test.sh" };
Process p = Runtime.getRuntime().exec(str);
p.waitFor();
nope, this is what I have
Code:
String[] str = { "/system/bin/sh", "-c", "/data/local/test.sh" };
Process p = Runtime.getRuntime().exec(str);
p.waitFor();
still no effect, the /data/local/test.sh is 0777 and only contains
Code:
echo "success" > /data/local/testresult.txt
The same command works from ADB even without the -c switch but with the exec command nothing happens.
finally progress
Update: according to the error output the file gets executed BUT it doesn't have permission to write in /data/local/ same problem if I try to write to this dir with java API.
My script needs to write there so I have only one question - is there a permission that would allow me to execute a script with access right to /data partition without root?
I want to modify the userdata partition after first boot of the ROM but I can't ask the user for root, I want to execute my tweaks and reboot the device before even the android login wizard appears so asking for root that has a prompt with timeout is not an option.
I know of an alternative way to do it but it's even more hacky than this and I would like to avoid someone vomiting over my code
Does it need to be /data/local? /data/local/tmp is world-writable on most devices.
In the end it needs to be /data/data/ actually, I want to mess with default settings of apps, system settings database for example... does that mean I need root or game over? Is there no permission for app to get access to the userdata partition?
As far as I know, the Dalvik system was set up that way on purpose to prevent errant apps from causing any problems elsewhere, and to maintain decent security (look how out of control Windows has become), so to answer your question, Yes, I believe you will need root.
nik3r said:
In the end it needs to be /data/data/ actually, I want to mess with default settings of apps, system settings database for example... does that mean I need root or game over? Is there no permission for app to get access to the userdata partition?
Click to expand...
Click to collapse
No, you can't write to /data/data without root (as that would be a major security risk).
Ok thanks guys I will try my dirty workaround
Hi,
what is the command to reboot in recovery bootloader ecc?
I will insert in my app through this library
rampo said:
Hi,
what is the command to reboot in recovery bootloader ecc?
I will insert in my app through this library
Click to expand...
Click to collapse
The command for rebooting is
Code:
reboot
Use that to reboot into recovery:
Code:
reboot recovery
For bootloader you need to use adb:
Code:
adb reboot-bootloader
Runtime.getRuntime().exec(new String[]{"su","-c","reboot bootloader"});
Sent from my HTC One using xda premium
Not permitted
Not permitted!
Click to expand...
Click to collapse
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
pinpong said:
Runtime.getRuntime().exec(new String[]{"su","-c","reboot bootloader"});
Sent from my HTC One using xda premium
Click to expand...
Click to collapse
He wants to use RootTools.
For that use:
Code:
Command command = new Command(0, "reboot bootloader") {
[user=439709]@override[/user]
public void output(int id, String line) {
//TODO: Do something with the output here
}
};
RootTools.getShell(true).add(command).waitForFinish();
EDIT: @override: The first letter needs to be upper case (Doesn't let me as it thinks of it as a mentioning function.)
---------- Post added at 10:02 PM ---------- Previous post was at 10:00 PM ----------
rampo said:
Click to expand...
Click to collapse
First you need to be a root user.
Type "su" as the first command.
If you use RootTools you can execute commands as root without having to type "su" the way I gave you above.
Second adb commands must be launched from your computer.
nikwen said:
He wants to use RootTools.
For that use:
Code:
Command command = new Command(0, "reboot bootloader") {
[user=439709]@override[/user]
public void output(int id, String line) {
//TODO: Do something with the output here
}
};
RootTools.getShell(true).add(command).waitForFinish();
Click to expand...
Click to collapse
Same logcat : "Not permited!"
First you need to be a root user.
Click to expand...
Click to collapse
Don't warry man
Type "su" as the first command.
Click to expand...
Click to collapse
Already done.
If you use RootTools you can execute commands as root without having to type "su" the way I gave you above.
Click to expand...
Click to collapse
Ok, thanks.
Second adb commands must be launched from your computer.
Click to expand...
Click to collapse
Yes, i know, but i've tried
pinpong said:
Runtime.getRuntime().exec(new String[]{"su","-c","reboot bootloader"});
Sent from my HTC One using xda premium
Click to expand...
Click to collapse
Same "Not permited!"
rampo said:
Same logcat : "Not permited!"
Don't warry man
Already done.
Click to expand...
Click to collapse
In the screenshot you did not.
Ok, thanks.
Yes, i know, but i've tried
Click to expand...
Click to collapse
If I type "su", then press enter and then "reboot recovery", everything works fine.
Look at this for rebooting into bootloader: http://www.androidcentral.com/android-201-10-basic-terminal-commands-you-should-know
EDIT: You can see whether you typed "su" by looking at the last character of one line. If it is a # instead of a $, you typed "su".
EDIT: You can see whether you typed "su" by looking at the last character of one line. If it is a # instead of a $, you typed "su".
Click to expand...
Click to collapse
There is a "#"
If I type "su", then press enter and then "reboot recovery", everything works fine.
Click to expand...
Click to collapse
.
Not for me, i said this in my second post
HTC One, stock rooted ROM
rampo said:
There is a "#"
.
Not for me, i said this in my second post
HTC One, stock rooted ROM
Click to expand...
Click to collapse
Then it is because of the implementation of the reboot command of your ROM. On my Samsung Galaxy Ace with AOKP it is working fine.
Maybe you could compile your own busybox and include the reboot command. Then copy it into the data directory of your app and run the commands by typing their full path like this:
Code:
/data/data/com.example.app/files/busybox reboot recovery
Maybe you could compile your own busybox and include the reboot command. Then copy it into the data directory of your app and run the commands by typing their full path like this:
Click to expand...
Click to collapse
Mmm, if i add this myself-compiled busybox version to my app, this will work with all devices?
Because as you can read in the first post, the command should be written in the app I'm working on.
Or there is a universal another command or another way to do it?
rampo said:
Mmm, if i add this myself-compiled busybox version to my app, this will work with all devices?
Because as you can read in the first post, the command should be written in the app I'm working on.
Or there is a universal another command or another way to do it?
Click to expand...
Click to collapse
I really thought that you could use the "reboot recovery" on every device.
However, this is one of the best examples for different implementations on different devices. For example on some phones the "ls" command is linked to "ls -l" (Source). That is why busybox is always the better way. It is working the same on all devices and ROMs.
You need to compile it yourself because the one which is installed by this app does not include the reboot command.
I think that there is no other way as the "universal" did not work on your device. Maybe anotherone has a better idea, but I do not think so.
I really thought that you could use the "reboot recovery" on every device.
However, this is one of the best examples for different implementations on different devices. For example on some phones the "ls" command is linked to "ls -l" (Source). That is why busybox is always the better way. It is working the same on all devices and ROMs.
Click to expand...
Click to collapse
Thanks man, I've tried
Code:
su
reboot recovery
and
Code:
su
reboot bootloader
in my Galaxy Nexus, it works.
I will develop and test the app on Nexus, pure Google software
You could grab the reboot binary (I attached mine from the nexus 7), put it in /system/xbin then do this in terminal :
Code:
su
chmod 775 /system/xbin/reboot
After which, reboot/reboot-recovery/reboot-bootloader should work.
If this works, you can include the binary in the assets folder of your app, then copy it to /system/xbin and chmod it in your code.
Code:
File sdCard = Environment.getExternalStorageDirectory().toString();
File update = new File( sdCard + "reboot");
if (update.exists()) {
System.out.println("reboot binary already exists on sdcard");
} else {
try {
update.createNewFile();
System.out.println("File created successfully");
InputStream is = getAssets().open("reboot");
FileOutputStream fos = new FileOutputStream(update);
byte[] buffer = new byte[1024];
int length = 0;
while ((length = is.read(buffer)) > 0) {
fos.write(buffer, 0, length);
}
System.out.println("reboot binary successfully moved to sdcard");
// Close the streams
fos.flush();
fos.close();
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Process process = null;
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(
process.getOutputStream());
os.writeBytes("busybox mount -o remount,rw /system"+"\n");
os.writeBytes("cp -f " + sdCard + "/reboot /system/xbin/reboot" + "\n");
os.writeBytes("chmod 775 /system/xbin/reboot" + "\n");
os.writeBytes("rm -f " + sdCard + "/reboot " + "\n");
os.writeBytes("busybox mount -o remount,ro /system"+"\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
private void rebootToRecovery() {
Process process = null;
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(
process.getOutputStream());
os.writeBytes("reboot recovery"+"\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
}
Damn, we really need syntax highlighting and indentation in the code forum tags...
Androguide.fr said:
You could grab the reboot binary (I attached mine from the nexus 7), put it in /system/xbin then do this in terminal :
Code:
su
chmod 775 /system/xbin/reboot
After which, reboot/reboot-recovery/reboot-bootloader should work.
If this works, you can include the binary in the assets folder of your app, then copy it to /system/xbin and chmod it in your code.
Code:
File sdCard = Environment.getExternalStorageDirectory();
sdCard.toString();
File update = new File( sdCard + "reboot");
if (update.exists()) {
System.out.println("reboot binary already exists on sdcard");
} else {
try {
update.createNewFile();
System.out.println("File created successfully");
InputStream is = getAssets().open("xbin");
FileOutputStream fos = new FileOutputStream(update);
byte[] buffer = new byte[1024];
int length = 0;
while ((length = is.read(buffer)) > 0) {
fos.write(buffer, 0, length);
}
System.out.println("reboot binary successfully moved to sdcard");
// Close the streams
fos.flush();
fos.close();
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Process process = null;
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(
process.getOutputStream());
os.writeBytes("busybox mount -o remount,rw /system"+"\n");
os.writeBytes("cp -f " + sdCard + "/reboot /system/xbin/reboot" + "\n");
os.writeBytes("chmod 775 /system/xbin/reboot");
os.writeBytes("busybox mount -o remount,ro /system"+"\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
private void rebootToRecovery() {
Process process = null;
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(
process.getOutputStream());
os.writeBytes("reboot recovery"+"\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
}
Damn, we really need syntax highlighting and indentation in the code forum tags...
Click to expand...
Click to collapse
Genial
And there is a command for SafeMode reboot?
rampo said:
Genial
And there is a command for SafeMode reboot?
Click to expand...
Click to collapse
What do you mean by SafeMode ?
Androguide.fr said:
You could grab the reboot binary (I attached mine from the nexus 7), put it in /system/xbin then do this in terminal :
Code:
su
chmod 775 /system/xbin/reboot
After which, reboot/reboot-recovery/reboot-bootloader should work.
If this works, you can include the binary in the assets folder of your app, then copy it to /system/xbin and chmod it in your code.
Code:
File sdCard = Environment.getExternalStorageDirectory();
sdCard.toString();
File update = new File( sdCard + "reboot");
if (update.exists()) {
System.out.println("reboot binary already exists on sdcard");
} else {
try {
update.createNewFile();
System.out.println("File created successfully");
InputStream is = getAssets().open("xbin");
FileOutputStream fos = new FileOutputStream(update);
byte[] buffer = new byte[1024];
int length = 0;
while ((length = is.read(buffer)) > 0) {
fos.write(buffer, 0, length);
}
System.out.println("reboot binary successfully moved to sdcard");
// Close the streams
fos.flush();
fos.close();
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Process process = null;
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(
process.getOutputStream());
os.writeBytes("busybox mount -o remount,rw /system"+"\n");
os.writeBytes("cp -f " + sdCard + "/reboot /system/xbin/reboot" + "\n");
os.writeBytes("chmod 775 /system/xbin/reboot" + "\n");
os.writeBytes("rm -f " + sdCard + "/reboot " + "\n");
os.writeBytes("busybox mount -o remount,ro /system"+"\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
private void rebootToRecovery() {
Process process = null;
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(
process.getOutputStream());
os.writeBytes("reboot recovery"+"\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
}
Damn, we really need syntax highlighting and indentation in the code forum tags...
Click to expand...
Click to collapse
Really great idea. :good: Respect!
Just one thing I would do another way: I would copy the reboot binary to the data folder of the app so that the system is not modyfied.
If the default reboot binary has some additional functions which the system needs, there could go something wrong.
rampo said:
Click to expand...
Click to collapse
Simply type
Code:
su
reboot
PhAkEer said:
Simply type
Code:
su
reboot
Click to expand...
Click to collapse
nikwen said:
Really great idea. :good: Respect!
Just one thing I would do another way: I would copy the reboot binary to the data folder of the app so that the system is not modyfied.
If the default reboot binary has some additional functions which the system needs, there could go something wrong.
Click to expand...
Click to collapse
Yeah you're definitely right, would be better practice :good:
PhAkEer said:
Simply type
Code:
su
reboot
Click to expand...
Click to collapse
Dude, just read the thread...
How to install this:
1. put copymodulecrc to the /data/local/tmp folder and chmod them to 755
(adb shell chmod 755 /data/local/tmp/copymodulecrc)
2. put ntfs-3g and ntfsmount to the folder /system/bin and chmod them to 755
(adb shell chmod 755 /system/bin/ntfs-3g)
(adb shell chmod 755 /system/bin/ntfsmount)
3. put sdcardfs.ko to the folder /system/lib/modules and chmod them to 644
(adb shell chmod 644 /system/lib/modules/sdcardfs.ko)
What is next? Next:
1. in order to get it working, sdcardfs.ko must be patched to match your kernel version since every kernel modules is paired with kernel by version string, so if version string not match module version it will not work! So you must patch sdcardfs.ko module using tool called copymodulecrc! Copymodulecrc will extract version string from any module of the your stockrom kernel modules and copy them directly to the sdcardfs.ko (patch them). First of all you need to look into your /system/lib/modules folder and use any .ko file NAME for referencie in next commands:
Code:
adb shell /data/local/tmp/copymodulecrc /system/lib/modules/PUT_NAME_OF_THE_KO_YOU_FOUND_IN_STOCK_ROM_KERNEL_MODULES /system/lib/modules/sdcardfs.ko
So replace PUT_NAME_OF_THE_KO_YOU_FOUND_IN_STOCK_ROM_KERNEL_MODULES with the name of the any module you found in modules folder! Done.
2. if you completed step 1 without errors you are ready for this step. You need to locate script called install-recovery.sh (on most devices it is in folder /system/etc) and add next lines:
Code:
insmod /system/lib/modules/sdcardfs.ko
Done. On every next reboot sdcardfs kernel module will be automatically included in your kernel.
3. if you get error in patching sdcardfs.ko whole thing will not work! So these step is important! You can verify success by command: (su -c "insmod /system/lib/modules/sdcardfs.ko") , if you see error than sdcardfs is not working, if you see nothing than it is working
Since you completed these 3 things, you are ready to use NTFS volumes on your device! To understand these things:
1. first of all, you can not mount ntfs volume regulary trought settings menu since android not support ntfs by default! You must mount/umount your ntfs volume manually (you can use for example android terminal emulator when you need to mount/umount ntfs). You will not see any details about ntfs volume in settings menu since android not support ntfs by default, you can see details in most file managers only.
How to mount and unmount:
1. to mount (first connect your usb ntfs volume to your device usb port) :
Code:
su -c "ntfsmount mount"
Done! Your ntfs volume by these command is mounted and you are ready to read/write them using your faworite file manager
2. To umount (do in mind - every time before you going to remove ntfs volume from your device you must unmount it!):
Code:
su -c "ntfsmount umount"
Done! You are ready to remove ntfs volume from your usb port.
NTFS on sdcard? Yes but you need to modify a bit ntfsnount script! Don't ask me how ypu can modify them, do it byself!
Since somebody complain here about gpl licence, I am not ready ready to share sdcardfs source code with you since it is not gpl licenced, instead it is apache 2.0 licenced by Samsung guys @ 2013 and I no need to share it with you since you wanted to see them forced! I not like when somebody forcing me for something! Find it, patch them, make module of them byself
ntfs-3g is not compiled by me, it is used from here -> http://forum.xda-developers.com/showthread.php?t=1724078
ntfsmount script is created by me.
Copymodulecrc I do not know where I found them but here is source code:
Code:
/* copymodulecrc */
/*
* Copyright (C) 2014 CUBE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
int main(int argc, char **argv) {
struct stat st;
off_t filesize;
int fd;
char *data, *pos;
unsigned int i;
int bFound;
unsigned long crcval;
if (argc != 3) {
printf("usage: copymodulecrc [modulename(src)] [modulename(dst)]\n");
return -1;
}
if (stat(argv[1], &st) != 0) {
fprintf(stderr, "module1 stat failed.\n");
return -1;
}
filesize = st.st_size;
fd = open(argv[1], O_RDONLY);
if (fd < 0) {
fprintf(stderr, "module1 open failed.\n");
return -1;
}
data = mmap(NULL, filesize, PROT_READ, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "module1 mmap failed.\n");
close(fd);
return -1;
}
pos = data;
bFound = 0;
for (i = 0; i < (filesize - 12); ++i) {
if (memcmp((void *)pos, (void *)"module_layout", 13) == 0) {
bFound = 1;
break;
}
pos++;
}
if (bFound == 0) {
fprintf(stderr, "module1 crc not found.\n");
munmap(data, filesize);
close(fd);
return -1;
}
pos -= 4;
memcpy((void *)&crcval, (void *)pos, 4);
munmap(data, filesize);
close(fd);
printf("module crc=%08x\n", (unsigned int)crcval);
if (stat(argv[2], &st) != 0) {
fprintf(stderr, "module2 stat failed.\n");
return -1;
}
filesize = st.st_size;
fd = open(argv[2], O_RDWR);
if (fd < 0) {
fprintf(stderr, "module2 open failed.\n");
return -1;
}
data = mmap(NULL, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "module2 mmap failed.\n");
close(fd);
return -1;
}
pos = data;
bFound = 0;
for (i = 0; i < (filesize - 12); ++i) {
if (memcmp((void *)pos, (void *)"module_layout", 13) == 0) {
bFound = 1;
break;
}
pos++;
}
if (bFound == 0) {
fprintf(stderr, "module2 crc not found.\n");
munmap(data, filesize);
close(fd);
return -1;
}
pos -= 4;
memcpy((void *)pos, (void *)&crcval, 4);
munmap(data, filesize);
close(fd);
printf("module crc copied.\n");
return 0;
}
And finaly, files you need to install is in attachment, enjoy!
Will try late-night. Just asking, will it work on Galaxy S3-GTi9300?
Just need some clarification, when you say NTFS support, do you mean read and write or just read-only?
munjeni said:
Not going to explain in details, here is my tool which will add ntfs support to your android, run them and folow instructions! If you unable to patch sdcardfs.ko kernel module (giving you error when you doing insmod) than the whole things will not work on your device Curntly tested device is Xperia Z1 Compact on android version 14.4.A.0.108! Important thing is having sdcardfs installable, the rest is easy.
In order to have sdcardfs module insmoded on every reboot, you need to add one line into /system/etc/install-recovery.sh :
The rest of the tutorial you can see under application. Enjoy if you find this usefull!
Click to expand...
Click to collapse
/system/etc/install-recovery.sh :-
- install-recovery.sh file is not available at /system/etc/.
- Is it possible to create the file and then we can insert the line?
Am using AOSP - Carbon ROM on Xperia Z..
Thank you!!
'A Munjeni Work' again!
Thanks a lot! :victory:
Looking forward for what all can I do with it.
Wow this will be amazing, cant wait to try...
anonyo said:
Just need some clarification, when you say NTFS support, do you mean read and write or just read-only?
Click to expand...
Click to collapse
+1
anonyo said:
Just need some clarification, when you say NTFS support, do you mean read and write or just read-only?
Click to expand...
Click to collapse
Quote!
Just a heads up..
On Xperia Z2 tablet with 4.4.2, connected to 1tb NTFS drive.
After modding the ko and setting all permissions, rebooting, will only "half-mount" the drive. It sees it, recognizes it, but claims drive is empty (wants to format it).
Status bar displays "Empty USB Storage"
In settings, when selecting Mount USB Storage, it briefly acts like it will mount. for a split second.
Any files I can get that can possibly help?
UPDATE: After running the mount commands via terminal, now it seems to mount it via ES File explorer. Although it sometimes still gives me the message in statusbar.
But seems to be working well.
Seeing as this patches a kernel module will it work on rooted phones with a locked bootloader?
Aborto said:
Seeing as this patches a kernel module will it work on rooted phones with a locked bootloader?
Click to expand...
Click to collapse
My Z2 Tablet has a locked bootloader. So yes, it should. There's nothing going on that warrants an unlocked bootloader. Just the addition of some files and permission changes, which are normal with a rooted device.
Also note, that in the Settings\Storage, it will not show up as being "mounted". At least not in my case. However, ES File Explorer has no issue with it, and shows as a USB 1052 drive under the "Local" menu. Navigation seems normal within the drive.
I get the "USB Drive Empty or Unsupported" message in the status bar, for a few seconds, but the ES FE displays the drive contents, and the message goes away after it reads drive contents. Note that it may assign a different drive identifier each time you use it.
In testing I have found apps from the market;
StickMount does not work at all on my Stock OS.
Paragon NTFS mount works, but it runs as a system process using memory and probably battery.
This mod seems to work, for the most part, as long as you use ES File Explorer.
OP - you must provide the source for any modified code covered by the GPL that you are distributing - that includes the sdcardfs kernel module, and the ntfs-3g binary. Packing them in an encrypted Windows executable does not help.
spoidar said:
OP - you must provide the source for any modified code covered by the GPL that you are distributing - that includes the sdcardfs kernel module, and the ntfs-3g binary. Packing them in an encrypted Windows executable does not help.
Click to expand...
Click to collapse
No he doesn't. Only the zimage (kernel) is covered under GPL.
UPDATE: Just to clarify, the matter "Has" been brought to the Developers Committee to address any possible GPL violations. The DC is more informed on GPL.
Moscow Desire said:
No he doesn't. Only the zimage (kernel) is covered under GPL.
Click to expand...
Click to collapse
What? No. The ntfs-3g project is licensed under the GPL. And so is the sdcardfs driver. You can't generate binaries from GPL code and distribute them without providing the source.
Need help here
After i Copy copymodulecrc and sdcardfs.ko to /data/local/tmp and gave the permission as rwx-r-r to copymodulecrc. how to run it? can anybody help me here to patch sdcardfs.ko
coolrevi said:
After i Copy copymodulecrc and sdcardfs.ko to /data/local/tmp and gave the permission as rwx-r-r to copymodulecrc. how to run it? can anybody help me here to patch sdcardfs.ko
Click to expand...
Click to collapse
First off, permissions must be set to 755 (rwx-rx-rx) if I'm not mistaken. Root Explorer converts it to the numerical format when you change permissions.
Next, use a terminal program (available from the play store) Make sure you run it as SU. (type SU + Enter, you will get the # sign) Then type in the commands and paths as indicated. (I copied and pasted my paths)
Moscow Desire said:
First off, permissions must be set to 755 (rwx-rx-rx) if I'm not mistaken. Root Explorer converts it to the numerical format when you change permissions.
Next, use a terminal program (available from the play store) Make sure you run it as SU. (type SU + Enter, you will get the # sign) Then type in the commands and paths as indicated. (I copied and pasted my paths)
Click to expand...
Click to collapse
I got it till replacing a line in install-recovery.sh but i am stuck there as there is no line called ntfs.ko to replace with
Thanks for posting this up, can't wait to get home and test this out.
I am recieving the error in the screenshot
The device that i am using is Lenovo A3500HV which contains a Jellybean 4.2.2 AOSP ROM (Hardly any modification)
Please Help
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}