Embedded entry-cross compilation, bootloader, kernel, root file system relationship

In actual work, when you get a chip, the chip manufacturer will generally provide you with cross-compilation environment and bootload, while the kernel and root file system need to be adjusted according to your needs, and finally you need to write the application.

Therefore, in actual work, it is generally not necessary to work hard on the cross-compilation environment and bootloader.

The kernel needs to be tailored to adapt to our chips, boards, and functions. Let me give a simple example: the linux system can adapt to the x86 architecture of the notebook, or other architectures such as arm. If both are suitable, it will be particularly bloated , so we only need to adapt to one architecture to configure it.

For another example, if we want to develop a device that needs to be able to connect to a camera, we need a camera driver in the kernel and a corresponding application in the root file system. Therefore, in actual work, we often work hard on the kernel and root file system.

So if you want to go to a chip-level company, the focus is on the cross-compilation environment and bootloader. If you are a product-level company, the focus is on the kernel and root file system.

References:

Cross compilation, bootloader, kernel, root file system relationship

Let's introduce it in a little detail

In fact, the composition of the embedded system can be summarized by these four things

Cross-compilation environment, bootloader, kernel, root file system, applications belong to the top layer and can also be regarded as part of the root file system

1. Cross-compilation environment

Cross-compilation is the generation of executable code on one platform on another platform.

Cross-compilation requires the use of a cross-compiler and a cross-compilation toolchain.

To perform cross-compilation, we need to install the corresponding cross-compilation tool chain (cross compilation tool chain) on the host platform, and then use this cross-compilation tool chain to compile our source code, and finally generate code that can run on the target platform. Common cross-compilation examples are as follows:
1. On Windows PC, use ADS (ARM development environment) and armcc compiler to compile executable code for ARM CPU.
2. On a Linux PC, use the arm-linux-gcc compiler to compile executable code for the Linux ARM platform.
3. On a Windows PC, use the cygwin environment to run the arm-elf-gcc compiler to compile executable code for the ARM CPU.

2.bootloader

You have to look at this word separately, one is boot, start, start the board, and the other is load, load, load the kernel.

It is the first program that needs to be executed after a hardware reset. The main job is to initialize the environment in which the operating system runs, such as memory, timers, etc.

Taking ARM as an example, the startup code needs to do some work: set the interrupt vector table, turn off the watchdog, initialize the clock, initialize SDRAM, code relocation, jump to the main function execution, etc.

So the main difference between the start.s assembler written by ourselves and the bootload is actually less, load loading. Of course, the bootload can also have many other functions.

We can write a bootloader by ourselves, but it is not necessary, there are many excellent bootloads for us to choose, such as: uboot, read boot

3. kernel

Kernel, not much to say, don't try to read the kernel source code completely, you won't be able to finish it in a few years. If there is a need to go deeper, the kernel mainly performs resource management, process scheduling, etc. You can also understand it as an intermediate interface, just like a library function, the underlying driver registers with the kernel, and the upper-layer application calls the kernel.

4. Root file system

At the end of the Linux kernel startup, it needs to be mounted on a file system. This is a feature of Linux. The underlying layers of the QT system, Android system, and Ubuntu system are all Linux kernels. The difference is that their file systems are different. That is to say, some codes related to the Android system, such as the graphical interface system, the Android virtual machine, and the Android framework code are all in the file system where Linux is finally mounted.

He can be understood as responsible for interaction, whether it is interaction with people or interaction with programs.

Guess you like

Origin blog.csdn.net/freestep96/article/details/126860239