How to Master Embedded Linux?

Follow and star our official account to access exciting content

How to Master Embedded Linux?

ID: Technology Makes Dreams Greater

Compiled by: Li Xiaoyao

As the saying goes, the beginning is always the hardest. When you first start, do you feel completely lost on how to begin? Searching online leads you to a pile of new terms that confuse you, and even going to the library doesn’t provide direction? With ARM, Linux, and U-Boot all mixed together, it can be overwhelming. Where should you start?

Let’s follow my journey of learning to design as an embedded engineer!

In simple terms, the learning path goes from basic ARM knowledge to bare-metal programming, from uCOSII to Linux, from basic Linux commands to shell programming, from U-Boot to file systems, and finally to Linux driver programming. The progression is from simple to complex, from basic to advanced.

01Phase One: Basics of Embedded Hardware and Bare-Metal Programming1. Knowledge Points:(1) Basic knowledge of ARM processors, operating modes, registers, interrupts and exceptions, addressing modes, assembly instruction set(2) Familiarity with the ADS integrated development environment in preparation for bare-metal programming(3) Bare-metal programming: LED, serial port, LCD, touchscreen, NAND flash, IIC, IIS, DMA, etc.2. Process and Purpose:This phase focuses on familiarizing oneself with embedded hardware to lay the foundation for future Linux driver development. Since the primary architecture for embedded systems is ARM, the learning is centered around ARM. First, learn the basics, then practice on development boards. The main resources used in this phase include:(1) “ARM Embedded Basics Tutorial” – This book mainly covers the fundamentals of ARM. Although it discusses ARM7, the basic instruction set and model are the same across ARM.(2) “Complete Manual for Embedded Linux Application Development” – This book mainly covers the S3C2410 interface module, which is necessary for hardware knowledge during bare-metal experiments.3. Time Required:Approximately two months.02Phase Two: Basics of Linux and Shell Programming1. Knowledge Points:(1) Basic knowledge of Linux(2) Installation and usage of Linux(3) Common Linux commands(4) Using vi(5) Simple shell programming2. Process and Purpose:This phase focuses on familiarizing oneself with Linux, including installation and basic operations. It is recommended to install Linux on a virtual machine at first, and for development boards, Fedora9 is recommended. Follow the accompanying instructions step by step and practice various commands.The main resource for this phase is “Bird Brother’s Linux Cookbook: Basic Learning Edition”. This book has an electronic version and doesn’t need to be read in its entirety; focus on the sections that describe basic Linux knowledge and commands. It’s not necessary to memorize all commands; you can look them up as needed later. The main goal of this phase is to gain an overall understanding of Linux, at least to know some basic concepts and perform basic operations.3. Time Required:Approximately one month.03Phase Three: Basic Development of Linux Applications1. Knowledge Points:(1) Basics of GCC, GDB, Make(2) File and time programming(3) Multi-process and multi-thread programming design(4) Inter-process communication2. Process and Purpose:This phase focuses on understanding the writing and debugging of Linux applications, which are also foundational knowledge, primarily aimed at familiarizing oneself with Linux. Understanding concepts related to application programming lays the groundwork for future development. The main resource for this phase is “Standard Tutorial for Embedded Linux Application Development”, which provides detailed explanations on writing applications in Linux and is not too difficult. The classic book “Advanced Programming in the UNIX Environment” is more in-depth and may be challenging at first, but starting with simpler materials is advisable. Learning application programming is essential for anyone working in the embedded Linux field.3. Time Required:Approximately one month.04Phase Four: Learning the uCOSII Operating System1. Knowledge Points:(1) Concepts and basic knowledge of embedded real-time operating systems(2) Reading the source code of the uCOSII operating system(3) Porting uCOSII(4) Application programming for the uCOSII operating system2. Process and Purpose:This phase focuses on understanding the basics of embedded real-time operating systems, as uCOSII is open-source and allows for code study. It provides an intuitive understanding of task scheduling and resource management in operating systems. Reading the source code can enhance programming skills and standardize coding habits. Although a ported version of uCOSII is provided, performing the porting process oneself leads to a deeper understanding.This operating system is relatively simple, so writing applications is crucial for understanding the system. The main resource for this phase is the book “Embedded Real-Time Operating System uCOS-II” translated by Shao Beibei, which provides detailed analysis of the operating system’s source code. After thoroughly understanding this book, one will have an in-depth understanding of uCOSII. The main goals of this phase are to learn about operating system concepts such as task scheduling, concurrency, and race conditions, as well as to improve programming skills. Reading the source code of an operating system is much more beneficial than reading a thousand books on operating principles.3. Time Required:Approximately one month.05Phase Five: Learning Bootloader1. Knowledge Points:(1) Basic knowledge of bootloaders(2) Basics and commands of U-Boot(3) Porting U-Boot2. Process and Purpose:The bootloader is an essential part of a Linux embedded system. This phase focuses on understanding the role of the bootloader and the general bootloader—U-Boot. Initially, learn to use various commands in U-Boot, then analyze the boot process of U-Boot, the Makefile, and the kernel loading process. Follow the steps provided by others to port the kernel, repeating the process to become familiar with it. After mastering U-Boot, independently complete the porting of U-Boot and make modifications. The main resources for this phase include the U-Boot porting reference manual that comes with the CD and various online articles. I find that there is a wealth of online resources for U-Boot porting.3. Time Required:Approximately one month.06Phase Six: Learning the File System1. Knowledge Points:(1) Types and functions of Linux file systems(2) Familiarity with the use of BusyBox and the Linux system startup process(3) Building your own root file system2. Process and Purpose:The file system is also an indispensable part of a Linux embedded system. This phase focuses on understanding the role and basic knowledge of the root file system, as well as building your own root file system. The main resource for this phase is “Building Embedded Linux Systems”, which details all elements of embedded Linux, including file systems. Here, I mainly focus on the file system section. I also refer to various online articles. First, familiarize yourself with basic Linux file systems, then learn to use BusyBox and the Linux startup process, and finally follow others’ steps to build your own file system.3. Time Required:Approximately half a month.07Phase Seven: Embedded Graphical User Interface (GUI)1. Knowledge Points:(1) Types and characteristics of embedded graphical user interfaces(2) Basic knowledge of MiniGUI(3) Porting MiniGUI and programming2. Process and Purpose:As the upper layer of embedded systems, understanding embedded graphical user interfaces is also necessary. I only studied MiniGUI because QT requires knowledge of C++, which I have not learned, so I focused on MiniGUI. The main goal of this phase is to familiarize myself with the development process of embedded graphical interfaces, as I do not plan to work on applications in the future.Just getting MiniGUI to run a hello program on the board is sufficient. There is no need to delve deeper. Through porting MiniGUI, I gained a new understanding of software and function libraries running on Linux, as well as the principles of program execution and compilers.3. Time Required:Approximately half a month.08Phase Eight: Basic Knowledge of Linux Driver Programming1. Knowledge Points:(1) Read “Linux Device Drivers” and focus on all chapters except for network drivers, tty drivers, and block drivers.(2) Experiment with all examples in the book, carefully analyze the results, and understand related knowledge points.(3) Even for examples, programming habits must be consistent, and documentation must be standardized.2. Process and Purpose:The purpose of this phase is to lay the foundation for Linux drivers. “Linux Device Drivers” (3rd edition), commonly referred to as LDD3, is the classic book on Linux drivers that must be read multiple times. The first reading may be difficult to grasp, but after several readings, it becomes clearer. After reading the book, experiment with the examples provided.3. Time Required:Approximately two months.09Phase Nine: Practical Linux Driver Development1. Knowledge Points:(1) Understand the registration and implementation of miscellaneous character devices through LED drivers, and master the IO operation process of MINI2440.(2) Master basic interrupt implementation methods through button driver programs.(3) Master PWM driver programming.(4) Understand the implementation of the input device model through touchscreen driver programs.(5) Master the design of ADC driver programs.(6) Master the design of watchdog and RTC driver programs.(7) Analyze the implementation of the platform device model through LCD driver programs.2. Process and Purpose:This phase focuses on mastering the implementation of simple driver programs and analyzing differences from LDD3, as well as analyzing some Linux subsystems. Through this phase, one can gain a deeper understanding of Linux driver programming and improve the ability to read large amounts of code. The main work in this phase involves reading code, experimenting, and learning through observation.3. Time Required:Approximately one month.10Phase Ten: In-Depth Understanding of the Linux Kernel and USB Subsystem ResearchAfter completing the first nine phases, I feel that I have entered the realm of embedded Linux. It is time to plan for the tenth phase. This phase will help determine my future direction. Since USB is a standard interface in embedded systems, learning about USB is highly competitive. Those working on drivers should have a certain understanding of the kernel, so “Understanding the Linux Kernel” is essential.This phase mainly involves studying the USB protocol, reading the entire code of the Linux USB subsystem, deepening the understanding of USB through code reading, and then familiarizing oneself with various USB class protocols, as well as writing and porting USB drivers. USB is the direction I have chosen because I believe that focusing on one area is more effective than trying to do everything. Therefore, I have decided to pursue a career related to USB in embedded systems. This phase of learning is currently ongoing, and I am exploring the vast code of the Linux USB subsystem.

How to Master Embedded Linux?

Scan the WeChat below, add the author's WeChat to join the technical exchange group, and please introduce yourself first.

Recommended Reading:

Embedded Programming Collection
Linux Learning Collection
C/C++ Programming Collection
Qt Advanced Learning Collection
Follow the WeChat official account "Technology Makes Dreams Greater" and reply "m" in the background to see more content.

Long press to go to the WeChat account included in the image to follow.

Leave a Comment