Fatal error:linux/compiler-gcc5.h:no such file or directory
Compilation terminated.
Workaround: Https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/include/linux/compiler-gcc5.h? Id=2c07053b8e1e0c22bb54dfbdf8e86a70f8bf00fc
The copied content is saved as compiler-gcc5.h and placed under the include/linux of the kernel code to compile the kernel module.
The following compilation steps are excerpted from Https://github.com/mengning/mykernel
Welcome to the mykernel!
It is a platform-to-write your own OS kernel,its based on Linux kernel 3.9.4 source code.
Set up this platform
sudo apt-get install qemu # install QEMU
sudo ln-s/usr/bin/qemu-system-i386/usr/bin/qemu
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.4.tar.xz # download Linux kernel 3.9.4 source code
wget https://raw.github.com/mengning/mykernel/master/mykernel_for_linux3.9.4sc.patch # Download Mykernel_for_ Linux3.9.4sc.patch
Xz-d LINUX-3.9.4.TAR.XZ
TAR-XVF Linux-3.9.4.tar
CD linux-3.9.4
Patch-p1 <. /mykernel_for_linux3.9.4sc.patch
Make Allnoconfig
Make
Qemu-kernel Arch/x86/boot/bzimage
From the Qemu window you can see that My_start_kernel is executing while the My_timer_handler clock interrupt handler is executed periodically.
CD Mykernel You can see the code for the contents of the Qemu window output mymain.c and myinterrupt.c
There is currently a CPU executing the C code context, and the context of the interrupt handler is in place, and we have initialized the system environment.
As long as you continue to write on the basis of the MYMAIN.C process to describe the PCB and process chain list management and other code, on the basis of MYINTERRUPT.C to complete the process switch code, a small operating OS kernel can be completed.
Start to write your own OS kernel,enjoy it!
Mykernel patch generated by the This command:
Diff-naur linux-3.9.4 linux-3.9.4.new/> Mykernel_for_linux3.9.4sc.patch
This article is from the "Clear" blog, please be sure to keep this source http://ggxxjj123.blog.51cto.com/1079641/1747930
Mykernel problem solving in compiling process