Linux5.10.198_User’s Compilation Manual_V1.0

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

Revision History

Date

User Manual Version

Revision History

29/04/2024

V1.0

OK3562 User’s Compilation Manual (Version 1.0).
Note: This compilation manual is only applicable to the OK3562 development board.

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 program needs to be cross-compiled on the Linux operating system before it can run on the development board. According to the method in the compilation manual, users can compile their own software code through practical operation.

The manual will provide instructions for setting up the environment but there may be some unforeseen issues during the environment setup process. For beginners, it is recommended to use the pre-configured development environment provided by us. This will allow you to quickly get started and reduce development time.

Linux systems are typically installed in three ways: dual system on a real machine, single system on a real machine, and virtual machine. Different installation methods have their advantages and disadvantages. This manual only provides methods to build ubuntu in a virtual machine.

Hardware requirements: It is recommended to have at least 16GB of memory or more, so that you can allocate some memory to run the virtual machine (the virtual machine is recommended to have more than 8GB) and still do other operations on Windows, otherwise it will affect the performance of Windows.

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.5.6. Please 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 ubuntu20.04;

  • Chapter 3. mainly introduces the method of building a new ubuntu development environment; it uses 64 bit Ubuntu 20.04 as an example to describe the creation process of Ubuntu. Due to different computer configurations, unexpected problems may arise during the setup process. It is recommended for beginners to use the environment that we have set up directly;

  • Chapter 4. mainly introduces the methods of compiling the source code related to the development board.

A description of some of the symbols and formats associated with this manual:

Format

Meaning

Note

Note or information that requires special attention, be sure to read carefully.

📚

Relevant notes on the test chapters

🛤️

Indicates the related path

Blue font on gray background

Refers to commands entered at the command line (Manual input required).

Black font on gray back ground

Serial port output message after entering a command

Bold black

Key information in the serial port output message

//

Interpretation of input instructions or output information

Username@Hostname

root@ok3562: development board serial port login account information;
forlinx @rk3562: development board network login account information;
forlinx @ Ubuntu: development environment Ubuntu account information.
You can determine the environment for function operation through this information.

Example: After packaging the file system, use ls to view the operation of the generated file.

forlinx@ubuntu:~/work$ ls                           //List the files in this directory
OK3562-linux-source  OK3562-linux-source.tar.bz2
  • forlinx@ubuntu: the username is forlinx and the hostname is ubuntu, indicating that the operation is performed in the development environment ubuntu;

  • // : Explanation of the instruction, no input required;

  • ls: Blue font on a gray background indicates the relevant commands that need to be entered manually;

  • OK3562-linux-source: Black font is the output information after entering the command; bold font is the key information; here is the packaged file system.

1. VMware Virtual Machine Software Installation

This chapter mainly introduces the installation of VMware virtual machines, using VMware Workstation 15 Pro v15.5.6 as an example to demonstrate the installation and configuration process of the operating system.

1.1 VMware Software Downloads 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 Software Installation

Double-click the startup program to enter the installation wizard.

Image

Click on “Next”.

Image

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

Image

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

Image

Check and click on “Next”.

Image

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

Image

Click “Installation”.

Image

Wait for the installation to complete.

Image

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 for general users is: forlinx (username), forlinx (password). The superuser is: root (username), root (password);

  • Please ask your sales representative for the download link.

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. First talk about how to load an existing environment.

First, download the development environment provided by Forlinx. There is an MD5 verification file in the development environment data. After downloading the development environment data, first performs MD5 verification on the compressed package of the development environment (the tool for viewing the MD5 code on windows: 02-User Data \ Software Data \ 04-Tool \ md5sums-1.2.zip). Check whether the verification code is consistent with the verification code in the verification file. If they are consistent, the downloaded file is normal; otherwise, the file may be damaged and needs to be downloaded again.

Image

Select all compressed files, right-click and extract to the current folder or your own directory:

Image

After unzipping, you will get the folder “3568 Development Environment”.

Note: The Ubuntu 22.04 development environment for 3562 and 3568 is the same.

The file 3568. vmx in the 3568 Development Environment folder is the file that the virtual machine needs to open.

Open the installed virtual machine.

Image

Select the directory where the newly decompressed “3568. vmx” file is located, double-click to open the startup file.

Image

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

Image

The default login account for automatic login in the development environment is “forlinx”.

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 and installing Qt Creator. If the user is not using Qt, the installation of Qt Creator can be ignored.

3.1 Ubuntu System Setup

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

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

Image

3.1.1 Ubuntu Virtual Machine Setup

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”:

Image

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

Image

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

Image

To configure at least 8GB of memory, select ‘’Next’’:

Image

Set the network type, use the default NAT form for networking, and click “Next”. Keep the default values for the remaining steps until you reach the step to specify the disk capacity.

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 200G and divide the virtual disk into multiple files, and click “Next”:

Image

Click “Next” by default:

Image

Click “Finish”:

Image

Image

The virtual machine creation is now complete.

Then click “Open this virtual machine” to start installing the image and wait patiently.

The ubuntu system installation is complete.

3.1.2 Ubuntu Basic Configuration

3.1.2.1 VMware Tools Installation

VMware Tools will be installed automatically after the virtual machine is created. If it is not successful, follow the steps below.

If you do not install the tool, you cannot use copy-paste file drag and drop between the Windows host and the virtual machine.

First click on “Virtual Machine” on the VMware navigation bar, then click “Install VMware Tools” in the drop-down box.

Image

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

Image

Enter and see a compressed 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 with the home personal username)

Image

Press [Ctrl+Alt+T] to bring up the Terminal Command Interface and enter the command:

