Zhang Han + original works reproduced please specify the source + "Linux kernel analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000
First of all. Read the core code of the program
void __init My_start_kernel (void)
{
int i = 0;
while (1)
{
i++;
if (i%100000 = = 0)
PRINTK (kern_notice "My_start_kernel here%d \ n", i);
}
}
This is the startup function of the kernel code. C language writing. The loop portion is 100,000 times per run. Outputs a statement.
void My_timer_handler (void)
{
PRINTK (kern_notice "\n>>>>>>>>>>>>>>>>>my_timer_handler here <<<<<<<<<<<<<<<<<<\n\n ");
}
This code is called when the time is interrupted. Output a statement each time it is called.
It then consolidates the code that was written and then consolidates it into the Linux Kernel-3.9.4.
or download Mykernel_for_linux3.9.4sc.patch directly
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmzy0nzq1mw==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
Then download the Linux kernel-3.9.4
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmzy0nzq1mw==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
After the download is complete, unzip.
Enter the extracted directory:
compile your own code into the linux-3.9.4 .
- Patch-p1 <. /mykernel_for_linux3.9.4sc.patch
- Make Allnoconfig
- Make
Finally, install QEMU and execute kernel.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmzy0nzq1mw==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
last. Execution Kernel
execution results. The display of the terminal is in fact constantly changing. A section (assuming that the flicker is too fast, to increase the value of the function to slow down the speed of change)
Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.
A simple loop multi-channel program kernel code implementation