Linux6.1.36_User’s Compilation Manual_V1.0
Document classification: □ Top secret □ Secret □ Internal information ■ Open
Copyright
The copyright of this manual belongs to Baoding Folinx Embedded Technology Co., Ltd. Without the written permission of our company, no organizations or individuals have the right to copy, distribute, or reproduce any part of this manual in any form, and violators will be held legally responsible.
Forlinx adheres to copyrights of all graphics and texts used in all publications in original or license-free forms.
The drivers and utilities used for the components are subject to the copyrights of the respective manufacturers. The license conditions of the respective manufacturer are to be adhered to. Related license expenses for the operating system and applications should be calculated/declared separately by the related party or its representatives.
Application Scope
This manual is mainly applicable to the Linux4.1.15 operating system on the Forlinx OKMX6ULL 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 |
Version |
Modification |
|---|---|---|
20/01/2022 |
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.

After the download is complete, double-click the installation file to start the installation program.
1.2 VMware Software Installation
Double-click the startup program to enter the installation wizard.

Click on “Next”.

Check the terms in the license agreement that I accept, then click “Next”.

Modify the installation location to the partition where you want to install the software on your computer, then click ‘“Next”.

Check and click on “Next”.

Check the box to add a shortcut, then click “Next”.

Click “Installation”.

Wait for the installation to complete.

Click “Finish” to try it out. If users need to use it for a long time, they need to buy it from the official and fill in the license.
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.

Select all the compressed packages and right click to extract them to MX6UL&MX6ULL-linux4.1.15-VM15.1.0-ubuntu18.04:

After the decompression is completed, as shown in the figure below:

The file “Ubuntu18.04 64-bit.vmx” in the MX6UL&MX6ULL-linux4.1.15-VM15.1.0-ubuntu18.04 folder is the file that needs to be opened by the virtual machine.
Open the installed virtual machine.

Navigate to the directory where the recently extracted MX6UL&MX6ULL-linux4.1.15-VM15.1.0-ubuntu18.04 virtual machine file is located, and double-click on the startup file to open it.

Turn on this virtual machine after loading is complete to run it and enter the system’s interface.

The development environment is: forlinx, and the password is: forlinx. After filling in the password, select Sign in to log in.


3. New Ubuntu Development Environment Setup
Note: 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.
This chapter mainly explains the process of setting up the Ubuntu system, installing the cross-compiler, and installing Qt Creator. If the user is not using Qt, the installation of Qt Creator can be ignored.
3.1 Ubuntu System Setup
3.1.1 Creating an Ubuntu Virtual Machine
Open the VMware software, click on create a new virtual machine. Enter the following interface

Choose custom, and click “Next”.

Select the compatibility with the corresponding version of VMware, which can be found in Help->About VMware Workstation, and click “Next”.

Select Install the operating system later and click “Next”.

Leave the default and click “Next”.

Modify the virtual machine name and installation location, click “Next”.


Again, set the memory size as appropriate.

Set the network type, the default is NAT mode, click Next. Keep the default values for the remaining steps until you reach the step to specify the disk capacity.

The default selection for the IO controller type here is LSI.

The default selection here is also SCSI.

Choose to create a new virtual disk here.

Set the disk size to 200 gigabytes and select the form in which the disk exists, then click “Next” to finish.

Specify the disk file, the default one here is fine.

Click “Finish” by default.

The virtual machine creation is now complete.
In the next section, we will introduce the installation of Ubuntu system in the virtual machine, which is similar to the installation method in the real machine. Here we describe the method of installing Ubuntu system in a virtual machine.
3.1.2 System Installation
The Ubuntu version chosen to install is 18.04. First, go to the official Ubuntu website to obtain the 64-bit image of Ubuntu 18.04. The download address is: http://releases.ubuntu.com/18.04/. Download the version: “ubuntu-18.04.5-desktop-amd64.iso”.

Right-click on the newly created Ubuntu 64-bit and select Settings from the pop-up menu.

