As a newcomer, how to learn embedded Linux?

Source: Internet
Author: User
Tags array sort



How to learn embedded Linux as a newcomer






Promote



To learn more about embedded knowledge, please visit



100ask.taobao.com




as aNew, how to learn embedded Linux? have been asked too many times, close-up this article to answer.
before you learn embedded Linux, you must have a C language Foundation. The basis of the Assembly is not indifferent (just a few assembly instructions, with a look will be). C language to learn to what extent? The more you know, the better, the less familiar, the basic skills. For example, write an array sort, enter a number sum or something. The only way to learn C language is to write more programs, compile errors do not matter, to solve their own mistakes do not matter, to analyze their own. I used to bewithVC to Practice C language, often to try to write some C language contest topics. They are pure C, pure mathematics, pure logic of the topic, do not involve the interface of these things, it is very suitable to forge your programming ability.
    
back to the topic, first of all we need to understand what your purpose is, presumably, the so-called embedded Linux can be divided into two parts: the bottom system, application development. If you want to do application development, then you go to C language, data structure, Java and so learn it. There is nothing special to note about embedded application development and application development on the PC. You might say that you need to do some optimizations on the embedded, yes, to optimize, but the programs that are not optimized and developed on the PC are no different. In addition, when you have the ability to optimize, you do not have to ask this question. Specific to an example, such as the development of the interface, we use VC on the PC, in embedded Linux maybe we use QT may use Android, this time you should learn QT, Android programming. But the basics are C or Java, and on this basis they are familiar with their interfaces. When you learn VC, you also take the time to understand the classes, controls.
  


If your goal is to learn the underlying system, this is my specialty, but I can say a little.
Before I answer this question, I answer: Many people ask me, in the end is learning to drive or to learn the application?




I can only say that interest, and the drive and application are not completely separate



1. We say that the driver, in fact, is not limited to the operation of the hardware, as well as the operating system principle, the process of sleep wake scheduling concepts. Want to write a good application, want to better solve the problems encountered by the application, this knowledge you should understand
2. Low threshold to do application, especially now Android, pure java. The development path of the application is the personal view of 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 the drive", but want to call "do the bottom system", do this is to kill the various industries. I worked for a few years, I did mobile phone, IPTV, conference TV, but these products don't make any difference to me, because I only do the bottom. Their business doesn't matter to me. When the application is in trouble and they can't solve it, I give them advice from the kernel point of view and provide them with tools. To do the bottom-up development direction, personally think is technical experts.
4. In fact, do the bottom or do the application, there is no boundary between, have the bottom-level experience, and then to do the application, you will feel very practical. With your business experience, you can get to the bottom and quickly form a team.
   
back to the question of how to learn. What does the embedded Linux underlying system contain? Don't worry, just give an example and you'll know.
1. When the computer is switched on, who is the interface? is the BIOS, what does it do? Some self-test, and then read from the hard disk into Windows and start it. Similarly, this BIOS corresponds to the bootloader in embedded Linux. The bootloader is going to read the Linux kernel on flash and start it.
2. What is the purpose of starting Windows? Of course, the Internet chat or something. Where are these Internet and chat tools?
On the C-drive, D-Disk. So, Windows has to recognize the C-drive, D-disk first. Under Linux we are called the root file system.
3. Windows can recognize the C-drive, D-Drive, then must be able to read and write hard disk. This involves something called a driver. Of course not only hard disk, but also network card, USB and so on.
Embedded Linux can read and execute applications from flash, and it must also have flash drivers, and certainly not just flash.
      
Let 's talk about it here,Embedded Linux contains bootloader, kernels, drivers, and root file systems in 4 chunks.


One, Bootloader:
    It's a slightly more complicated bare-board program. But it's not easy to read the bare-board program well. The easy-to-use tools in Windows weaken our programming capabilities.




Many people use ads and KEIL when they play embedded. Can you answer these questions?
1. Where does the CPU take the instruction from when it is power on?
A: General instructions from Flash.
2. But flash is generally read-only and cannot be written directly, if I use global variables, where are these global variables?
Answer: Global variables should be in memory
3. So who puts the global variables in memory?
A: Long-term use of ads, Keil friends, you can answer? This requires "relocation". In ads or Keil, the relocated code is the company that made the tools to help you write it.


have you ever read it?
4. Memory size, how do I know the "original Flash content" read to the "which address of memory"?
A : This address is determined by "link script", there are scatter files in ads, and there are similar files in Keil. But have you ever studied it?
5. You say relocation is to copy the program from Flash to memory, then this program can read Flash AH?
answer: Yes, to be able to operate flash. Of course not only these, but also set the clock to make the system run faster and so on.
   
first ask yourself to answer here, bootloader this a bare board program, in fact, there are 3 parts points:
1. Operation of the hardware
2. Understanding of ARM system processors
3. The basic concept of the program: relocation, stack, code segment Data section of the BSS section or something.
   
The operation of the hardware, need to look at the schematic, chip manual. This requires a certain amount of hardware knowledge, do not ask you to design hardware, but at least can read; Do not want to understand the analog circuit, but to be able to understand the digital circuit. This ability I learned in school, the principle of microcomputer, digital Circuit 2 books (the title forget) is enough. But I doubt you have the patience to read the 2 books. I don't know if there are any faster books now. If you want to crash, just let go of this piece, do not understand to ask Google, posting.
In addition, the chip manual is definitely to read, do not find Chinese, just look at English. The beginning is very painful, and later will find those grammar, vocabulary once familiar, read any chip manuals are easy. Understanding of ARM system processor, see Duchunlei's <arm Architecture and Programming > bar, there are assembly instructions, there are abnormal mode, MMU and so on. It's about 3 pieces of content that you need to know.



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. Advise you not to go to the super genius or not to see. Just look at what I wrote. < embedded Linux application development complete manuals > and 1th video Bar, don't worry, don't pay. These concepts are clear when the hardware-related experiments are done in the video. I have not yet
The discovery of a 2nd book or video about these concepts allowed me to boast blindly.

