How to access Linux kernel layer from System Apps in Android for imx8m mini

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to access Linux kernel layer from System Apps in Android for imx8m mini

跳至解决方案
3,957 次查看
Ruban1
Contributor II

How to access Linux kernel layer from System Apps in Android for imx8m mini.

0 项奖励
回复
1 解答
3,943 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello Ruban1,

Actually, words you used here have meaning which differs from your requirement. What I think you need to implement set of libraries.

For that you first need to understand the working of Linux OS, and then how android utilize it for its purpose.

Here i'll try to make some brief description for your requirement.

Linux Kernel have two layers - User space and kernel space, user space is responsible for interaction with users and kernel is responsible for interacting with hardware. And how both interact with each other is by procedure called System Call.

Core concept is also same here. Top three layers as shown are the part of user space. Bottom layer is kernel layer.

 

See attached

 

here also mode of communication between user space and kernel space is system call. But usually only layers of library plays the role to make communication between the above layers and the kernel.

You also have to do the same, you can add a new library, in which using system calls interface you can talk to kernel.

Also In order to access the methods of the shared library from java code, you need to bring in JNI wrappers around the methods exposed from your shared lib.

That's all, as per your requirement you can also develop your library.

Then you need to push that file into /system/lib using adb push command. Their can be a case push may not work, then try to mount /system

adb shell mount -o remount,rw /system //and then again try to push
adb push mylibrary.so /system/lib/mylibrary.so
adb shell chmod 644 /system/lib/mylibrary.so // set the permission

If sometime, you still can't able to push that file, try to root that device.

After you'll reboot the device that library will work.

 

Regards

 

在原帖中查看解决方案

0 项奖励
回复
2 回复数
3,944 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello Ruban1,

Actually, words you used here have meaning which differs from your requirement. What I think you need to implement set of libraries.

For that you first need to understand the working of Linux OS, and then how android utilize it for its purpose.

Here i'll try to make some brief description for your requirement.

Linux Kernel have two layers - User space and kernel space, user space is responsible for interaction with users and kernel is responsible for interacting with hardware. And how both interact with each other is by procedure called System Call.

Core concept is also same here. Top three layers as shown are the part of user space. Bottom layer is kernel layer.

 

See attached

 

here also mode of communication between user space and kernel space is system call. But usually only layers of library plays the role to make communication between the above layers and the kernel.

You also have to do the same, you can add a new library, in which using system calls interface you can talk to kernel.

Also In order to access the methods of the shared library from java code, you need to bring in JNI wrappers around the methods exposed from your shared lib.

That's all, as per your requirement you can also develop your library.

Then you need to push that file into /system/lib using adb push command. Their can be a case push may not work, then try to mount /system

adb shell mount -o remount,rw /system //and then again try to push
adb push mylibrary.so /system/lib/mylibrary.so
adb shell chmod 644 /system/lib/mylibrary.so // set the permission

If sometime, you still can't able to push that file, try to root that device.

After you'll reboot the device that library will work.

 

Regards

 

0 项奖励
回复
3,938 次查看
Ruban1
Contributor II

i have used .sh file for shell script.All the system calls i have used in .sh file. You want me write script and push through ADB . May i know in which path i have to push the script to RUN.

Can you brief me more on JNI wrappers and share related documents.

May i know what all set of libraries is needed to be implement .

I use 'su' command for root user . or its there any other method to root the device. if so provide me related documents.

Thanks in Advance

Regards

Ruban

 

0 项奖励
回复