The “Virtual Machine Settings Menu” pops up as shown below:

Click on CD/DVD (SATA), select “Use ISO image file,” browse and choose the previously downloaded Ubuntu image, then click “OK” to confirm.

After setting up the image, ensure that the network is available. Then, start the virtual machine and proceed with the installation of the Ubuntu image.

After starting the virtual machine, wait for the installation interface to appear as shown below.

After selecting the language on the left side as shown in the image, click “Install Ubuntu”, and the language selection interface will pop up. Ubuntu default language is English, of course, you can also choose others, the default choice of language in the later stage can also be reset,after selection then click continue.

Next, by default, select continue to finish the installation, the installation process will be very slow, then click “continue”:

Next, select continue by default to continue the installation, the installation process will be very slow, and then click “continue”:


Next, select the timezone. You can either click on the Shanghai timezone or enter “Shanghai” (or choose the appropriate timezone based on your location). Then, click “Continue” to proceed. Finally, set your username and password and click “continue” to automatically install the program:

The installation process is shown in the figure below, you can skip it if the network is bad, it will not affect the installation.

After the installation is completed, as shown in the following figure, click “Restart Now” (or click” Restart Guest “):

After the reboot, you need to log in with your username and password, and the system interface is shown below after logging in:


Above, the Ubuntu system installation is completed by the following figure configuration, click “OK”, and then re-open the virtual machine to see if you can start Ubuntu normally.

3.1.3 Basic Ubuntu Installation
After installing the Ubuntu 18.04 operating system, there are a few configurations to make.
VMware Tools Installation:
Next, install VMware Tools. Without installing this tool, you won’t be able to copy and paste and drag file between the Windows host and the virtual machine. First click on “Virtual Machines” on the VMware navigation bar, then click “Install VMware Tools” in the drop-down box.

Once done, enter Ubuntu and the VMware Tools CD icon will appear on your desktop, click into it:

Double-click on the VMwareTools icon, go to it and see a zip file VMwareTools-10.3.10-12406962.tar.gz (it may be different for different VM versions).

Copy the file under the home directory (i.e., the directory of the home personal username):


Press [Ctrl+Alt+T] to bring up the terminal command interface, and use the tar command to decompress the VMware tools installation package (using the sudo command will prompt for the password, according to the prompts directly enter the password enter can be used, Linux system password input does not show):
forlinx@ubuntu:~$ sudo tar xvf VMwareTools-10.3.10-12406962.tar.gz
[sudo] password for forlinx:
After executing the extract command, use ls to view the file directory vmware-tools-distrib, and go to the directory
forlinx@ubuntu:~$ ls
Desktop examples.desktop nfs snap tftp VMwareTools-10.3.10-12406962.tar.gz vmware-tools-distrib work
forlinx@ubuntu:~$ cd vmware-tools-distrib/ //Use the CD command to enter the directory
forlinx@ubuntu:~/vmware-tools-distrib$ ls //View the files in this directory
bin caf doc etc FILES INSTALL installer lib vgauth vmware-install.pl
In the current directory, enter sudo ./vmware-install.pl to install, enter the password after pressing Enter, and then start the installation. When you encounter yes, enter yes, and press Enter for the rest to install by default.
forlinx@ubuntu:~/vmware-tools-distrib$ sudo ./vmware-install.pl
[sudo] password for forlinx: //Enter the password of the forlinx account, no display, cannot see the input content.
The installation process information is long, here omitted.
open-vm-tools packages are available from the OS vendor and VMware recommends
using open-vm-tools packages. See http://kb.vmware.com/kb/2073803 for more
information.
Do you still want to proceed with this installation? [no] yes //Enter yes
... ...
After completing the VMware tools tool, you can achieve file copy and paste, virtual machine adaptive full display and other functions between Windows and Ubuntu. If the virtual machine cannot be displayed in full screen, you can click View, select Auto Resize, and click Auto Adapt to Client to display the virtual machine in full screen. VMware tools is installed successfully.

