Linux Source organization

Source: Internet
Author: User
Tags sha1 encryption xen hypervisor

The Linux source code can be https://www.kernel.org/. The current stable version is 3.16.3.

Because there is a project on the resume kernel-related, in order to prepare for the interview, or to revisit the kernel. Most basic, which documents in which project always need to know ...

Why is there no offer yet?

Tar can not be directly angular decompression, only first decompression with XZ, and then separated by tar. The entire compression ratio is quite high, the XZ file is 76.8MB, after decompression is more than 500 MB.

1 [email protected]:~# xz-d linux-3.16. 3. Tar . XZ 2 tar xvf linux-3.16. 3. Tar

Extract it, the root directory is such a child. The directory under the root directory is mostly the operating system's common code, drivers, arch is the special hardware processing.

1[Email protected]:~/win7download/linux-3.16.3# tree-l12 .3 ├──arch4 ├──block5 ├──copying6 ├──credits7 ├──crypto8 ├──documentation9 ├──driversTen ├──firmware One ├──fs A ├──include - ├──init - ├──IPC the ├──kbuild - ├──kconfig - ├──kernel - ├──lib + ├──maintainers - ├──makefile + ├──mm A ├──net at ├──readme -├──reporting-BUGS - ├──samples - ├──scripts - ├──security - ├──sound in ├──tools - ├──usr to└──virt

Copying-information about licensing and rights. The Linux kernel is licensed under the GPLV2 license. This license grants anyone the right to use, modify, distribute, and share the source code and compiled code for free. However, no one can sell the source code.

Kbuild-this is a script this sets up some settings for making the kernel. For example, this script sets up a arch variable where arch was the processor type that a developer wants the kernel to SUP Port.

Kconfig-this script is used when developer configure the kernel which would be discussed in a later article.

Arch-this folder contains a Kconfig which sets up some settings for compiling the source code, belongs in this Folde R. Each supported processor architecture are in the corresponding folder. So, the source code is Alpha processors belong in the Alpha folder. Keep in mind so as time goes on, some new processors would be supported, or some could be dropped.

1[Email protected]:~/win7download/linux-3.16.3/arch# tree-l12 .3 ├──alpha4 ├──arc5 ├──arm6 ├──arm647 ├──avr328 ├──blackfin9 ├──c6xTen ├──cris One ├──FRV A ├──hexagon - ├──ia64 - ├──kconfig the ├──m32r - ├──m68k - ├──metag - ├──microblaze + ├──mips - ├──mn10300 + ├──openrisc A ├──parisc at ├──powerpc - ├──s390 - ├──score -├──SH - ├──sparc - ├──tile in ├──um - ├──unicore32 to ├──x86 +└──xtensa

Block–this folder holds code for Block-device drivers. Block devices is devices that the accept and send data in blocks. Data blocks is chunks of data instead of a continual stream.

Crypto-this folder contains the source code for many encryption algorithms. For example, the ' SHA1_GENERIC.C ' is the file, which contains the code for the SHA1 encryption algorithm.

Documentation-this folder contains Plain-text documents that provide information on the kernel and many of the files. If A developer needs information, they may is able to find the needed information in here.

Drivers-this directory contains the code for the drivers. Each folder is a named after each piece or type of hardware. For example, the Bluetooth folder holds the code for Bluetooth drivers. Other obvious drivers is SCSI, USB, and FireWire. Some drivers may is more difficult to find. For instance, joystick drivers is not in a joystick folder. Instead, they is under./drivers/input/joystick. Keyboard and mouse drivers is also located in the input folder. The Macintosh folder contains code for hardware made by Apple. The Xen folder contains code for the Xen hypervisor. A hypervisor is software or hardware this allows users to run multiple operating systems on a single computer. This means, the Xen code would allow users to have both or more Linux system running on one computer at the same time.& nbsp;

Firmware-the firmware folder contains code that allows the computer to read and Underst and signals from devices. For illustration, a webcam manages it own hardware, but the computer must understand the signals of the webcam is Sendi ng the computer. The Linux system would then use the Vicam firmware to understand the webcam. Otherwise, without firmware, the Linux system does not know what to process the information, which is webcam. Also, the firmware helps the Linux system to send messages to the device. The Linux system could then tell the webcam to refocus or turnoff.

Fs-this is the filesystem folder. All of the code needed to understand and use filesystems are here. Inside This folder, each filesystem's code is in its own folder. For instance, the EXT4 filesystem ' s code was in the Ext4 folder. Within the FS folder, developers would see the some files not in folders. These files handle filesystems overall. For example, Mount.h would contain code for mounting filesystems. a filesystem is A structured-to store and manage files and directories on A storage Devi CE. Each filesystem have its own advantages and disadvantages. These is due to the programming of the filesystem. For illustration, the NTFS filesystem supports transparent compression (when enabled, files is automatically compressed W Ithout the user noticing). Most filesystems lack this feature, but they could only possess this ability if it's programmed into the files in the FS folder.

