As a new person , How to learn Embedded Linux? Asked too many times , Close up this article to answer .

Learning embedded Linux Before , There must be C Language foundation . It doesn't matter if the basis of assembly is there or not ( Just a few assembly instructions , If you use it, you will ).

C How much do you want to learn ? The better, of course , If you are not familiar with it, you should also have basic skills . Like writing an array sort 、 Input numbers, sum or something .

learn C The only way to learn a language is to write more programs and practice more , It doesn't matter if there is a compilation error , Solve it by yourself ; It doesn't matter if the execution goes wrong , Analyze yourself . I used to use VC To practice C Linguistic , Always try to write something C The title of the language contest . They are pure C、 Pure mathematics 、 Pure logic , It's not about interfaces , It's very suitable for training your programming ability .

    

Back to the topic , First we need to understand what your purpose is , In general, embedded Linux It can be divided into two parts : The underlying system 、 application development .  If you want to do application development , Then you go and get it C Language 、 data structure 、JAVA Learn something well . Embedded application development and PC There's nothing special to pay attention to in application development on . Maybe you want to do some optimization on embedded system , Yes , To optimize , But unoptimized programs and PC There's no difference in program development on .

in addition , When you have the ability to optimize , You don't have to ask that question anymore . Specific to an example ,

For example, developing interfaces , stay PC We use VC; In embedded Linux Maybe we can use it in the library QT Maybe with Android, At this time, you should learn QT、Android Programming for . But the foundation is still C or JAVA, On this basis, be familiar with their interfaces . You learned VC Words , It also takes time to understand the classes 、 The control of .

If your goal is to learn the underlying system , This is my specialty , It can be said that .

Before I answer that question , I'll answer first : A lot of people asked me , Learning to drive or learning to apply ?

I can only say by interest , And driver and application are not completely separated  

1. What we call drive , In fact, it is not limited to the operation of hardware , And the principle of the operating system 、 The concept of sleep and wake-up scheduling of process .  Want to write a good application , Want to better solve the problems encountered in the application , You should know this knowledge  

2. The threshold of application is low , Especially now ANDROID, pure JAVA. I think the development path of application is business proficiency .

For example, in the communications industry 、IPTV industry 、 Mobile phone industry , You understand the needs of the industry . therefore , People who are leaders , Mostly for applications .

3. Drive , Actually, I don't want to call it “ Drive ”, I want to call it “ Do the underlying system ”, Well done, this is to kill all industries . I worked for a few years , I've done cell phones 、IPTV、 Conference TV , But these products make no difference to me , Because I only do the bottom . Their business has nothing to do with me .  When something goes wrong with the application , When they can't solve it , I'll give them advice from the perspective of the kernel , Give them tools .

Be the development direction of the bottom , I think it's a technical expert . 

4. Actually , Be a bottom layer or an application , There is no line between them , There's a lot of experience at the bottom , Then go to the application , You'll feel solid . With business experience , You know more about the bottom , A team can be formed soon . 

   

  Back to the question of how to learn . The embedded Linux What does the underlying system contain ? Don't worry , For example, you can see .

1. As soon as the computer is turned on , Who displayed those interfaces ? yes BIOS, What does it do ? Some self tests , And read it in from the hard disk windows, And activate it . Allied , This BIOS Corresponding to embedded Linux Inside bootloader. This bootloader Want to go Flash Read in Linux kernel , And activate it .

2. start-up windows What is the purpose ? Of course, it's online chatting or something . These are online 、 Where are the chat tools ?

    stay C disc 、D On the disk . therefore , windows First identify C disc 、D disc . stay Linux Next we call it the root file system .

3. windows Can recognize C disc 、D disc , Then I'm sure I can read and write the hard disk . This involves something called a driver . It's not just hard drives, of course , And the network card 、USB wait . The embedded Linux Can from Flash Read and execute the application on the , There must be Flash The driver of the , Of course, it's not just Flash.

      

The embedded LINUX It contains bootloader, kernel , The driver 、 Root file system this 4 large .

One 、bootloader:

  It's just a slightly more complex bare board program . But it's not easy to read and write this bare board program well .Windows Easy to use tools weaken our programming ability .

Many people use it as soon as they play embedded ADS、KEIL. Can you answer these questions ?

1. A power on ,CPU Where to get instructions to execute ?

    answer : Generally from Flash On command .