Basic Settings:
Make most of the system settings in the location shown below. A lot of the setup requirements on Ubuntu can be done here.

3.1.4 Ubuntu Network Settings
NAT Mode
Before using the network, make sure that our virtual machine can connect to the Internet, open the virtual machine settings, and change the network bridge mode in the network adapter to “NAT mode”:

When the VMware virtual NIC is set to NAT mode in a virtual machine, the network in the Ubuntu environment can be set to dynamic IP. The virtual NAT device and the host NIC are connected to communicate for Internet access in this mode. This is the most common way for our VM to get on the extranet.


The network is set to dynamic ip.

Bridge Mode:
If TFTP, SFTP and other servers are used, it is necessary to set the network connection mode of the virtual machine as bridging mode. When the VMware virtual NIC is set to bridge mode, the host NIC and the VM NIC communicate via a virtual bridge, which requires the Ubuntu IP to be set to the same network segment as the host IP.



Set the static IP. At this time, the Ubuntu IP and the host IP should be set in the same network segment.

Note: The IP and DNS involved in the network settings section should be set according to the user’s own actual environment, the manual is an example.
3.1.5 U Disk Loading
Open VM Settings, USB Controller, select USB 3.0 in Compatibility and “OK”. As shown in the picture below, since most computers nowadays support USB3.0 ports, if we don’t set it up, when we plug in the USB3.0 port, we can’t connect to the virtual machine. The principle is as follows:

After the virtual machine boot, insert the U disk, the virtual machine will be more in the lower right corner of the icon similar to the “U disk”, right-click –> connect, and then you can see in the file system to see more than a directory, that the U disk loaded successfully, as shown in the figure:


3.1.6 Required Library Installation
Before development, there are some other necessary libraries, we use the following commands to install them one by one, before installation, you need to ensure that the network can be used normally, you can get on the extranet:
forlinx@ubuntu:~$ sudo apt-get update // Update the information of download sources
forlinx@ubuntu:~$ sudo apt-get install build-essential // Provide the list information of software packages necessary for compiling programs
forlinx@ubuntu:~$ sudo apt-get install libncurses* // Used to generate text-based user interfaces
forlinx@ubuntu:~$ sudo apt-get install lzop // Compression and decompression tool based on the Lzo library
forlinx@ubuntu:~$ sudo apt-get install net-tools // Network configuration tools
3.2 Setting up A Cross-compilation Environment
The cross-compilation environment can be subdivided into installing the SDK (which contains the cross-compilation toolchain) and setting cross-compilation environment variables.
3.2.1 SDK Installation
Information/tool/fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa7hf-neon-toolchain-4.1.15-2.0.0.sh
Copy the above script to any directory like /home/forlinx/ and execute it there:
forlinx@ubuntu:~$ ./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-
cortexa7hf-neon-toolchain-4.1.15-2.0.0.sh
The command line prompts: Enter target directory for SDK (default): /opt/fsl-imx-x11/4.1.15-2.0.0)
Press the Enter key twice in a row, the program will automatically install the cross-compilation toolchain (the cross-compilation toolchain can be installed once, you don’t need to reinstall it when you change terminals or reboot the system). Make sure that the network is open during the installation process and that the Ubuntu system has access to an extranet.

You can determine whether the installation was successful by outputting the printed information.
3.2.2 Environment Variables Settings
Note:
After setting the environment variables, you don’t need to reset them the next time you compile as long as you don’t change terminals;
If you reopen a new terminal or switch accounts, you need to reset the environment variables before compiling.
The main purpose of setting up the compilation environment is to specify the target architecture and cross-compilation toolchain, as well as the paths of some libraries used in the compilation process, etc. Use the following commands to configure the compilation environment (.followed by a space):
. /opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-
poky-linux-gnueabi

Then use the command arm-poky-linux-gnueabi-gcc -v to determine if the setup was successful (note: -v is preceded by a space):
Normally the gcc version information is printed, gcc version 5.3.0 (GCC):

