问题描述
我是FreeBSD的新手.我在VMware上安装了FreeBSD-11.0-RELEASE-amd64.我要添加第一个新的系统调用.我找到了这个链接.
I am a newbie in FreeBSD. I installed FreeBSD-11.0-RELEASE-amd64 on VMware. I want to add first new system call. I find this link.
我做了:
ee mykern.c
ee mykern.c
#include <sys/sysproto.h>
#include <sys/proc.h>
#include <sys/types.h>
#include <sys/systm.h>
#ifndef _SYS_SYSPROTO_H_
struct myargs {
int k;
};
#endif
int func(struct thread *p, struct myargs *uap)
{
printf("Hello");
return (0);
}
我将我的系统调用添加到了/kern/syscalls.master的末尾
I added my system call to the end /kern/syscalls.master
550 AUE_NULL STD { int func(int k);}
然后我做了
sudo make -C/sys/kern/sysent
sudo make -C /sys/kern/ sysent
接下来,我将文件添加到/sys/conf/files
Next, I added the file to /sys/conf/files
kern/mykern.c standard
我还将系统调用添加到/kern/capabilities.conf
Also, I added the system call to /kern/capabilities.conf
##
## Allow associating SHA1 key with user
##
func
最后,在/usr/src/中,我运行了命令
Finally, while in /usr/src/ I ran the command
在这一步中,我得到:
make don't know how to make kernel. Stop
make stopped in /usr/src
推荐答案
检查/usr/src
中是否同时存在Makefile
和Makefile.inc1
.后者实际上是定义buildkernel
目标的位置.验证该文件中确实存在目标.
Check that both Makefile
and Makefile.inc1
exist in /usr/src
. The latter is actually where the buildkernel
target is defined. Verify that that target actually exists in that file.
这篇关于FreeBSD-11.0-RELEASE-amd64中的一个简单的新系统调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!