2. however Flash Generally, it can only be read but not written directly , If I use global variables , Where are these global variables ?

    answer : Global variables should be in memory

3. So who put global variables in memory ?

    answer : Long term use ADS、KEIL Friend, , Can you answer ? This needs to be " relocation ". stay ADS or KEIL in , The relocation code is written for you by the company that makes these tools . Have you ever read ?

4. So much memory , How do I know to put " Original existence Flash Content on " Read to memory " Which address to go to "?

    answer : This address uses " Link script " decision , stay ADS Are there in scatter file ,KEIL There are similar documents in the library . however , Have you ever studied ?

5. You said relocation is taking the program from Flash Copy to memory , So this program can read Flash ah ?

    answer : Yes , To be able to operate Flash. It's not just that, of course , And setting the clock to make the system run faster and so on .

   

    Let's ask and answer ourselves first ,bootloader This is a bare board program , In fact, there are 3 Some key points :

1. The operation of the hardware

2. Yes ARM Knowledge of system processors

3. The basic concept of procedure : relocation 、 Stack 、 Code segment data segment BSS A paragraph or something .

   

  The operation of the hardware , You need to look at the schematic 、 Chip manual . This requires a certain amount of hardware knowledge , I don't ask you to design hardware , But at least I can understand ; Do not ask to be able to understand analog circuit , But to understand digital circuits . I learned this ability in school , Microcomputer principle 、 Digital circuits, this 2 This book ( I forgot the title of the book ) That's enough . But I wonder if you have the patience to 2 After reading this book . I don't know if there are any faster books right now . If you want to speed it up , Let go of this one first , Ask no questions GOOGLE、 Post . in addition , The chip manual must be read , Don't look for Chinese , It depends on English . It was very painful at first , You'll find that grammar later 、 Once the words are familiar , It's easy to read any chip manual . Yes ARM Knowledge of system processors , Look at Du Chunlei <ARM Architecture and programming > Well , There are assembly instructions in it , There are abnormal patterns 、MMU etc. . That's it 3 I need you to understand .

3. The basic concept of procedure , Wang Dao, of course, is to see the principle of compilation . unfortunately , This kind of books are absolutely at the level of heavenly script . I advise you not to watch it if you are not super genius . Just look at what I wrote < The embedded Linux Application development complete manual > And the 1 Let's have a video , Don't worry , Don't spend money . According to the video, the hardware related experiments were done , These concepts are clear . I haven't

Find the first 2 Books or videos about these concepts , Allow me to brag blindly once .



about bootloader, I read it first when I was studying <ARM Architecture and programming >, Then I wrote a program to do all the hardware experiments , such as GPIO、 The clock 、

SDRAM、UART、NAND. I've got them all figured out , It's easy to understand when you're together u-boot 了

To sum up , Understand the hardware schematic diagram 、 Look at the chip manual , You need to find the information yourself . The rest , Just press the < The embedded Linux Application development complete manual > And the 1 Chapter of the video

Let's learn from the program .





Two 、 kernel :

People who want to be quick , First of all, cross the core of learning , Learn how to write drive directly .

Want to be a master , The kernel has to have a deep understanding of . Be careful , I'm talking about understanding , I didn't expect to write a kernel .

We need to understand the scheduling mechanism inside 、 Memory management mechanism 、 File management mechanism and so on .

Recommend two books :

1. Read through <linux The kernel is fully annotated >, Please look at the thin one ( The floating society stresses speed , o ), 

2. the selected readings <Linux Kernel scenario analysis >, I want to know which section to study





3、 ... and 、 drive :

The driver consists of two parts : The operation of the hardware itself 、 Driver framework .

Hardware again , Still need to understand the schematic diagram 、 Read the chip manual , Practice more .



When it comes to driving frameworks , There are some books about .LDD3, namely <Linux Device drivers >, The book written by a foreigner , It introduces a lot of concepts , Worth reading . however , Its function is limited to introducing concepts . I basically use it to familiarize myself with concepts before I get started , I threw it away after I got started .

4. A more comprehensive introduction to driving , It should be song Baohua's <linux Detailed description of device driven development >, To be honest, I've only seen the catalog , A lot of people say that , Here's a recommendation .