3.3 Qt Creator Installation
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 3.2.1 installation package selected for this installation:qt-creator-opensource-linux-x86_64-3.2.1.run. Copy the installation package to the path /home/forlinx/work/. Installation package acquisition site:https://download.qt.io/archive/qtcreator/3.2/3.2.1/
3.3.1 Modifying the QT Configuration File
After installing the SDK, modify the QT profile qmake. Conf.
Open the configuration file to be modified, the path of the file in the development environment is: /opt/fsl-imx-x11/4.1.15-2.0.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspe
cs/linux-oe-g++/qmake.conf
Remove the line include(…) from the file qmake.conf. /oe-device-extra.pri) line in the qmake.conf file.

Save and exit after making changes
3.3.2 Qt Creator Installation
Execute the following command in the/home/forlinx/work/path to install Qt Creator:
forlinx@ubuntu:~/work$ chmod u+x qt-creator-opensource-linux-x86_64-3.2.1.run
forlinx@ubuntu:~/work$ ./qt-creator-opensource-linux-x86_64-3.2.1.run
Then the installation window of the graphical interface will pop up, and install according to the instructions:


Users can set the installation path according to their own habits.
Execute the following command to open Qt Creator in the background, and users should follow their actual installation path when opening it:
forlinx@ubuntu:~$ /home/forlinx/qtcreator-3.2.1/bin/ qtcreator.sh &

The Qt Creator tool screen appears. Qt Creator is installed.
3.3.3 Environment Configuration
Note:
Be sure to configure the environment variables first (see “3.2.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.3.1 Configuration of the Cross-compiler
1. Click Qt Creator Tools ->Options->Build & Run->Compilers, and then click Add ->GCC;
2. Name enters GCC;
3. Compiler Path Click Browse to select the path of the cross-compiler as: /opt/fsl-imx-x11/4.1.15-2.0.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ As shown in the following figure:

4. Then click Apply and OK
3.3.3.2 Qt Versions Configuration
1. Click Qt Creator Tools ->Options->Build & Run->Qt Versions;
2. Then click Add, a pop-up dialog box to select the/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake;
3. Click open to add.

4. It will then return to the Qt Version configuration box, and the Version name will be entered in the Qt 5.6.2.

5. Then click “Apply and OK”.
3.3.3.3 Kits Configuration
Kits is a build kit for building and selecting development build environments useful for projects with multiple QT libraries. Add the previously added cross-compiler and QT Version to Kits to build a compilation environment suitable for the development board.
1. Click Qt Creator 的Tools ->Options->Build & Run->Kits,and then click Add; the configuration section appears;
2. Name input qt5.6.2;
3. Compiler selects GCC;
4. Qt Version Qt 5.6.2;
5. Qt mkspec write linux-oe-g++.

6. Then click “Apply and OK”.
3.3.4 Installation Issues
Note: The following presents some problems and solutions encountered during the installation of Qt Creator 3.2.1. The issues may differ depending on the Ubuntu and Qt Creator version used. The example below details one specific installation case, and serves only as a reference. Users should focus on their own actual situation and resolve any issues accordingly. 1. Opening Qt Creator appears qtcreator-3.2.1/lib/qtcreator/plugins/libHelp.so: Cannot load library /home/forlinx/qt; You cannot use help to report an error. You need to modify the software source and download and install some installation packages;
Method:
1) Add mirror sources to sources.list in etc/apt, use sudo vi /etc/apt/sources.list to open the file and add them at the end: deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse;
Inform Ubuntu to enable the new update source: sudo apt-get update
3) Install the relevant installation package:
sudo apt-get install libgstreamer0.10-dev
sudo apt-get install libgstreamer-plugins-base0.10-dev
2. Open the project file in Qt Creator with an ordinary account, and there is a write permission error;

Solutions:
1) Check if the original qt file, under the current account, has executable permissions;
2) Add writable permissions to the user group: sudo chmod -R o+w audio/.












