Analyze the compilation and burning of Linux kernel and device tree

Analyze the compilation and burning of Linux kernel and device tree

1. Prepare materials

You can prepare the corresponding materials according to your needs:

Development environment: VMware

Operating system: Ubuntu

Development version: PaiTu i2S-6UB

2. Download the Linux kernel file

Friends who have downloaded UBoot files before should know that there is a corresponding file in the information of each development version. If you don’t have it, you can ask the store where you bought the development version.

After downloading, copy the file to the Linux system and decompress it. The directory after decompression is as shown in the figure below:

Note: You must compile in the current path when compiling.

3. Compilation

1. Clean up project

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean

2. Set the default configuration file

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- i2som_imx6_defconfig

After the compilation is complete, ".config" will be generated, as shown below:

Note: The default configuration file of PaiTu is "i2som_imx6_defconfig". The default configuration files of different manufacturers are different. You can check them according to the corresponding documents. As described on the Paitu official website, as shown in the figure below

3. Compile and generate kernrl file

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage

4. Compile and generate .dtb file

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs

Note: At this point the compilation of the kernel and device tree is complete. If you are careful, you will find out why my command is longer. "ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-" is used in each instruction to set the compiler as a cross compiler. To make the compilation instructions more concise, you can add the configuration of ARCH and CROSS_COMPILE in the Makefile file. In the future, you can omit the "ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-" part in the command when compiling, as shown in the following figure:

5. Generate file path

zImage: in the /arch/arm/boot/ directory

dtb: in the /arch/arm/boot/dts directory

4. Burn zImage and .dtb files through TFTp

1. Put the zImage and .dtb files into the tftp server

2. Enter the command line of the development version of UBoot and configure the TFTP service address

setenv serverip 192.168.1.99

saveenv

3. Download the zImage file

tftp 80800000 zImage

4. Download the .dtb file

tftp 83000000 i2c6ulxb-i2s6ull-emmc.dtb

5. Start loading zImage and dtb files

bootz 80800000 - 83000000

6. Verify success

After the burning is completed, the compilation time will be printed when the kernel starts. If the time is correct, it means it is successful. The startup information is shown in the figure below:

5. Frequently Asked Questions

1. The errors that may occur when compiling and generating zImage are shown in the figure below:

This error is mainly because the development environment does not have the 'lzop' tool installed. You only need to install it and recompile it.

sudo apt-get install lzop

2. The startup is stuck at "Starting kernel ...", as shown below:

I don't know if there is a problem with the development I have or what, but as long as the compilation is correct, there will generally be no configuration errors if you change other files, so if you encounter this situation, just try again a few more times.

3. The system can be started as shown in the picture. The development version of PaiTu can also be updated by replacing files. After entering the development version of the system, follow the steps below.

mkdir /mnt/linux/

umount /mnt/linux/

mount /dev/mmcblk1p1 /mnt/linux/

cp i2c6ulxb-i2s6ull-emmc.dtb /mnt/linux/zImage-i2c6ulxb-i2s6ull-emmc.dtb; sync

umount /mnt/linux

reboot

The official tutorial is shown below:

4. After starting, you will find that it cannot start normally. This is because there is no root file.

The above is the detailed content of analyzing the compilation and burning of the Linux kernel and device tree. For more information about the compilation and burning of the Linux kernel and device tree, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Introduction to container of() function in Linux kernel programming
  • Analysis of Linux kernel scheduler source code initialization
  • Analysis of the use of Hongmeng light kernel static memory
  • Detailed explanation of kernel thread theory and examples in Java
  • An article shows you how to write kernels using C language

<<:  How to design a web page? How to create a web page?

>>:  How to use jsonp in vue

Recommend

Use CSS3 to implement button hover flash dynamic special effects code

We have introduced how to create a waterfall layo...

Full HTML of the upload form with image preview

The upload form with image preview function, the ...

5 issues you should pay attention to when making a web page

1. Color matching problem <br />A web page s...

Detailed explanation of Navicat's slow remote connection to MySQL

The final solution is in the last picture If you ...

Detailed explanation of how to detect and prevent JavaScript infinite loops

Table of contents Preface Fix infinite loop in fo...

How to remove the blue box that appears when the image is used as a hyperlink

I recently used Dreamweaver to make a product pres...

How to use MySQL group by and order by together

Suppose there is a table: reward (reward table), ...

How to build and deploy Node project with Docker

Table of contents What is Docker Client-side Dock...

Turn off the AutoComplete function in the input box

Now we can use an attribute of input called autoco...

Summary of the pitfalls of using primary keys and rowids in MySQL

Preface We may have heard of the concept of rowid...

Play with the connect function with timeout in Linux

In the previous article, we played with timeouts ...

About the role of meta in HTML (collected and sorted from the Internet)

W3Cschool explains it this way The <meta> el...

Detailed tutorial on installing Prometheus with Docker

Table of contents 1. Install Node Exporter 2. Ins...