Include-the include folder contains miscellaneous header files that the kernel uses. The name for the folder comes from the C command "include" which is used to import a header into C code upon compilation.

Init-The init folder has code, deals with the startup of the kernel (initiation). The Main.c file is the core of the kernel. This is the main source code file , the connects all of the other files.

IPC-IPC stands for inter-process communication.This folder have the code that handles the communication layer between the kernel and processes. The kernel controls the hardware and programs can only ask the kernel to perform a task. Assume a user has a program that opens the DVD tray. The program does not open the tray directly. Instead, the program informs the kernel and the tray should be opened. Then, the kernel opens the tray by sending a signal to the hardware. This code also manages the kill signals. For illustration, when a system administrator opens a process manager to close a program that have locked-up, the signal to Close the program is called a Kill signal. The kernel receives the signal and then the kernel (depending on which type of kill signal) would ask the program to stop O R the kernel would simply take the process out of the memory and CPU.Pipes used in the command-line is also used by the IPC. The pipes tell the kernel to place the output data on a physical page on memory. The program or command receiving the data was given a pointer to the page on memory. Here is the code for locks, shared memory, Message Queuing.

1 [email protected]:~/win7download/linux-3.16. 3 ls 2 compat.c     ipcns_notifier.c  Makefile     mqueue.c  msgutil.c    sem.c  syscall.c  Util.h3 compat_mq.c  ipc_sysctl.c      mq_sysctl.c  msg.c     namespace.c  shm.c  UTIL.C

Kernel-The code in this folder controls the kernel itself. For instance, if-a debugger needed to trace an issue, the kernel-would use code that originated from source files folder to inform the debugger of all of the actions, the kernel performs. There is also code, here, keepingtrack of time. The kernel folder is a directory titled "Power". Some code in this folder provide the abilities for the computer to restart, Power-off, and suspend. Here is the code for kernel debugging, such as Printk\trace. There are fork\time\irq\kthread\sigal and other code.

Lib-the Library folder have the code for the kernel's library which is a set of files that that the kernel would need to r Eference. The XZ code is here, too. Binary find Ah, bitmap, hash ah, red black tree, a lot of code.

MM-The memory Management folder contains the code for managing the Memory. Memory is not randomly placed on the RAM. Instead, the kernel places the data on the RAM carefully. The kernel does isn't overwrite any memory, that's being used or that holds important data. DMA, swap, mmap, pagination, and segmentation are all available here. The slab allocator is a very important and complex part of Linux memory management.

The general code for Memory management is placed here, and its processor-related parts are placed in the arch/*/mm. The page error handling code is in the Memory.c file under mm and the memory map is in filemap.c with the page cache code. Swap caches are located in Mm/swap_state.c and mm/swapfile.c.

Net-the network folder contains the code for network protocols. This includes the code for IPV6 and Appletalk as well as the protocols for Ethernet, WiFi, Bluetooth, etc. Also, the code for handling network bridges and DNS name resolution are in the net directory. Generic code, protocols, etc.

The network code is in the net directory and most of the include files are in Include/net. The BSD Socket interface code is located in Net/socket.c. The IPV4 inet socket code is located in Net/ipv4/af_inet.c. The Common protocol support Code (including the Sk_buff process) is located in Net/core, while the TCP/IP network code is in Net/ipv4. The network device driver is located in the drivers/net.

Samples-this folder contains programming examples and modules that is being started. Assume a new module with a helpful feature are wanted, but no programmer have announced that they would work on the project. Well, these modules go. This gives new kernel programmers a chance to help by going through this folder and picking a module they would like to he LP develop. New features, such as KDB, Kprobe, and so on, have not been realized.

Scripts-this folder has the scripts needed for compiling the kernel. It is the best of the anything in the This folder. Otherwise, able to configure or make a kernel.

Security-this folder has the code for the security of the kernel. It is important to protect the kernel from computer viruses and hackers.  Otherwise, the Linux system can be damaged. The SELinux code is here.

Sound-this Directory has a sound driver code for Sound/audio cards.

Tools-this directory contains tools, interact with the kernel.

Usr-remember the Vmlinuz file and similar files mentioned in the previous article? The code in this folder creates those files through the kernel is compiled.

Virt-this folder contains code for virtualization which allows users to run multiple operating systems at once. This was different from Xen. With virtualization, the guest operating system was acting like any other application within the Linux operating system (HO St system). with a hypervisor-like Xen, the operating systems is managing the hardware together and the same time. In virtualization, the guest OS runs on top of the Linux kernel while in a hypervisor, there are no guest OS and all of the Operating systems do not depend on each other.

Most excerpted from: http://www.linux.org/threads/the-linux-kernel-the-source-code.4204/

Http://klinux.h.baike.com/article-80253.html

Linux Source organization

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.