Reputation: 761
I'm following this guide to add a system call to the Linux kernel as an assignment. The system call is pretty simple; its job is multiplying a given number by 10.
The guide uses Linux kernel 5.8.1 but I have to add the system call to the version 6.3.1. Everything looks fine except for section 2.6 where it says modify the main Makefile and add your systemcall path to it on line 1073.
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
But this line doesn't exist in the current Makefile. Instead when I search for core-y
I see the following in line 741:
core-y :=
And when I add the path of my system call to the above line the kernel compiles but fails to install.
I tried looking it up in the linux docs but its too technical and I'm not able to figure it out. As far as I searched there are no guides on adding a system call to the current version of the kernel that explain the process in simple terms.
How should I modify the Makefile to link my syscall to the kernel? and are there any additional steps that I need to take?
Edit:
The error I get whilst running sudo make install
is the following even though I ran sudo make
and sudo make modules_install
prior to it and they ran fine.
amir@99312201:~/linux-6.3.2$ sudo make install
INSTALL /boot
*** Missing file: arch/x86/boot/bzImage
*** You need to run "make" before "make install".
make: *** [arch/x86/Makefile:292: install] Error 1
Upvotes: 1
Views: 1994
Reputation: 66061
Looks like specification of top-level directories in Linux kernel 6.x has been moved from Makefile
to the end of Kbuild
file:
<...>
# Ordinary directory descending
# ---------------------------------------------------------------------------
obj-y += init/
obj-y += usr/
obj-y += arch/$(SRCARCH)/
obj-y += $(ARCH_CORE)
obj-y += kernel/
obj-y += certs/
obj-y += mm/
obj-y += fs/
obj-y += ipc/
<...>
So you need just to add a new line with your directory specification:
obj-y += mydir/
Upvotes: 4