我正在尝试在Nexus 4的内核(mako)中实现一个简单的自定义系统调用。到目前为止,我已经采取了这五个步骤:
MSM /拱/臂/内核/ calls.S
...
/* 375 */ CALL(sys_setns)
CALL(sys_process_vm_readv)
CALL(sys_process_vm_writev)
CALL(sys_hello) /* a custom system call */
MSM /包括/ LINUX / syscalls.h
...
asmlinkage long sys_process_vm_writev(pid_t pid,
const struct iovec __user *lvec,
unsigned long liovcnt,
const struct iovec __user *rvec,
unsigned long riovcnt,
unsigned long flags);
asmlinkage long sys_hello(void);
MSM /拱/臂/包括/ ASM / unistd.h中
...
#define __NR_setns (__NR_SYSCALL_BASE+375)
#define __NR_process_vm_readv (__NR_SYSCALL_BASE+376)
#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377)
#define __NR_sys_hello (__NR_SYSCALL_BASE+378)
MSM /生成文件
...
# Objects we will link into vmlinux / subdirs we need to visit
...
core-y := usr/ hello/
msm / hello / sys_hello.c& MSM /你好/生成文件
#include <asm/unistd.d>
#include <linux/linkage.h>
asmlinkage long sys_hello(void) {
printk("Hello world\n");
return 0;
}
##### BEGIN MAKEFILE #####
obj-y := sys_hello.o
##### END MAKEFILE #####
我还使用this guide来设置构建内核。
当我执行make mako_defconfig
然后 make -j4
(这是来自指南)时,我收到了以下错误:
arm-eabi-gcc -Wp,-MD,scripts/mod/.empty.o.d -nostdinc -isystem arm-eabi-gcc -print-file-name=include [Errno 13] Permission denied -I/Users/Edward/CMSI/android-kernel/kernel/msm/arch/arm/include -Iarch/arm/include/generated -Iinclude -include /Users/Edward/CMSI/android-kernel/kernel/msm/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-msm/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -fstack-protector -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 -march=armv5t -Wa,-march=armv7-a -msoft-float -Uarm -fomit-frame-pointer -g -DKBUILD_STR(s)=#s -DKBUILD_BASENAME=KBUILD_STR(empty) -DKBUILD_MODNAME=KBUILD_STR(empty) -c -o scripts/mod/empty.o scripts/mod/empty.c [Errno 13] Permission denied
make[2]: *** [scripts/mod/empty.o] Error 13
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
我无法确定构建内核是否是我的错,如果我错过了一步,以便内核识别新的自定义系统调用,或者如果我修改了其中一个文件存在权限错误。< / p>
任何建议都会有所帮助,这是我第一次为Android设备构建内核。
编辑:现在收到此错误:
arm-eabi-gcc -Wp,-MD,kernel/.bounds.s.d -nostdinc -isystem arm-eabi-gcc -print-file-name=include [Errno 13] Permission denied -I/Users/Edward/CMSI/android-kernel/kernel/msm/arch/arm/include -Iarch/arm/include/generated -Iinclude -include /Users/Edward/CMSI/android-kernel/kernel/msm/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-msm/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -fstack-protector -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 -march=armv5t -Wa,-march=armv7-a -msoft-float -Uarm -fomit-frame-pointer -g -DKBUILD_STR(s)=#s -DKBUILD_BASENAME=KBUILD_STR(bounds) -DKBUILD_MODNAME=KBUILD_STR(bounds) -fverbose-asm -S -o kernel/bounds.s kernel/bounds.c [Errno 13] Permission denied
make[1]: *** [kernel/bounds.s] Error 13
make: *** [prepare0] Error 2