Linux6.1.33_User’s Compilation Manual Initial Version_V1.0

Document classification: □ Top secret □ Secret □ Internal information ■ Open

Application Scope

This manual is mainly applicable to the Linux6.1.33 operating system on the Forlinx OK6254&OK6232&OK6231 platform. Other platforms can also refer to it, but there will be differences between different platforms. Please make modifications according to the actual conditions.

Revision History

Date

User Manual Version

Revision History

16/06/2024

V1.0

Initial Version

Overview

This manual is designed to enable you to quickly understand the compilation process of the products and familiarize yourself with the compilation methods of Forlinx products. The application needs to be cross-compiled on an Ubuntu host before it can run on the development board. By following the methods provided in the compilation manual and performing practical operations, you will be able to successfully compile your own software code.

The manual is mainly divided into four chapters:

  • Chapter 1. is mainly about the installation of VMware, and the version used is VMware® Workstation 15 Pro15.1.0. Users need to install VMware before using the ubuntu development environment;

  • Chapter 2. mainly introduces the method of loading the ubuntu development environment provided by Forlinx, and the development environment is 64-bit ubuntu18.04;

  • Chapter 3. mainly introduces the method of building a new ubuntu development environment. This section uses the 64-bit Ubuntu 18.04 as an example to describe the process of Ubuntu creation, cross-compiler installation, and QT Creator installation. Due to different computer configurations, unexpected problems may occur in the building process. It is recommended that beginners directly use the environment we have built;

  • Chapter 4. mainly describes the compiling method of the source code related to the development board, including the kernel source code compilation and the application program compilation.

1. VMWare Virtual Machine Software Installation

1.1 VMware Software Download and Purchase

Go to the VMware website https://www.vmware.com/cn.html to download Workstation Pro and get the product key. VMware is a paid software that requires purchasing, or you can choose to use a trial version.

Image

After the download is complete, double-click the installation file to start the installation program.

1.2 VMware Installation

Step 1: Double-click the startup program to enter the installation wizard, and click “Next”;

Image

Step 2: Check “I accept the terms in the license agreement (A)” and click “Next”;

Image

Step 3: You can modify the installation location, install it to the partition where your computer installs the software, and click “Next”;

Image

Step 4: Decide whether to check the two check boxes and click “Next”:

Image

Step 5: Check the option to add the shortcuts and click “Next”;

Image

Step 6: Click “Install”;

Image

Step 7: Wait for the installation to complete;

Image

Step 8: After installing it, you can click “Finish” for trial. If you need to use it for a long time, please buy it from the official and fill in the license. Go to the license activation page and enter the purchased license key.

Image

You can also click “Skip”. After completion, open the VMware software, click “Help” in the status card above, and enter the license key in the pop-up window.

Image

1.3 VMware Network Connection

By default, after the virtual machine is installed, the network connection method is set to NAT, which shares the host machine’s IP address. This configuration does not need to be changed when performing tasks like installing dependencies or compiling code.

In the virtual machine, when the VMware virtual network card is set to NAT mode, the network in the Ubuntu environment can be set to dynamic IP. In this mode, the virtual NAT device is connected to the host network card to communicate with the Internet. This is the most commonly used way for our virtual machine to access the external network.

2. Loading the Existing Ubuntu Development Environment

Note:

  • It is recommended for beginners to directly use the pre-built virtual machine environment provided by Forlinx, which already includes installed cross-compiler and Qt environment. After understanding this chapter, you can directly jump to the compilation chapter for further study;

  • The development environment provided is: forlinx (username), forlinx (password).

There are two ways to use a virtual machine environment in VMware: one is to directly load an existing environment, and the other is to create a new environment. Let’s first talk about how to load an existing environment.

First, download the development environment provided by Forlinx. In the development environment documentation, there should be an MD5 checksum file. After downloading the development environment, you should verify the integrity of the compressed package using the MD5 checksum. (You can use an on-line MD5 checksum tool or download a specific MD5 checksum tool for this purpose). To check if the checksum in the verification file matches the checksum of the file itself. If they match, the file download is successful. If they don’t match, it suggests that the file may be corrupt, and you should consider downloading it again.

Image

Select all compressed packages and right click to extract to OK62xx-linux6.1.33-VM_15_1_0-ubuntu18_04:

Image

OK62xx.vmx in the OK62xx-linux6.1.33-VM_15_1_0-ubuntu18_04 folder after decompression is complete is the file to be opened by the VM.

Open the installed virtual machine.

Image

Select the directory where the OK62xx-linux6.1.33-VM_15_1_0-ubuntu18_04 VM file you just unzipped and generated is located, and double-click to open the startup file:

Image

After loading, click to start the virtual machine to run. Enter the system’s interface.

Image

The provided development environment account is: forlinx and the password is: forlinx, fill in the password and select Sign in to log in.

Image

So far, it has successfully entered the development environment provided by Forlinx.

3. Building the Development Environment Manually

