How to learn arm Linux embedded __linux

Source: Internet
Author: User
Tags array sort
As a newcomer, how to learn embedded Linux. Been asked too many times, close-up this article to answer.
Before you learn embedded Linux, you must have a C language base. There is no matter in the basis of the compilation (just a few assembly instructions, used in a glance).
C language to learn to what extent it. The more familiar of course the better, not familiar with the basic skills. For example, write an array sort, enter a sum of numbers or something.
The only way to learn C language is to write programs more practice, compile errors do not matter, to solve their own; Before, I used
VC to Practice C language, often to try to write a number of C language Contest topics. They are pure C, pure mathematics, pure logic topics, not related to the interface of these things,
It's good for your programming skills.

Back to the theme, first of all, we need to understand what your purpose is, probably the so-called embedded Linux can be divided into two parts: the underlying system, application development.
If you want to do application development, then you go to the C language, data structure, Java and what to learn it. Embedded application development and PC
There is nothing special to notice about application development. Maybe you say you want to do some optimization on the embedded, yes, to optimize, but not optimized program
And the development of the program on the PC is no different. In addition, when you have the ability to optimize, you do not have to ask this question. Specifically to an example,
For example, the development of the interface, on the PC we use VC; in embedded Linux maybe we use qt maybe with Android, this time you should learn QT,
Android programming. But the base is also C or Java, which is the basis for familiarity with their interfaces. If you learn VC, it also takes time to understand
Of those classes, controls.
If your goal is to learn the underlying system, this is my specialty, but I can say a little.
Before answering this question, I answer first: Many people ask me, in the end is the study drive or the study application.
I can only say that interest, and drive and application are not completely separate
1. We say that the driver, in fact, is not limited to the operation of the hardware, there are operating system principles, the process of sleep wake up scheduling concepts.
Want to write a good application, want to better solve the problems encountered by the application, this knowledge you should understand
2. Make application threshold low, especially now Android, pure java. To do the development of the application of the personal view is the business proficiency.
For example, in the communications industry, IPTV industry, mobile phone industry, you understand the needs of the industry. Therefore, when the leader of the people, more is to do the application.
3. Do drive, in fact I do not want to call "do drive", but want to call "do the bottom system", do this is to kill all industries. I worked for a few years,
I have done mobile phones, IPTV, conference TV, but these products are no different to me, because I only do the bottom. Their business has nothing to do with me.
When the application is out of the question and they can't solve it, I advise them from the kernel point of view and provide them with tools.
To do the bottom of the development direction, the individual think is a technical expert.
4. In fact, do the bottom or do the application, there is no line between, have the bottom experience, then to do the application, you will feel very steadfast.
With business experience, you will soon be able to form a team by understanding the bottom floor.

Back to the question of how to learn. Embedded Linux The underlying system contains something. Don't worry, just give me an example and you'll know.
1. When the computer is turned on, those interfaces are displayed. is the BIOS, what does it do. Some self-test, then read the Windows from the hard drive and start it.
Similarly, this BIOS corresponds to the bootloader in embedded Linux. The bootloader will go to Flash and read the Linux kernel and start it.
2. What is the purpose of starting Windows? Of course it is chatting on the Internet or something. Where are the Internet and chat tools?
On the C and D plates. Therefore, Windows must first identify the C disk, D disk. Under Linux we are called root file systems.
3. Windows can recognize the C disk, D disk, then must be able to read and write hard disk. This involves something called a driver. Certainly not only the hard disk, but also has the network card, the USB and so on.
Embedded Linux can read and execute the application from Flash, must also have flash driver, of course, not only flash.