For bootloader, I studied <arm architecture and programming first, and then 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 see the u-boot together.



to summarize,read the hardware schematics, see the chip manual, this requires you to find information. For the rest, follow the chapters on the < embedded Linux app to develop a full manual > and 1th Edition video ..


Second, the kernel:
want to crash the person, first cross the core of learning, directly learn how to write the driver.
to be a master, the kernel must be deeply understood. Notice, I'm talking about understanding, I don't expect to write a kernel.
to the inside of the scheduling mechanism, memory management mechanism, file management mechanism and so on have some understanding.
two books recommended:
1. Read through the <linux kernel fully annotated; Please look at the thin one (the floating society stresses speed, uh),
2. Selected <linux kernel scenario analysis; Want to know which section to attend


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

Speaking of the driving frame, there are some books to introduce. LDD3, that is, <linux device driver; The foreigner wrote the book, which introduced a lot 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 concept before getting started and threw it away after getting started.

driving aspect of the overall introduction, it should be Song Baohua <linux device driver Development detailed >, frankly I only read the catalogue, there are many people said, here recommend. To get a closer look at a piece, <linux kernel scenario analysis > is definitely Super 5 star recommended. You can't expect to finish it, more than 1800 pages, and up and down two volumes. When I'm not sure of a piece, I'll go over it. In any part, the book can be 2, 300 pages, very detailed. And is a goal to take you to analyze the kernel source code. It takes Linux 2.4 as an example, but the same principle applies to other versions of Linux.

Do you have any other introductions? Oh, of course there is, Vedon Linux video phase 2nd. < embedded Linux application development Complete manual > does not speak much about the driver, not deep enough. So I recorded this video. Not only teaches you how to write how to change the driver, but also teaches you how to write such a change drive.
Each driver is written in the field:
1. Drawing on the graphics board-the equivalent of the school teacher on the blackboard drawing on the explanation, very intuitive
It 's definitely not a PowerPoint reading.
2. Use source insight to write the program on the spot, start writing from line 1th, and every lesson is like this. I've spoken more than 20 drivers, and I've written more than 20 programs.
3. Compile and test after writing.
4. Very comprehensive, character device driver, block equipment, network card driver 3 broad categories, hardware introduction, driving framework analysis, testing 3 categories complete.


training institutions in the content, far less than this period of video rich. I have been teaching in a number of training institutions, never see which teacher dared to explain every lesson on the spot to write code,test on the spot, except me! I don't see any training agency that finishes this--because there's not enough time, it takes at least one months to finish, but it's basically only 2 weeks of teaching time.

try writing a driver by putting the hardware involved in the Development Board on your hands. When you have a problem, "Think in pain", in the process of thinking you will be a lot of irrelevant knowledge in series, and finally through.


Four, the 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 tablet. After the kernel is booted, which application should be started after mounting 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, this application will read the configuration file, according to the configuration file to start the user program (monitoring, manual interface, tablet interface, etc.)
This problem suggests that the file system content is a few conventions, such as to have/sbin/init, to have a configuration file
2. Do you write the Hello,world program, have you ever thought about the use of the printf who realized it?
A : This function is not implemented by you, but is implemented by the library function. When it runs, you have to find the library.
This question suggests that there must be a library in the file system.
       
A simple self-answer to this, in order to understand, you can look at BusyBox init.c, you can know the init process to do things.
of course, you can also look at < embedded Linux application development Complete manual > build the root file system chapter.


Let's talk 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 teach some electronic circuit knowledge. PCB design is in the laboratory self-taught, only designed over 2 layers of board, now forget almost. But it retains the ability to look at the schematics and see the chip manuals.
2. Took a software degree, interested in software design, but also only learned C language, database only. With interest to do a lot of competition problems. Not able to participate in the competition, but the C language to practice very solid.
3. In the laboratory, in the 1th company, is to design some simple PCI card, write the 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. Start to feel the lack of single-chip microcomputer, resigned six months to learn Linux, from Red Hat How to operate the start. Step is to look at <arm architecture and programming, and then write their own bare board program operating hardware, and then to analyze the u-boot. At the same time look at the <linux kernel fully annotated, the Linux framework has some knowledge. When writing bare boards, it is recommended that you enhance your understanding of interrupts, and that the kernel uses interrupts to perform various functions.
6. After analyzing the u-boot, we began to do simple driver programming, at this time, the ability is still very weak.
7. Started to go to  to work for 2 years, write various types of drive, solve all kinds of problems (driving problems, help locate application problems), the ability to be forged.

    
To summarize:
1. Hardware book: Microcomputer principle, digital circuit, the teaching materials in the university. After graduating for many years, forget the name.
2. Linux-related books:
<arm architecture and Programming >
< full manuals for embedded Linux application development >
<linux device driver; The foreigner wrote the book .
<linux device Driver Development >
<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



Vedon Linux Video Section 3 Period: Project Combat



Vedon Linux Video Section 4 Period: Android Drive
please allow me to play the advertisement: Video information please see www.100ask.net , inside there.



As a newcomer, how to learn embedded Linux?


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.