Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of commands commonly used in uboot in Linux embedded

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

What is the use of commands commonly used in uboot in Linux embedded system? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Hey, everyone, the mage is here. Have you noticed a big change in the official Wechat account? yes, in the days when the mage didn't update, our beautiful and greasy little sister artist completed a large decoration for the maintenance official account. A classification and arrangement of the previous articles has been carried out to add new functions. Wait. Looking at such a beautifully decorated official account, we have to update the article. Today let's take a look at the common commands in uboot.

Before we talk about common uboot commands, let's introduce the concept of bootloader. What is bootloader? To put it simply, bootloader is a small program, a small bootstrap program that starts to execute from the time the system is powered on, initializes the hardware and prepares the software environment, and finally calls the system kernel. This is bootloader. The uboot we are talking about is contained in the concept of bootloader, which is a subset of bootloader.

After understanding this concept, we go into the uboot mode of the development board, that is, the control interface of uboot, where we can run a lot of commands. When using various commands, as long as a few letters at the beginning of the command replace him, such as fastboot, you can use fas instead, as long as other commands do not start with these commands.

Here are some common commands:

Help command help,?

Can we use help or? Check out all the commands supported in uboot, and you can also see what some commands do.

For example, we use it directly? To see what commands and commands are supported by uboot. As shown in the following figure:

Input? Echo looks at the specific function of the echo command in uboot, as shown below:

Printenv

The function of printenv is to print the value of the current variable. We enter printenv in uboot mode, or it can be simplified to pri, as shown in the following figure:

Now that we've come to this point, let's mention the common environment variables of uboot by the way.

Serial port download command

Uboot supports serial port download, we can use loady,loadx with HyperTerminal or other software to use. For example, we can use loady 0x4001000 to transfer files to the 0x40001000 address of the development board through the serial port. As follows:

Bootm

The bootm command can start the kernel. We can first read the kernel from the fat device to the appropriate location, and then directly use bootm [addr] to start the kernel. If our kernel has been read to 40008000, we can directly use bootm to start the kernel. As shown in the following figure:

Ping command

We can use the ping command to see if the network is connected properly. The command format is ping IP.

If the network is normal, print: 192.168.2.11 is alive

If the network is abnormal, print: 192.168.2.11 is not alive

Fatinfo command

We can use this command to view our fat devices, such as SD card information.

Command format: fatinfo

View the TF card information, as shown in the following figure:

Fatload command

Read the file from the appropriate fat device, command format: fatload [bytes]

Read the zImage file to the 0x40008000 of the board and start the kernel with the bootm command above. As shown in the following figure:

Memory operation command

Use the md command to print the value of memory.

Command format: mw [.b, .w, .l] address

Where .b.w.l means to operate in bytes, words, and double words.

From 0x40000000, print 2 from the low bit, whichever is 4 bytes, as shown in the following figure:

Use the cp command to copy the data.

Command format: cp [.b, .w, .l] source target count where .b.w.l means to operate in bytes, words, and double words.

Copy a byte from the starting address 0x40000000 to 0x40000001, as shown in the following figure:

Use mw to write data to memory.

Command format: mw [.b, .w, .l] address value [count] where .b.w.l means to operate in bytes, words, and double words.

Write 1 byte of FF to the address 0x40000000, as shown in the following figure:

Setenv

The setenv command can add or remove environment variables.

Add an environment variable named xunwei with a value of dianzi

Saveenv

Saveenv saves the environment variable. When we modify the environment variable, we have to save it with saveenv, otherwise it will not take effect.

Command format: saveenv environment variable

Reset

Restart the development board

Version

Print the version of uboot.

After reading the above, have you mastered what commands are commonly used in uboot in Linux embedded system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report