Ubuntu is a Linux operating system distribution primarily focused on desktop applications. Ubuntu has many advantages and offers its own strengths compared to other Linux distributions. First of all, installing the system is very easy, requiring very little setup, and is fully comparable to a Windows desktop system; secondly, the GUI is very user-friendly and mimics the shortcuts that are commonly used under XP; when installing and upgrading programs, you can install the dependent packages by the system itself through the network, so you don’t have to worry about the dependencies of the Linux system anymore. Considering everyone’s usage habits and learning needs, it would be a good choice to use Ubuntu Linux.

There are numerous versions of Linux desktop systems, and currently, all the Linux experiments and source code in this manual are performed on the Ubuntu 18.04 system. With other versions of Linux desktop systems, problems related to the gcc compiler and library files may occur. If you encounter similar issues, you can seek advice and inquire on the official forums of the Linux distribution vendor. If you are not familiar with Linux, the method introduced by Forlinx is highly recommended.

A Linux environment is needed for development work. Kernel source code, Qt applications, U-Boot, etc. can’t be compiled under Windows. These tasks must be carried out in a Linux environment. Since most users are used to the Windows environment, VMware software can be used to provide Ubuntu virtual machines. Of course, Linux can also be installed on your computer or server for development.

Next, the process of building the virtual machine will be introduced.

Note:

  • The memory of the virtual machine environment should be ≥ 8 GB and the hard disk should be ≥ 100 GB to ensure that the full compilation can be passed;

  • Beginners are not recommended to set up a system on their own. It is recommended to use an existing virtual machine environment. If you do not need to set up the environment, you can skip this section.

3.1 Ubuntu System Virtual Machine Installation

The version of Ubuntu we chose to install is 18.04, and the introduction and development in this maual are all carried out on Ubuntu 18.04. First go to the Ubuntu official website to get the Ubuntu 18.04 64-bit image, the download address is: http://releases.ubuntu.com/18.04/

Download “Ubuntu-18.04.6-desktop-amd64.iso” (you can download the version that you actually need; this is just an example with 18.04.6).

Image

3.1.1 Vmware Ubuntu Image Installation

If customers want to learn to build their own virtual machines, they can choose to install new virtual machines. However, if you don’t have a need for this, we recommend downloading the virtual machine we built to save time and avoid problems, as building a virtual machine is tedious and time-consuming.

Step 1: Open the VMware software and click on “Create New Virtual Machine”. Enter the following interface, check “Customize (Advanced)” and click “Next”:

Image

Step 2: Select the compatibility of the corresponding VMware version. The version can be viewed in Help-> About VMware Workstation. Click “Next” after confirmation:

Image

Select “Install program from disc image file”, then click “Next”;

Image

Enter full name, user name and password and click “Next”:

Enter the virtual machine name and configuration installation location, and click “Next”:

Image

To configure the number of cores, click “Next”:

Image

Configure appropriate memory space and select “Next”:

Image

Set the network type, use the default NAT form for networking, and click “Next”. Subsequent steps remain at their default values until the disk capacity step is specified.

Image

Use the recommended I/O controller, click “Next”:

Image

Use the recommended disk type, click “Next”:

Image

Use the default options, create a new virtual disk and click “Next”:

Image

Allocate a disk size of 80G and divide the virtual disk into multiple files, click “Next”:

Image

Click “Next” by default:

Image

Click “Finish”:

Image

After that, the virtual machine starts to install the image and wait patiently.

3.1.2 Solutions to VMware Errors

Error 1: Unable to connect to MKS: Too many socket connection attempts; giving up.

Image

Solution: Right click on my computer to manage services and application services, and turn on all services related to VMware. After the service has started successfully, restart the virtual machine; or hang the virtual machine first, wait for it to start, and then continue to run the hung virtual machine.

Image

Error 2: Internal error.

Image

Solution: Refer to error 1.

Error 3: Unable to install service VMware Authorization Service (VMAuthdService):

Image

Solution:

win+R

Input services.msc

Image

Then find the service and start it, because this service is the authorization and authentication service used to start and access the virtual machine.

Image

WMI must be started first

Image

Error 4: Failed to install the hcmon driver

Image

Solution: Delete C:\Windows\System32\drivers\hcmon.sys, then install again.

Error 5: Intel VT-x is disabled.

Image

Solution:

  1. Enter the BIOS interface when starting up the computer (press F2 or F12).

  2. Go to “Configuration” –> “Intel Virtual Technology” –> Change “Disabled” to “Enabled” –> Save the settings, exit and restart the computer.

  3. Re - open VMware and start the virtual machine.

If that doesn’t work, just turn the firewall off and reopen the VM. (varies by machine)

Error 6: The virtual machine appears to be in use… Acquiring Ownership (T)

Image

Solution:

  1. Shut down the virtual machine.

  2. Enter the storage directory of the virtual machine and delete the *.lck files. The “.lck” extension indicates locked files.

  3. Open the Windows Task Manager and terminate the VMware processes.

Image

  1. Restart the virtual machine.

Error 7: Failed to lock file.

Image

