Compile the kernel (linux-2.6.36) + Add the system call in Fedora13 first note: My system is 2.6.33 kernel, I compiled 2.6.36 version of the first step: Download the kernel source code. I downloaded linux-2.6.36. Decompress the package to/usr/src. Step 2: Modify three files. Because it is the latest version 2.6.36, many file names are slightly different. 1. In arch/x86/kernel/syscall_table_32.S
Compile the kernel (linux-2.6.36) + Add system calls in Fedora 13
First note: the kernel of my system is 2.6.33, And I have compiled 2.6.36.
Step 1: Download the kernel source code. I downloaded linux-2.6.36. Decompress the package to/usr/src.
Step 2: Modify three files. Because it is the latest version 2.6.36, many file names are slightly different.
1. In arch/x86/kernel/syscall_table_32.S, add:. long sys_mysyscall (you can also modify it in syscall_table_64.S.
But it cannot be changed in entry. S in version 2.6.27)
2. Add: # define _ NR_mysyscall 341 to arch/x86/include/asm/unistd_32.h (this is the same as above, it also has unistd. h)
Unistd_32.h, unistd_64.h files)
3. Add the system call implementation function in/kernel/sys. c:
Asmlinkage int sys_mycall (int argc ){
Return argc;
}
Step 3: After the preparation is complete, you can start the compilation process.
1. Enter the Kernel File
Cd linux-2.6.36
2. Configuration
Make mrproper
Make config
Make menuconfig
Make xconfig
Make oldconfig
Choose one from four. The Kernel configuration of oldconfig selected during compilation is still quite troublesome. www.linuxidc.com does not know much about it, so you can directly use the old configuration.
3. compile. 2.6.36 is already a very high version, so executing make all is equivalent to: make dep (establishing dependency attribute relationships), make clean
(Remove old data), make bzImage (start to compile the core), make modules (start to compile the module)
Make all
Make dep.
Make clear.
Make bzImage. Then we started a long compilation process and finally generated bzImage. A prompt will be displayed for the path of the file. For example, if my file is
Linux-2.6.36/arch/x86/boot/bzImage.
Make modules
4. Install the module. Install the module to/lib/modules/and load the module from this directory when the program is running.
Make modules_install
5. Install the kernel. Copy the vmlinuz and System. map generated by make all to the/boot directory and modify grub/boot/grub/menu. lst.
Modifying menu. lst is automatically completed !! You do not need to modify it manually.
Make install
6: restart, enter the new kernel, and write the test program.