20135302 Wei Quiet--textbook 1-2 study notes

Source: Internet
Author: User
Tags comparison table

Chapter One Linux kernel Introduction I. Unix

UNIX is a powerful, robust, and stable operating system.

unix--supports preemptive multitasking, multi-threading. Virtual memory, page breaks, dynamic links, and TCP/IP networks.

Ii. Introduction to operating system and kernel

operating systems are those parts of the entire system that are responsible for the most basic functions and systems management.

The kernel is isolated from normal applications, is generally system-state, has a protected memory space, and has all the permissions to access hardware devices.
This system state and the protected memory space, collectively known as the kernel space .
Applications running in the system communicate with the kernel through system calls .

The basic behavior of the application to complete its work is:

The application is trapped in the kernel through the system call interface.

The activity of the processor must be one of the following three:
    • Run in user space, execute user process
    • Runs in kernel space, is in the process context, executes on behalf of a particular process
    • Runs in kernel space, is in the interrupt context, is independent of any process, and handles a specific interrupt
Chapter two from the kernel one, to obtain the kernel source code

Use Git to get the source code:

git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.gitgit pull # 更新分支到Linux的最新分支

Installation decompression:

tar xvjf linux-x.y.z.tar.bz2或者tar xvzf linux-x.y.z.tar.gz

Patching:

patch -p1 < ../patch-x.y.z
Second, compile the kernel 1. Configuring the Kernel
    1. Command-line tools for character pages:

      make config
    2. Graphical interface Tools

      make menuconfig

A few other configurations:

make defconfig //基于默认配置make oldconfig //验证和更新配置
2. Compiling the kernel
make

Reduce compiled spam-redirects the output.

# 重定向到这个文件里了make > /dev/null # 把无用的输出信息重定向到永无返回值的黑洞里。
3. Install the new kernel
make modules_install

System.map This file is a symbol comparison table

Three, the characteristics of the core development
    1. Kernel development can neither access C library nor access standard C header files
      Response: The Include/linux folder contains the required kernel header files.
    2. The kernel programming must use the GNU C
    3. Kernel programming lacks a memory protection mechanism like user space
      The memory in the kernel is not paged.
    4. Difficult to perform floating-point arithmetic during kernel programming
    5. The kernel gives each process only a small fixed-length stack
    6. Because the kernel supports asynchronous interrupts, preemption, and SMP, you must always be aware of synchronization and concurrency
      SMP: Symmetric multi-processing system.
      Common ways to solve competition: spin locks and semaphores .
    7. To consider the importance of portability
      such as keeping the byte order, 64 bits to it, not assuming word length and page lengths.
Reference: http://www.cnblogs.com/20135202yjx/p/5272633.html

20135302 Wei Quiet--textbook 1-2 study notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.