Ubuntu18.04+Linux4.14.47_User’s Compilation Manual_V1.0

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

Revision History

Date

User Manual Version

Revision History

2022/02/10

V1.0

OK1046A-C2_User’s Compilation Manual Initial Version

Overview

This manual is designed to enable you to quickly understand the compilation process of the products and familiarize yourselves 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, users will be able to successfully compile their own software code.

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 least8GB memory or above. It allows for allocating a sufficient memory to the virtual machine (recommended to allocate2GBor above), while still leaving enough resources for other operations on Windows. Insufficient memory allocation may result in slower performance on 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.1.0. You 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;

  • Chapter 3. mainly introduces the method of building a new ubuntu development environment; It takes 64-bit Ubuntu 18.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 describes the compiling method of the source code related to the development board, including the kernel source code compilation and the application program compilation.

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

Format

Meaning

Blue font on grey background

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

Black font on gray background

Serial port output message after entering a command

Bold black on gray background

Key information in the serial port output message

//

Interpretation of input instructions or output information

Username@Hostname

root @ localhost: ~ : development board serial port login account information;
forlinx @ localhost: ~ : Development board network login account information;
forlinx @ Ubuntu ~ $: Development environment Ubuntu account information;
This information allows you to determine the environment, in which the feature operates.

Example: View the files that exist in the current path.

forlinx@ubuntu:~/work$ ls
OK10xx-linux-fs.tar.bz2                  //Source code package

forlinx@ubuntu~/work$:User name: forlinx,host name: ubuntu, means to operate in the development environment Ubuntu.

// : Explanation of operating instructions, no need to enter

ls:Blue font with gray background, indicating relevant commands requiring manual input

OK10xx-linux-fs.tar.bz2The black font with gray background is the output information after the input command, and the bold font is the key information. Here is the source code package.

1. VMware Virtual Machine Software Installation

This chapter mainly introduces the installation of VMware virtual machine, and takes VMware workstation 15 Pro v15.1.0 as an example to show the installation and configuration process of the operating system.

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 startup file to start the installer.

1.2 VMware Software Installation

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

Image

Click “Next”.

Image

Check I accept the terms in the license agreement and click “Next”.

Image

Modify the installation location to the partition of your computer where the software is installed, and click “Next”.

Image

Check and click “Next”.

Image

Check Add Shortcut and 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 that beginners use the virtual machine environment built by Forlinx directly. After understanding this chapter, you can directly jump to the compilation chapter for further study;

  • The account that provides the development environment is: for Linux and the password is: forlinx.

There are two ways to use a virtual machine environment under 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. After downloading, select the Ubuntu 18 compressed package and right click to extract it to the OK1043&OK1046&OK1012-Linux4.14.47-VM 15_1_0-ubuntu18_04 folder:

Image

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

Image

Ubuntu18.vmx in the ubuntu18 folder is the file to be clocked by the virtual machine.

Open the installed virtual machine.

Image

Select the directory where the newly extracted ubuntu18 virtual machine file is located, select ubuntu18.vmx, and click “Open”.

Image

After loading, click to open the virtual machine to run and enter the system interface.

Image

When the development environment is loaded for the first time, the following will appear. Select “I have copied this virtual machine (P)”, and the system will automatically load it.

Image

After loading, you will enter the following interface, enter the password: forlinx, and select “Sign in” to log in after filling in the password.

Image

Password: forlinx.

Image

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 focuses on the process of creating the Ubuntu system and does not cover the setting up of the compilation environment. The main reason for this is that in order to build a compilable source code environment, one needs to download the official source code of NXP in Ubuntu 18.04. Setting up Ubuntu compilation can be complex and prone to compilation problems.

3.1 Ubuntu System Setup

3.1.1 Ubuntu Virtual Machine Setup

Open the VMware software, click on create a new virtual machine. Enter the following interface:

Image

Choose custom, and click “Next”.

Image

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

Image

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

Image

Leave the default and click “Next”.

Image

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

Image

Image

Again, set the memory size as appropriate.

Image

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.

Image

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

Image

The default selection here is also SCSI.

Image

Choose to create a new virtual disk here.

Image

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.

Image

Click “Finish” by default.

Image

The virtual machine creation is now complete.

In the next section, the installation of Ubuntu system in the virtual machine is introduced, 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 Ubuntu official website to get the Ubuntu 18.04 64-bit image. Go to http://releases.ubuntu.com/18.04/ to downlaod “ubuntu-18.04.5-desktop-amd64.iso.

Image

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

Image

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

Image

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

Image

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.

Image

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

Image

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.

Image

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

Image

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

Image

Image

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 the user name and password (take the user name: forlinx, password: forlinx as an example, the user can set it according to actual needs), and click “continue” to automatically install:

Image

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

Image

After the installation, click “Restart Now” to reboot (or click “Reboot Client”):

Image

Image

After the restart, you need to use the user name and password to log in. The system interface after login is as shown below:

Image

Image

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.

Image

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.

Image

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

Image

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).

Image

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

Image

Image

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, enable Auto Resize by clicking View, then Auto Adapt to Client. Ensure that VMware tools have been installed successfully.

Image

  • 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.

Image

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

Image

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 VMs to get on the extranet.

Image

Image

The network is set to dynamic IP.

Image

Bridge Mode:

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.

If you use TFTP, SFTP and other servers, you need to set the virtual machine as the bridge 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.

Image

Image

Image

Set up static ip, at this time Ubuntu’s IP and the host IP need to be set in the same network segment.

Image

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. As shown below:

Image

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:

Image

Image

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 download source information.
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 // A compression and decompression tool based on the Lzo library.
forlinx@ubuntu:~$ sudo apt-get install net-tools // Network configuration tools.