Super classic! Engineer embedded Linux self-study notes and experience

For the majority of friends who are new to beginners, the following are some of the information I have compiled in the process of getting started with the embedded learning. I hope I can help you.

A typical desktop Linux system consists of three main software layers -- the linux kernel, the C library, and the application code.

The kernel is the only layer that has full control over the hardware, and the kernel driver represents the session between the application and the hardware. Above the kernel is the C library, which is responsible for converting the POSIX API to a form that the kernel can recognize, then calling the kernel to pass parameters from the application to the kernel. Applications rely on the driver kernel to accomplish specific tasks.

When designing an embedded application, it is not possible to follow the hierarchy, the application crosses the C library directly with the kernel session, or bundles the application with the kernel, or even writes the application as a thread of the kernel and runs in the kernel. Although this brings difficulties in porting, it is completely feasible to consider the small size requirements of embedded systems. However, we use the three-layer software structure mode to learn embedded linux will be more clear, simple and feasible, and flexible.

Quick start

The easiest way to build an embedded Linux application is to start with the desktop Linux we use, install a favorite version, and use one of our applications as part of the initialization, and the framework is complete.

Of course, the embedded linux application is far more specific than our desktop version. It may be a terminal for Football Lottery, or a digital audio player. These systems only need a serial port in addition to the embedded CPU. A small number of input and output interfaces such as network ports can complete their specific applications.

In software, it can consist of a three-tier concept consisting of a kernel loader, a custom kernel, and fewer statically connected applications designed for specific tasks. The reason why statically connected applications are used is because the storage space required by a small number of static linkers is smaller than the space occupied by the same number of dynamically connected programs. This balance point needs to be obtained in actual development. Maybe you are designing a PDA with more applications, so you are likely to use a dynamic linker to reduce storage space. In your /bin or /sbin directory, use the factory list to see bash, ifconfig, vi..., maybe only a few dozen K, when you run ldd /bin/bash, you will see them all The library files are connected. Ok, so it seems that we have to imagine the PC as an embedded hardware platform, and then re-create a specific function of embedded Linux.

Basic knowledge

Before you do the actual operation, let's figure out a few basics.

The kernel loader Loader, which is used to move the kernel from external storage to memory. It only does this. Once the work is loaded into the kernel, the Loader jumps to the kernel location and begins execution. Different architectures have different Loaders. On x86-based PCs, the commonly used loaders are LILO, GRUB, syslinux, and syslinux work in embedded linux. In other non-x86 architecture applications, you must use a dedicated loader or write your own loader to load the kernel. There are also cases where the loader is not used. After the system is powered up, the kernel executes directly from the flashed image.

The kernel, once the kernel starts executing, will initialize all the hardware through the driver, which can be seen from the output of our PC monitor, and each driver prints some information about it. Once the initialization is complete, the computer is ready to run the embedded application. Maybe one, maybe multiple applications make up an embedded application, but usually the first call is init (input=/program can be customized to the kernel to load the program that runs first). In desktop linux, init reads the /etc/inittab file to determine the execution level and which scripts and commands. In embedded applications, you can decide whether to use the standard init execution mode according to the actual situation. Perhaps this init is a static program that can complete the specific tasks of our embedded application, so you don't have to consider inittab at all.

Initrd file system, initrd loads a small file system with the same mechanism that loads the kernel from storage media into memory. This file system is preferably stored on the media in a compressed manner and decompressed onto a RAM disk. By using initrd, a small file system containing core drivers and startup scripts, you can boot directly from the media and the kernel. The kernel compresses the file system and executes a script file called /linuxrc on the file system. The drivers required during the boot process are usually loaded. After the script exits, the initrd file system is also removed and the boot process goes into the actual initialization process. For embedded, you can run the required application software on this initrd file system. As long as the /linxrc file does not end, the rest of the kernel boot process will not continue.

Do an experiment:

Cp /boot/initrd-2.4.20.img /tmp

Cd /tmp

Mv initrd-2.4.2-.img initrd.img.gz

Gunzip initrd.img.gz

Mount -o loop initrd.img /mnt

Cd /mnt

Ls

Cat linuxrc can be seen inside the operation of loading two modules, you will see the screen print information when you start linxu.

  • If screen damaged during shipping or delivery, please contact us freely and we will help to replace a new one for you.
  • Used to fix faulty LCD display screen.(display problem, not responding properly, distortion pixels, wrong color issue and old LCD)

Features:

         · 12 Months warranty.

        · High brightness, polarizer screen.

        · Fully test the appearance, frame, flex cable, touch function and dead pixels/ dust/ lines before Shipment. 

        · Inner Package: Anti-Static Bags & Transparent Air Bubble Bags ; Outer Package: Carton Box Also In Lined With Foam;

Pre & After-sale service: 

· Please feel free to contact us for any questions at any time.




iPhone 8/8Plus LCD Digitizer

IPhone 8 Plus Touch Display,IPhone 8 Plus Display Glass,IPhone 8 Screen Replacement,IPhone 8 LCD Touch Screen,IPhone 8 Replacement

Shenzhen Aokal Technology Co., Ltd. , https://www.aokal.com

This entry was posted in on