Get the App
SLTechnology News&Howtos  ›  Development  › 

How to call the Android/Linux system

Shulou Source: shulou.com Published: 2022-06-01 00:36:25 09月21日 Update

This article mainly introduces the relevant knowledge of how to call the Android/Linux system, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to call the Android/Linux system. Let's take a look at it.

When debugging Android device drivers, the application layer is always bound by various permissions. Here is one of the solutions.

One kernel layer modification

Drivers/input/fingerprint/zpx_fp_mtk_tee/zpx_fp_mtk_tee.c

# include static long zpx_method (long arg) {printk ("% s enter,arg=%ld\ n", _ _ func__, arg); read_all_reg_test (fp_global); return 0 } SYSCALL_DEFINE1 (zpx_method,long,arg) / / A formal parameter {return zpx_method (arg);}

Include/linux/syscalls.h

Asmlinkage long sys_zpx_method (long arg)

Include/uapi/asm-generic/unistd.h

_ _ SYSCALL (_ _ NR_zpx_method, sys_zpx_method)

Arch/arm/include/uapi/asm/unistd.h

# define _ _ NR_zpx_method (_ _ NR_SYSCALL_BASE+391)

Arch/arm/kernel/calls.S

CALL (sys_zpx_method) .rept syscalls_padding / / comments such as the empty function / * CALL (sys_ni_syscall) * / / * null func*/

Arch/arm/include/asm/unistd.h

# define _ NR_syscalls / / last call + 1

Application layer invocation

# include # define _ SYSCALL_zpx_ 391int main (int argc,char * * argv) {syscall (_ SYSCALL_zpx_,13); return 0;}

Three results

No permission is required

K39_bsp:/data/local/tmp $ls-ltotal 80-rwxrwxrwx 1 shell shell 78968 2020-07-20 09:28 driver_testk39_bsp:/data/local/tmp $. / driver_testk39_bsp:/data/local/tmp $

Kernel log

[100.325202] (2) [2506:driver_test] zpx_method enter Arg=13 [100.325234] (2) [2506:driver_test] [zpx] zpx_spi_clk_enable enter [100.325249] (2) [2506:driver_test] [zpx] zpx_spi_clk_enable finsish [100.325469] (2) [2506:driver_test] [zpx] [0] = FF [100.325483] (2) [2506:driver_test] [zpx] [1] = 0 [100.325490] (2) [2506: Driver_test] [zpx] [2] = 0 [100.325497] (2) [2506:driver_test] [zpx] [3] = 3F [100.325503] (2) [2506:driver_test] [zpx] [4] = 0 [100.325510] (2) [2506:driver_test] [zpx] [5] = 57 this is the end of the article on "how to call the Android/Linux system" Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to call the Android/Linux system". If you want to learn more, you are welcome to follow the industry information channel.

Tags: System knowledge content application layer permissions articles applications values functions simple operation articles solutions easy to understand more comments see results industry solutions equipment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Redmi Apple Huawei NVidia