First of all, embedded Linux contains bootloader, kernel, driver, root file system of these 4 blocks.
First, bootloader:
It's a slightly more complicated bare-board program. But it's not easy to read the bare-board program and write it well. The Easy-to-use tools under Windows weaken our programming capabilities.
A lot of people use ads and KEIL as a play embedded. Can you answer these questions?
1. A power, the CPU from where to take instructions to execute.
A: General instructions from the Flash.
2. But Flash is generally only read can not write directly, if I use the global variables, where the global variables.
Answer: Global variables should be in memory
3. Then who puts the global variables in memory.
A: The long-term use of ads, Keil friends, you can answer it. This requires "relocation." In ads or Keil, the relocation code is the company that made the tools to help you write it.
Have you ever read.
4. Memory is so large, how do I know to "originally exist Flash content" read to the memory "which address."
A: This address is decided by "link script", there are scatter files in ads, and similar files in Keil. But have you ever studied it.
5. You say reposition is to copy the program from Flash to memory, then this program can read Flash AH.
A: Yes, to be able to operate flash. Of course, not only these, but also set up a clock to make the system run faster and so on.

First ask yourself to come here, bootloader this a bare board procedure, in fact, there are 3 parts of the main points:
1. The operation of the hardware
2. Understanding of the ARM system processor
3. The basic concept of the program: relocation, stack, code segment of the BSS section of the data section or something.

The operation of the hardware, need to see schematic diagram, Chip manual. This requires a certain amount of hardware knowledge, do not ask you to design hardware, but at least can read; Do not seek to understand the analog circuit,
But to be able to read the digital circuit. This ability I learned in school, microcomputer principle, digital Circuit 2 books (title forgotten) is enough. But I doubt if you have any resistance.
Heart to read the 2 books. I don't know if there is a quicker book now. If you want to crash, just let go of this piece, do not understand the Google, posting.
In addition, the chip manual is sure to read, do not look for Chinese, you see English. The beginning is very painful, later will discover those grammar, the vocabulary once familiar,
It's easy to read any chip manuals.
The understanding of ARM system processor, see Duchunlei <arm System Architecture and Programming > bar, there are assembly instructions, there are abnormal mode, MMU and so on. This 3 pieces of content need you to understand.
The basic concept of the program, the King of course is to see the principle of compiling. Unfortunately, this kind of books is definitely a heavenly book level. I'd advise you not to look at a super genius. I wrote it.
< embedded Linux application development complete manual > and 1th Video Bar, don't worry, don't spend money. These concepts are clear by doing experiments with hardware related to the video. I have not yet
Find the 2nd set of books or videos that talk about these concepts, allowing me to brag blindly about one time.

For bootloader, I studied the <arm architecture and programming, and then I wrote the program to do all the hardware experiments, such as GPIO, clock,
SDRAM, UART, NAND. Get them all figured out, it's easy to read u-boot together.
To sum up, read the hardware schematic diagram, look at the chip manual, this requires you to find information. The rest, on the < embedded Linux application development complete manual > and 1th Video Chapter
Section directory to learn it.


Second, the core:
Want to crash people, first step through the core of learning, direct learning how to write drive.
To become a master, the kernel must be deeply understood. Attention, I said is to understand, I do not expect to write a kernel.
To the inside of the scheduling mechanism, memory management mechanism, file management mechanism and so on to understand.
Recommended two books:
1. Read through the <linux kernel full annotation, please look at the thin one (the floating society emphasizes speed, eh),
2. Selected <linux kernel scenario analysis, to learn which section


Third, drive:
The driver consists of two parts: the operation of the hardware itself, and the framework of the driver.
Hardware, or to understand the schematic diagram, read the chip manual, more practice it.

When it comes to driving frames, there are some books to introduce. LDD3, that is, <linux device driver, the Foreigner wrote the book, which introduced a number of concepts, it is worth reading. However, its role
is limited to the introduction of concepts. I basically used it to familiarize myself with the concepts before getting started and throwing them away.
Driving aspects of the overall introduction, should be Song Baohua <linux device Driver Development >, to be honest, I have only seen the catalogue, a lot of people say well, here recommend.
To get a better understanding of a piece, the <linux kernel scenario analysis > is definitely a 5-star recommendation. You don't expect to read it, more than 1800 pages, and up and down two volumes. I'm not sure about a piece.
, just go over it. Any part of this book can be said 2, 300 pages, very detailed. And with a goal to take you to analyze the kernel source. It takes Linux 2.4 for example,
But the same principle applies to other versions of Linux.