forlinx@ubuntu:~$ sudo tar xvf VMwareTools-10.3.10-12406962.tar.gz

Image

After the extraction is complete, a file named “vmware-tools-distrib” will appear.

Image

Go back to the terminal and type cd vmware-tools-distrib to enter the directory.

Enter: sudo ./vmware-install.pl followed by pressing Enter. Then, enter your password and the installation process will begin. When prompted, you can input “yes” and press Enter to proceed. For any other inquiries, simply press Enter to go with the default installation settings.

Image

Once the VMware tools is complete, we can implement file copy and paste between Windows and Ubuntu.

3.1.2.2 Virtual Machine Full Screen Display

If the virtual machine is not able to be displayed in full screen, you can resolve this issue by clicking on “View” and selecting “Autofit Guest.” This will adjust the display to fit the screen automatically, enabling you to have a full-screen experience in the virtual machine.

Image

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

Image

3.1.2.3 Virtual Machine Hibernation Settings

Also, the default hibernation is 5min, if you don’t want to set hibernation, just set it to Never by setting Power->Blank screen.

Image

3.1.3 VM Swapfile Settings

The memory allocated when creating the virtual machine is 8GB. If the 8GB memory is not enough during compilation, the size of the swapfile needs to be modified.

forlinx@ubuntu:~$ sudo swapoff /swapfile
forlinx@ubuntu:~$ sudo dd if=/dev/zero of=/swapfile bs=1M count=16384
forlinx@ubuntu:~$ sudo mkswap /swapfile
forlinx@ubuntu:~$ sudo swapon /swapfile

3.1.4 Virtual Machines Network Settings

3.1.4.1 NAT Connection Method

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.

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. In this mode the virtual NAT device and the host NIC are connected to communicate for Internet access. This is the most common way for our VM to access the external network.

Image

3.1.4.2 Connections for Bridges

When the VMware virtual NIC device is in bridge mode, the host NIC and the virtual machine NIC communicate through the virtual bridge, and the network IP and the host need to be set in the same network segment in the Ubuntu environment. If accessing an external network, you need to set the DNS to be consistent with the host NIC. If TFTP, SFTP and other servers are used, the network contact mode of the virtual machine needs to be set as the bridge mode.

Image

3.2 Toolkit Installation

To install the necessary toolkit for compilation, please execute the following command to install it, and make sure that the network can be used normally and you can access the external network before installation:

forlinx@ubuntu:~$ sudo apt-get update
forlinx@ubuntu:~$ sudo apt-get install openssh-server vim git
fakeroot make automake autoconf libtool libssl-dev bc dosfstools mtools parted iproute2 kmod libyaml-dev device-tree-compiler
python-pip flex bison build-essential u-boot-tools libncurses-dev
lib32stdc++6 lib32z1 libc6:i386 e2fsprogs scons libgmp-dev libmpc-dev

3.3 Qt Creator Installation

Path: 02-User Information\01-Software Information\04-Tools\qt-opensource-linux-x64-5.12.9.run

Copy qt-opensource-linux-x64-5.12.9.run to any directory under the home directory of the current user, and execute:

forlinx@ubuntu:~$ chmod 777 qt-opensource-linux-x64-5.12.9.run
forlinx@ubuntu:~$ ./qt-opensource-linux-x64-5.12.9.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 interface, click “Browse…” to select the installation path of Qtcreator, after the selection is complete, click “Next” to enter the next step:

Image

In the following screen, click “Next” to the next step:

Image

Agree to the agreement and click “Next”:

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

Go to the /home/forlinx/Qt5.12.9/Tools/QtCreator/bin/ directory of the actual qtcreator installation directory:

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

Start Qt Creator:

forlinx@ubuntu: ~/Qt5.12.9/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.4 Qt Compilation Environment Configuration

Path: 02-User Information\01-Software Information\04-Tools\aarch64-buildroot-linux-gnu_sdk-buildroot.tar.gz.

The aarch64-buildroot-linux-gnu_sdk-buildroot.tar.gz contains the libraries and cross-compilation tools needed to compile Qt programs, configured as follows:

1. Unzip the compilation environment zip;

Because the qmake tool depends on local paths, this toolkit can only be placed in a fixed path: /opt/.

Unzip the tool kit

forlinx@ubuntu:~$ sudo tar -xf aarch64-buildroot-linux-gnu_sdk-buildroot.tar.gz -C /opt/
forlinx@ubuntu:~$ cd /opt/aarch64-buildroot-linux-gnu_sdk-buildroot
forlinx@ubuntu: /opt/aarch64-buildroot-linux-gnu_sdk-buildroot $ sudo ./relocate-sdk.sh

2. Qt Creator environment configuration;

First open the Qt Creator software.

Execute:

Enter the qtCreator actual installation directory/home/forlinx/Qt5.12.9/Tools/QtCreator/bin/directory:

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

Start Qt Creator:

forlinx@ubuntu: ~/Qt5.12.9/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'

Start the Qt Creator program and click on the Tools->option:

Image

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

Image

Find “aarch64-linux-g + +” under/opt/aarch64-buildroot-linux-gnu _ sdk-buildroot/bin, select it, click Open, and modify the Name.

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

Image

Find “aarch64-linux-gcc” under opt/aarch64-buildroot-linux-gnu_sdk-buildroot/bin, select it, click Open, and modify the Name

Click the Qt Versions tab and click “Add”:

Image

Find qmake in the directory of/opt/aarch64-buildroot-linux-gnu _ sdk-buildroot/bin. Select it and click Open. After it is added, the interface shown below is displayed. Click “Apply”.

Click on the Kits tab and click Add on the right to add a new Kits; modify the content according to the figure below and click “Apply”.

Image