Solution:

  1. Enter the storage directory of the virtual machine.

  2. Delete the files with the extensions .vmem.lck, .vmdk.lck, and *.vmx.lck.

  3. Restart the virtual machine, and you should be able to enter it normally.

Error 8: The virtual machine could not be started because there was not enough memory available on the host.

Solution:

The virtual machine does not have enough memory to run the maximum requirement of the image. Increase the memory of the virtual machine and restart the virtual machine.

3.2 Ubuntu Common Software Installation

3.2.1 VScode

Click the icon similar to a package on the left side of the desktop to see some tools. We can also search for the tools we want. For example, we download a VScode tool, which is very convenient for our daily coding.

Image

Please search for the tool we need, click in to view details, click install to download, wait for the download to complete automatic installation, and then click “Launch” to run it.

Image

Image

Image

Image

3.2.3 NFS Installation

The terminal executes the following command:

forlinx@ubuntu:~$ sudo apt-get install -y nfs-kernel-server nfs-common portmap

Image

3.3 QT Environment Setup and Use

Qt Creator is a cross-platform QT integrated development environment (IDE) that includes advanced C + + code editors, project and build management tools for QT application framework design and application development. Qt Creator 5.14.2 selected for the installation.

The SDK provided by Forlinx provides a complete development environment for Qt5.14.2 (including Qt Quick).

3.3.1 Qt Creator Environment Setup

  • Path: OK62xx (Linux) user profile\tools\qt-opensource-linux-x64-5.14.2.run

    Copy qt-opensource-linux-x64-5.14.2.run to any directory in the current user’s home directory and execute it:

forlinx@ubuntu:~/62xx$ chmod 777 qt-opensource-linux-x64-5.14.2.run
forlinx@ubuntu:~/62xx$ sudo ./qt-opensource-linux-x64-5.14.2.run

The following interface will pop up. Click “Next” to enter the next step:

Image

Click “Next” to go to the next step:

Image

In the following screen, click “Browse …” Select the installation path of Qtcreator, and then click “Next” to enter the next step:

Image

In the following interface, select the first item and click “Next” to enter the next step:

Image

Image

Agree to the agreement and click “Next”:

Image

Image

Click “Install” to install:

Image

After the installation is completed, the following interface will be displayed. Uncheck the option “Launch Qt Creator” “and click” Finish “to complete the installation steps of Qt Creator:

Image

Enter the qtcreator actual installation directory/home/forlinx/Qt5.14.2/Tools/QtCreator/bin/directory:

forlinx@ubuntu:~$ cd /home/forlinx/Qt5.14.2/Tools/QtCreator/bin/

Start Qt Creator:

forlinx@ubuntu: ~/62xx/qtcreator-5.14.2/Tools/QtCreator/bin $ sudo ./qtcreator
[sudo] password for forlinx: forlinx          //Enter the password for the forlinx user, no display
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'

Image

The Qt Creator tool screen appears. Qt Creator is installed.

3.3.2 Environment Configuration

Note:

  • Be sure to configure the environment variables first (see “4.3.2 Environment Variables Setting”), then open the Qt Creator with the command;

  • Open Qt Creator according to your actual installation path.

Qt is a cross-platform graphics development library, which supports many operating systems. Before compiling, you need to configure the compiling environment of Qt Creator.

3.3.2.1 Configuration of the Cross-compiler

Start Qt Creator, and the Qt development interface will appear. Click Tools- > option:

Image

Enter the Options interface, click “Kits” on the left, then click the “Compilers” tab on the top of the middle, and click “Add-> GCC-> C + +” on the right, as shown in the figure:

Image

The following window will pop up. Click “Browser” in the “Compiler path” option. In the SDK package, navigate to /opt/arago-2023.04/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux and find “aarch64-oe-linux-g++”. After selecting it, click “Open”, and change the “Name” to “G++”.

Follow the same method to add GCC compiler, click “Add->GCC->C” on the right side, as shown in the figure:

Image

Find “aarch64-oe-linux-gcc” under /opt/arago-2023.04/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux in the SDK package. Select it, click “Open”, and change the Name to “GCC”.

Image

3.3.2.2 Debuggers Configuration

Click the Debuggers, the following interface will pop up, and then click “Add”:

Image

The following window will pop up. In the SDK package, go to /opt/arago-2023.04/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux and find “aarch64-oe-linux-gdb”. After selecting it, click “Open” and change the “Name” to “debuggers”.

Image

3.3.2.3 Qt Version Configuration

Click the Qt Versions tab and click Add:

Image

In the directory /opt/arago-2023.04/sysroots/x86_64-arago-linux/usr/bin, find qmake. After selecting it, click “Open”. After adding it, the following display will appear. Then click “Apply”.

3.3.2.4 Kits Configuration

Click on the “Kits” tab, then click “Add” on the right - hand side to add a new kit. Modify it according to the content in the following figure and click “Apply”.

Image

Note: After configuring Kits, there is a yellow exclamation mark in front of it, indicating that there is a warning, but it does not affect the use. If you want to know what the warning is, you can put the mouse over the yellow exclamation mark.