Reputation: 539
I have successfully build Gingerbread 2.3.4 for beagleboard xM rev C. Now i want to check Linux kernel version name inside a script which runs after the init.rc. In linux we can find the same using the command uname -r. But it is not found in android kernel. can somebody help me with some sample script to do the same.
Upvotes: 8
Views: 11709
Reputation: 1135
This worked for me
public static String getKernelVersion() {
try {
Process p = Runtime.getRuntime().exec("uname -a");
InputStream is = null;
if (p.waitFor() == 0) {
is = p.getInputStream();
} else {
is = p.getErrorStream();
}
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = br.readLine();
Log.i("Kernel Version", line);
br.close();
return line;
} catch (Exception ex) {
return "ERROR: " + ex.getMessage();
}
}
Upvotes: 2
Reputation: 3135
Take a look at the AOSP DeviceInfoSettings: https://github.com/android/platform_packages_apps_settings/blob/master/src/com/android/settings/DeviceInfoSettings.java#L378
Upvotes: 0
Reputation: 798
You can get kernel version using
adb shell cat /proc/version
or with the help of
System.getProperty("os.version");
Upvotes: 2
Reputation: 68935
If your phone is rooted and BusyBox is installed then uname -r
should work.
Upvotes: 2
Reputation: 3539
There is a version file in the /proc directory. Try cat /proc/version
in a shell and it should display informations about your kernel.
Upvotes: 9