Free-electrons Linux kernel and drivers

Source: Internet
Author: User

Three functions of the operating system: 1, management hardware resources; 2. Provide portable software interfaces independent of architecture and hardware 3, handle simultaneous access of different applications to the same hardware resources

The system call interface is stable, the system call is encapsulated by the C function library, and the user program basically does not need to call the system function directly.

The Linux system provides the system and kernel information to the user space through the virtual file system, the virtual file system allows the application to access files and directories that do not exist in the actual storage space, and the virtual file system is created dynamically by the kernel.

The two most important virtual file systems are the/proc and/sysfs two file systems

Proc Mount in the/proc directory, providing some information about the operating system, such as process information and memory parameter management

SYSFS is mounted in the/sys directory and is a series of devices and bus information.

The Linux kernel consists of 5 subsystems, such as process scheduling (SCHED), memory Management (MM), virtual file system (VFS), network Interface (NET), and interprocess communication (IPC).

Kernel compilation uses some of the GCC extensions. Therefore, the standard ANSI C compiler is not able to compile the kernel, kernel development can not use the C library, but the use of self-contained function set.

Do not use floating-point numbers in kernel development because the kernel may run on schemas that do not support floating-point numbers.

Do not be fooled by the kernel configuration options associated with floating-point numbers,

When floating-point operations are performed within the process of user space, the kernel completes the mode conversion from integer operations to floating-point operation. What exactly happens when you execute floating-point instructions, because the architecture differs from the kernel selection, but the kernel usually captures traps and begins to shift from integer to floating-point mode.

Unlike the user-space process, the kernel does not perfectly support floating-point operations because it cannot be caught in itself. When using floating-point numbers in the kernel, there are other trivial things to do in addition to manually saving and recovering floating-point registers. If you want to answer bluntly, that is: Don't do this, except in some rare cases, do not use floating-point operations in the kernel.

Unlike the user-space API, the API inside the kernel changes, and drivers written for this kernel version may not run in another version.

Internal and development does not have a memory protection mechanism, and its stack space size is fixed, kernel control memory is not exchangeable.

It is illegal to publish a binary kernel that contains commercial drivers, while the commercial driver module depends on the situation, such as the Nvidia graphics driver, which has an intermediate layer between the driver and the kernel. I'm not sure how it fits.

In some cases, the driver can be implemented in user space, using the following conditions:

1, the kernel provides direct access to the hardware mechanism

2, there is no need to leverage an existing kernel subsystem such as the networking stack or lesystems.

3, the kernel does not need to handle the concurrent access hardware, only one application instance will access the hardware

Possible user-space device drivers

USB with Libusb, http://www.libusb.org/
SPI with Spidev, Documentation/spi/spidev
I²c with I2cdev, Documentation/i2c/dev-interface
memory-mapped devices with UIO, including interrupt handling, documentation/docbook/uio-howto/

Some device drivers are implemented in user space, part of the kernel space implementation (printers, scanners, 2d/3d graphics acceleration)

Free-electrons Linux kernel and drivers

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.