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

How to build embedded Linux Development Environment

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article shows you how to build an embedded Linux development environment, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

01

Introduction

Many engineers who do SCM development may have to learn Linux for various reasons, but many people have no way to start or give up many times halfway. Although there are a lot of relevant materials on the Internet, they are also fragmented and unsystematic. There is a great difference between Linux embedded development and ordinary bare metal single chip microcomputer development. This series of articles combined with my personal experience, stand on a complete beginner's point of view to do an arrangement for you, hoping to help you quickly get started with embedded Linux development. This is the first article in the series, which introduces the construction of the development environment.

one

02

Virtual machine installation

Because most of our engineers usually use the Windows system, so here is how to build the Linux environment under the Windows system. Of course, if you want to install the Linux system directly on a computer, it will not be introduced here. Windows systems usually need to install a virtual machine if they want to use Linux. At present, the most popular virtual machine is VMware, and there is also a VirtualBox, which everyone can choose between them. I use Vmware here. During the installation process, please refer to Baidu.

one

03

Installation of Ubuntu system under virtual machine

There are many Linux systems, such as Redhat,Centos, etc. At present, more Ubuntu is used. First, download a Ubuntu image file. I use ubuntu-16.04.3-desktop-amd64.iso here. After the download is completed, open the Vmware virtual machine to install the Ubuntu system. The relationship between Vmware and Ubuntu is that Vmware is a virtual machine, which can install not only the Linux system Ubuntu, but also the WinXP system. The specific process of this installation will no longer be described in detail, just refer to an article online, for example. This installation still takes some time. If you think the above step-by-step installation is too troublesome, you can download my installed system TopsemicUbuntu.zip directly, decompress it, then open VMwave and select Open a Virtual Machine.

Select the Ubuntu-Topsemic.vmx file in the TopsemicUbuntu folder

So Ubuntu will be opened directly, click the open button to boot, login password topsemic, boot can be used. Isn't it convenient? In fact, the file you just downloaded contains the following files after decompression.

If you install ubuntu-16.04.3-desktop-amd64.iso step by step as mentioned above, you will end up with these things, but there is an advantage of backing up this, in case the system crashes or changes your computer one day, you can just use this to avoid the trouble of reinstallation and configuration.

one

04

Familiar with command line operation

Once you enter the Ubuntu system, you can start your work. After the Ubuntu system comes in, there is a graphical interface, in which there are a variety of applications, such as you can open the browser on Baidu to have a look, feel similar to Windows.

Of course, you should be more familiar with command-line operations, because there is no graphical interface for many embedded devices running Linux systems, so you can only operate through the command line. Click the right mouse button and select Open Terminal (E), or the shortcut key Ctrl+Alt+t can open the command line window.

Let's familiarize ourselves with Linux commands with a practical small task. The functions we want to implement are:

1) go to the / home/topsemic directory, view the contents of this folder, and create two new folders, test1 and test2, under this folder.

2) create a new file named test1.txt under the test1 folder, and the content in it is welcome to topsemic.

3) display the contents of test.txt on the command line window

4) copy the test1.txt file to the test2 folder and rename it to test2.txt

5) change topsemic in test2.txt to Beijing, and save

6) Delete test2.txt file

7) Delete the entire test1 and test2 folder

The specific steps are as follows: 1) go to the / home directory and view the contents of this folder using cd and ls commands. / represents the root directory of Linux, and each file and directory starts from the root directory.

The mkdir directive is used to create test1 and test2 folders. After executing the mkdir, check it with ls and find that there are two more folders, test1 and test2.

Tip: when you type a command, be good at using the Tab key, for example, when you want to enter cd / home/topsemic, it is not necessary to type every character, you can hit the cd / home/ Tab key, so only need to type a Tab key, topsemic will come out. The tab key can be used to complete a command or file name. 2) create a new file called test1.txt, which contains welcome to topsemic. Here we use the vi instruction, which is too important to be proficient, but you may feel awkward at first, just be familiar with it. A) enter vi test1.txt first

Enter the following interface, this is the command line mode of vi, if you enter welcome, there is no response, to enter the content must first enter the text input mode.

B) enter I, enter text input mode, and then you can enter text. Press ESC after typing, return to command mode, type: (a colon) to enter trailing mode, and then type wq to save the file and exit.

3) display the contents of test.txt on the command line window, first, you can view it with vi, and you can also use the cat instruction to output directly to the terminal.

4) copy the test1.txt file to the test2 folder and rename it to test2.txt;. We use a cp directive

It's used here. Represents the parent directory of the current directory. 5) change the topsemic in test2.txt to Beijing and save it. Still use the vi command, but when you open vi, type I and then move the arrow → to the right of the keyboard, a C comes out. What's going on?

This problem has also perplexed me for a long time at the beginning, referring to this can be solved, but there is a problem because the vi key and backspace key are chaotic at this time, so it is difficult to change if you still use vi to open the change. To tell you a convenient method, first switch to the root user, use sudo su to enter the root user, the password is still topsemic

Then use gedit / etc/vim/vimrc.tiny to open the vimrc.tiny file and modify it as follows:

Gedit is a text editor similar to notepad under Windows.

Then switch back to the topsemic user and use su-topsemic

At this point, there will be no problem with using vi.

6) Delete the test1.txt file of the test2 folder and delete using the rm command

7) Delete test1 and test2 folders. Deleting folders is also a rm command, but follow-r. Direct rm test1 is not allowed.

-r: recursively delete files under the directory and files under the subdirectory.

Concluding remarks

Just contact with Linux will be very uncomfortable, so be sure to do more hands-on operation, and so familiar with it will feel very good to use. Finally, there is a question for you to think about. For example, I want to create a test1 folder in the / home directory, which will prompt me that I cannot create it and that I do not have enough permissions.

The above content is how to build an embedded Linux development environment. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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