You may know that Ubuntu is a popular Linux distribution that can run on a variety of personal computers and servers, providing a friendly user interface and rich software packages. But, did you know that Ubuntu can also run on ARM-based devices? The ARM architecture is a low-power, high-performance processor design that is widely used in smartphones, tablets, Raspberry Pi and other devices. Ubuntu ARM Linux is a version of Ubuntu specially customized for ARM architecture devices. It allows you to enjoy the advantages and features of Ubuntu on these devices. This article will introduce the main features, installation methods and usage tips of Ubuntu ARM Linux, so that you can easily use Ubuntu on ARM architecture devices.
Installation Environment
First of all, let’s briefly introduce the so-called building a cross-compilation environment, that is, installing and configuring the cross-compilation tool chain. In this environment, the operating system, applications, etc. required for the embedded Linux system are compiled, and then uploaded to the target machine.
The cross-compilation tool chain is for compiling, linking, processing and debugging program code for cross-platform architectures. For cross-development tool chains, a prefix is added to the file name to distinguish the local tool chain. For example, arm-linux- means a cross-compilation tool chain for arm; arm-linux-gcc means a compiler using gcc. In addition to the architecture-related compilation options, its usage is the same as gcc on the Linux host, so Linux programming technology is also applicable to embedded. However, not any version can be used, and various software packages often have version matching problems. For example, when compiling the kernel, you need to use the arm-linux-gcc-4.3.3 version of the cross-compilation tool chain. If you use the arm-linux-gcc-3.4.1 cross-compilation tool chain, the compilation will fail.
So what is the difference between gcc and arm-linux-gcc? The difference is that gcc is a C language compiler under Linux, and the compiled program is executed locally, while arm-linux-gcc is a cross-platform C language compiler under Linux, and the compiled program is executed on the target machine (such as ARM platform) ), embedded development should use the embedded cross-compilation tool chain.
Store the compressed package arm-linux-gcc-4.4.3.tar.gz in a directory. This directory is the directory you will decompress later. This directory cannot be deleted casually in the future. My storage path It is /home/song/software, as shown below. Remember this path, you will use it later.
Use the tar command: tar zxvf arm-gcc-4.4.3.tar.gz to decompress and install arm-linux-gcc-4.4.3.tar.gz in the software folder to the current directory as shown below
You can see from the picture below that the decompression is successful, and the decompressed files are stored in the /home/song/software/opt/FriendlyARM/toolschain/4.4.3 folder, as shown in the picture below, this storage path can be remembered ,As shown below
Next, configure the system environment variables and add the path of the cross-compilation tool chain to the environment variable PATH, so that these tools can be used in any directory. Note down the installation path in the previous step, use the command: vim /etc/profile to edit the profile file and add environment variables.
Add the last line in the profile: export PATH=$PATH:/home/song/software/opt/FriendlyARM/toolschain/4.4.3/bin. This path is the path where the bin directory is located. Yours may be different. According to your actual situation Just fill in the directory, as shown in line 32
as shown below
Just save it after writing
Use command: source /etc/profile to make environment variables effective
Enter the command arm-linux on the terminal and press the Tab key. You can see the following picture, indicating that the environment variable is set successfully
Use the command: arm-linux-gcc -v and the following error message will appear: /home/song/software/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-gcc: 15: exec: / home/song/software/opt/FriendlyARM/toolschain/4.4.3/bin/.arm-none-linux-gnueabi-gcc: not found
This means that the reason for this problem is that Ubuntu 12.04 uses 64-bit. The solution is to use the command: sudo apt-get install ia32-libs to install some 32-bit libraries.
After installing the 32-bit library, use the command: arm-linux-gcc -v. This time it is successful, as shown below
Verification, compile a hello.c file
Use the command: arm-linux-gcc hello.c -o hello to see if the compilation is successful
It can be seen that the binary file was successfully generated.
Summarize
In fact, during the installation process, various errors will occur. Generally, the library file installation is incomplete. You can copy the error message directly and search it online. Generally, it can be solved. I hope everyone is learning Linux. Have a little more patience.
The above is the detailed content of Ubuntu ARM Linux: An excellent operating system for ARM-based devices. For more information, please follow other related articles on the PHP Chinese website!