To get a deeper understanding of a piece ,<Linux Kernel scenario analysis > Absolutely super 5 Star recommendation . You can't expect to finish reading it ,1800 Multi page , Two volumes up and down . I am not clear about a piece , Just turn it over . Any part of it , It's all about 2、3 Hundred pages , Very detailed . And with a certain goal to take you to analyze the kernel source code . It uses linux 2.4 For example ,

But the principles are the same , The same applies to other versions of linux.









Four 、 The root file system :

Have you ever thought about this 2 A question :

1. about Linux Products made , Some are used for monitoring 、 Some make cell phones 、 Some make tablets . So after the kernel starts , After mounting the root file system , Which application should be started ?

    answer : The kernel doesn't know and doesn't care which user program should be started . It just starts init This is an application , It corresponds to /sbin/init. obviously , This application will read the configuration file , Start the user program according to the configuration file ( monitor 、 Manual interface 、 Flat panel interfaces and so on ), This question reminds us that , There are some conventions about the content of the file system , For example, there should be /sbin/init, Have a configuration file

2. You wrote it. hello,world Program , Have you ever thought about what's used in it printf Who made it ?

    answer : This function is not implemented by you , It's a library function . When it runs , We have to find the library .

       This question reminds us that , There's also a library in the file system .

       

       Here's a simple question and answer , Want to know more about , You can look at it busybox Of init.c, We can know init The process has done . Of course , You can also see < The embedded Linux Application development complete manual > In the chapter building root file system .





Tell me about my study experience .

1. I majored in physics and electronics at school , In fact, the course did not teach how to design circuits , I just taught some knowledge about electronic circuits .PCB My design is self-taught in the laboratory , Only designed 2 Laminate , It's almost forgotten now . But keep looking at the schematic 、 The ability to read chip manuals .

2. Took a degree in software , I'm very interested in software design , But I just learned C Language 、 Database just . I did a lot of competition questions with my interest . Not able to compete , But put C The language practice is very solid .

3. In the lab. 、 In the 1 companies , It's about designing something simple PCI card , Write about the windows Driver program

4. In the 2 companies , use 51 SCM makes car phone , Start on the road of pure software .

5. I began to feel the shortage of MCU , Quit half a year and study behind closed doors Linux, from red hat How to start . The first step is to look at <ARM Architecture and programming >, Write bare board program to operate hardware , And then to the analysis u-boot. Watch at the same time <linux The kernel is fully annotated >, Yes LINUX I know something about the framework . When writing bare board , I suggest you strengthen your understanding of interruption , The kernel uses interrupts to perform various functions .

6. Analysis finished u-boot, It's time to start simple driver programming , Now , The ability is still very weak .

7. Start to work in ZTE , Work 2 year , Write all kinds of drivers 、 Solve all kinds of problems ( Drive problem 、 Help locate application problems ), Ability is tempered .



    

  Sum up the books to read :

1. Books on hardware : Microcomputer principle 、 digital circuit , Teaching materials in Colleges and universities . Years after graduation , I forgot my name .

2. Linux A book on :

    <ARM Architecture and programming >

     < The embedded Linux Application development complete manual >

    <Linux Device drivers >, The book written by a foreigner

    <linux Detailed description of device driven development >

    <linux The kernel is fully annotated >

    <Linux Kernel scenario analysis >

