-
Notifications
You must be signed in to change notification settings - Fork 348
Home
mengning edited this page Aug 5, 2013
·
8 revisions
It is a platform to write your own OS kernel,its based on Linux Kernel 3.9.4 source code.
-
Set up this platform
- install QEMU【sudo apt-get install qemu 这个源http://mirror-fpt-telecom.fpt.net/ubuntu/ 有qemu】 and download Linux Kernel 3.9.4 source code
- cd linux-3.9.4
- patch -p1 < ../mykernel_for_linux3.9.4sc.patch
- make allnoconfig
- make
- qemu -kernel arch/x86/boot/bzImage 从qemu窗口中您可以看到my_start_kernel在执行,同时my_timer_handler时钟中断处理程序周期性执行。
- cd mykernel 您可以看到qemu窗口输出的内容的代码mymain.c和myinterrupt.c
- 当前有一个CPU执行C代码的上下文环境,同时具有中断处理程序的上下文环境,我们初始化好了系统环境。
- 您只要在mymain.c基础上继续写进程描述PCB和进程链表管理等代码,在myinterrupt.c的基础上完成进程切换代码,一个可运行的小OS kernel就完成了。
- start to write your own OS kernel,injoy it!
-
mykernel patch generated by this command:
- diff -Naur linux-3.9.4 linux-3.9.4.new/ > mykernel_for_linux3.9.4sc.patch