There are no other introductions. Oh, of course, Vedon Linux video phase 2nd. < embedded Linux application development complete manual > Not much talk about drive, not deep enough.
So I recorded this video. Not only how to write how to change the driver, but also to teach you why you write this way to change the driver.
Each driver is written on site:
1. Use the drawing board to explain----the equivalent of the school teacher on the blackboard on the drawing, very intuitive
It's definitely not a PPT reading.
2. Use the source insight to write the program on the spot, starting from line 1th, each lesson is like this. I spoke more than 20 drivers and wrote more than 20 programs.
3. Compile and test after writing.
4. Very comprehensive, character device drive, block equipment, network card driver 3 major categories complete, hardware introduction, drive framework analysis, testing 3 categories complete.
The content of teaching in training institutions is far less abundant than this video. I've been in a number of training institutions, and I've never seen a teacher who dares to write code on the spot in every lesson.
Test on the spot, except me. I don't see any training organization that finishes it--because it's not enough time, it's at least one months, but it's basically only 2 weeks of teaching time.

Try to write a driver for the hardware involved in the development Board you have on hand. If you have a problem, "Think in pain", and you will put a lot of irrelevant knowledge in the process of thinking.
In tandem, the final link.


Iv. Root File system:
Have you ever thought about these 2 questions:
1. For Linux products, some used for monitoring, some do mobile phones, some do tablets. So after the kernel starts, which application should you start after you mount the root file system?
A: The kernel does not know and no matter which user program should be started. It only launches the INIT application, which corresponds to/sbin/init.
Obviously, the application will read the configuration file and start the user program (monitor, manual interface, tablet interface, etc.) according to the configuration file.
This question prompts us that the content of the file system has some conventions, such as to have/sbin/init, have the configuration file
2. Do you write the Hello,world program, have you ever thought about the use of printf in it who achieved.
A: This function is not implemented by you, it is implemented by the library function. When it runs, it has to find the library.
This question prompts us to have a library in the file system.

Simply ask yourself here, to get a deeper understanding, you can look at BusyBox's init.c, you can know what the init process does.
Of course, you can also look at < embedded Linux application development Complete manual > build the root file system chapter.


Tell me about my study experience.
1. I was in the School of Physics and electronics major, in fact, the course did not teach how to design the circuit, just taught some knowledge of electronic circuits. The design of PCB
is in the laboratory self-study, only designed 2 layers of board, now forget almost. But it retains the ability to see the schematics and see the chip manuals.
2. Take the software degree, the software design is very interested, but also just learn C language, database just. With interest to do a lot of competition questions. No ability to
Take part in the competition, but practice the C language very solid.
3. In the laboratory, in the 1th company, is to design some simple PCI card, write Windows driver
4. In the 2nd company, using 51 single-chip computer to do car phone, began to embark on the road of pure software.
5. Began to feel the lack of SCM, resigned half a year to learn Linux, from Red Hat How to start the operation. The first step is to look at <arm architecture and programming,
Then write your own bare board program to operate the hardware, and then to analysis U-boot. At the same time look at the <linux kernel full annotation, the Linux framework has some understanding.
When writing the bare board, we recommend that you strengthen the understanding of the interruption, the kernel is to use interrupts to complete a variety of functions.
6. After the analysis of U-boot, began to carry out a simple driver programming, at this time, the ability is still weak.
7. Start to ZTE work, work for 2 years, write all kinds of driving, solve all kinds of problems (driving problems, help positioning application problems), the ability to be calcined.


To sum up:
1. Hardware book: Microcomputer principle, digital circuit, college textbooks. After graduating for years, I forgot my name.
2. Linux aspects of the book:
<arm Architecture and Programming >
< embedded Linux application development complete manual >
<linux device driver, the book that the Foreigner wrote
<linux Equipment Drive Development detailed >
<linux Kernel Full Comment >
<linux Kernel Scenario Analysis >
3. Video:
Vedon Linux Video Phase 1th (based on s3c2440 recording): Arm experiment, u-boot, file system, primary drive
Vedon Linux Video Phase 1th (based on s3c6410 recording): Bare Board Program
Vedon Linux Video Phase 2nd: Advanced Driver

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.