As a new person , How to learn Embedded Linux More articles about

  1. As a new person , How to learn Embedded Linux?( Weidong mountain )

    This article is a quote from Mr. Wei's part about how newcomers learn Embedded Linux Experience , Quote the following : 1. As soon as the computer is turned on , Who displayed those interfaces ? yes BIOS, What does it do ? Some self tests , And read it in from the hard disk windows, And activate it . Allied , ...

  2. As a new person , How to learn Embedded Linux?

    As a new person . How to learn Embedded Linux? I've been asking too many times , Close up to answer this question . Learning embedded Linux Before . There must be C Language foundation . It doesn't matter if the basis of assembly is there or not ( Just a few assembly instructions , If you use it, you will ).C Language needs ...

  3. As a new person , How to learn Embedded Linux?

        As a new person , How to learn Embedded Linux?   Learning embedded Linux Before , There must be C Language foundation . It doesn't matter if the basis of assembly is there or not ( Just a few assembly instructions , If you use it, you will ). Try to write something C The title of the language contest . They are pure ...

  4. As a new person , How to learn Embedded Linux,( Weidong mountain )

    I saw the article written by Mr. Wei Dongshan on the Internet a long time ago , Copy to your own blog , It's convenient for you to watch later . Learning embedded Linux Before , There must be C Language foundation . It doesn't matter if the basis of assembly is there or not ( Just a few assembly instructions , If you use it, you will ). C What language to learn ...

  5. ( turn ) As a new person , How to learn Embedded Linux?( Weidong mountain )

    Asked too many times , Close up this article to answer .    Learning embedded Linux Before , There must be C Language foundation . It doesn't matter if the basis of assembly is there or not ( Just a few assembly instructions , If you use it, you will ).C How much do you want to learn ? The better, of course , If you're not familiar with it, it's also ...

  6. Learn Embedded Linux Is there a best order ( Continuous updating )

    As an embedded system Linux Beginners , I know I may be a beginner for a long time , Because I still haven't been able to find a good way to let me enter a higher stage from a beginner . But I never give up , This article is used to record my study of embedded system Linu ...

  7. On personal learning Linux The process

    My major is electronic information engineering , At the beginning of College , Our head teacher asked us to learn more about electronics . Later I learned about embedded , And then I learned about embedded Linux. In fact, we learn linux It's about learning linux kernel , however ...

  8. How does a new person learn to add new features and Debug

    Background : I was officially employed in July this year , The main business of the company is ERP Software , The building owner's group is mainly responsible for the secondary development , The language used is Java. What is secondary development ?ERP The customers of software are all enterprises . And the situation between these enterprises is different , A standard version of the enterprise ...

  9. The embedded linux The way of learning [ turn ]

    I think one way to learn Embedded Linux Way : 1) Study  Linux System installation .  Common commands . Application installation . 2)  Study  Linux  Under the  C  Programming . This book must be learned <UNIX  Environment advanced programming >.<UN ...

Random recommendation

  1. On the server side office And then virtual printing convert to pdf

    On the server side office And then virtual printing convert to pdf [WebMethod] public bool ConvertWordTOPDF(string WordPath) { bool ret=fal ...

  2. php Commonly used mysql function

    mysql_affected_rows: obtain MySQL The number of columns affected by the last operation . mysql_close: close MySQL Server connection . mysql_connect: Turn on MySQL Server connection ...

  3. BZOJ 1257 - Sum of residues - [CQOI2007]

    Topic link :https://www.lydsy.com/JudgeOnline/problem.php?id=1257 The question : Given a positive integer $n,k$, seek $(k \bmod 1) + (k \bmod ...

  4. layui( 5、 ... and )——form Component common usage summary

    form It's a piece that we value very much .layui Medium form Achieve automatic initial rendering , And event driven interface writing . I sorted out layui in form Configuration of . The next one is a chestnut , Backstage use .net MVC, except razo ...

  5. Instant messaging system can be deployed and run in Wan -- GGTalk The overview ( Download the source code )

      ( The latest version :V6.2,2019.01.03 .Xamarin The mobile version has been launched , Include Android and iOS) GGTalk Open source instant messaging system ( abbreviation GG) yes QQ High copy of , Support LAN and WAN at the same time , ...

  6. vue axios send out post request , The back-end receive parameter is null

    1 First of all, check whether your parameter transmission method is correct , I'm an object , No problem , The interface also triggers 2 I checked the information and said it was  Content-Type The problem of , Set to    'application/x-www-form-urlencod ...

  7. PYTHON- Process control if/while/for- practice

    # 1 Exercises ## Briefly describe the differences between compiled and interpreted languages , And list which languages you know are compiled , Which of them are interpretive # A compiled :C, Google Translate , After a translation, the result is reused # interpreted :Python, simultaneous interpretation , While executing, while ...

  8. Docker Command collection

    Docker Command collection 1. Delete all containers docker rm $(docker ps -a -q) 2. Delete all images docker rmi $(docker images -q) 3. Start the mirror doc ...

  9. ElasticSearch 2 (2) - Setup

    ElasticSearch 2.1.1 (2) - Setup Installation Elasticsearch can be started using: $ bin/elasticsearc ...

  10. 《Python stunt : Application Python Become a top hacker 》 use Python Conduct penetration tests

    1. Write a port scanner TCP Full connection scan . Grab the application's Banner #!/usr/bin/python #coding=utf-8 import optparse import socket from ...