Skip to content

Compile Config

In the embedded product development process, there are usually two key steps, compiling source code and programming firmware. The source code compilation needs to prepare the compilation environment first, and the firmware programming requires the manufacturer to provide a special programming tool. This article mainly introduces how to build an environment to realize the compilation and packaging of Tina sdk.

A typical embedded development environment consists of a local development host and target hardware board:

  • The local development host as a compilation server needs to provide a Linux operating environment, establish a cross-compilation environment, and provide code update downloads and code cross-compilation services for software development.

  • The local development host is connected to the target hardware board through the serial port or USB, and the compiled image file can be programmed to the target hardware board, and the system or application can be debugged.

Compilation environment requirements

Tina Linux SDK is developed and tested in Ubuntu, so we recommend using Ubuntu 14.04 host environment for source code compilation. Users of non-Ubuntu host environment can use cross-platform open source virtual machine software Oracle VM VirtualBox to install Linux virtual machine and build Ubuntu 14.04 environment .

Ubuntu 14, 16, 18, 20 and other versions can also be supported, and some may require developers to configure some additional packages, or build a compilation environment by means of real machine installation. In order to help newbies build a development environment faster, the following content is mainly written based on the scenario of using Oracle VM VirtualBox to run an Ubuntu 20.04 virtual machine.

It is explained here: It is not mandatory to compile in a virtual machine, you can also install the Ubuntu system on the local entity machine for compilation, compile server compilation, docker environment compilation or use WSL2 compilation (WSL1 does not support). At the same time, it can also be compiled in other Linux distributions, macOS, BSD systems, such as Debian, Manjaro, etc., but these platforms have not been tested, and various errors may occur during compilation.

Oracle VM VirtualBox

Oracle VM VirtualBox is a powerful cross-platform open source virtual machine software. There are many tutorials and materials about using this software to install Ubuntu20.04 virtual machine on the Internet, so I won't go into details here, but I will focus on some points that need attention.

Download and Install

Official download link: https://www.virtualbox.org/

Oracle VM VirtualBox official website download and installation tutorial: https://blog.csdn.net/kaixuansui/article/details/89334859/

Install Ubuntu with VirtualBox

Notice:
(1) Memory size setting: it is recommended to be greater than 2GB (2) Virtual hard disk size setting: it is recommended to set at least 50GB (more space required by SDK) (3) After installing the Ubuntu virtual machine environment, it is recommended not to upgrade the Ubuntu version online

Reference link: Tutorial to install Ubuntu environment with Oracle VM VirtualBox https://blog.csdn.net/weixin_42135087/article/details/108193641

Enhancements

Install enhancements to enable shared clipboard functionality and shared folders functionality. Shared pasteboards allow copying and pasting between PCs and virtual machines. Folder sharing can create a folder under the local host, and then VirtualBOX maps the folder to the specified folder under the virtual machine, so that we can access the subfolders and files under the folder. Both of these features can greatly improve our development efficiency

Notice: If the path of the shared folder is the folder of the Windows system, it may not be able to download the SDK code of Tina successfully. Please note that the download directory of the SDK should not be set in the shared folder.

How to install enhancements

method one: Click [Devices] - [Install Enhancements] in the menu bar above the virtual machine interface. Then you can see that the enhanced iso file (VBoxGuestAdditions.iso) is automatically loaded in the CD-ROM of the virtual machine, and click the [Run] button. Then follow the steps instructed by the virtual machine.

Method Two: Mount the CD-ROM in linux. The reference link is as follows: https://jingyan.baidu.com/article/fdbd42779d9530b89e3f489c.html

How to implement a shared folder:

The reference link for creating a shared folder in VirtualBox is as follows: http://www.koudaipe.com/funny/1002.html

Shared folder After sharing a folder, it may not be possible to operate due to permission issues. You need to do the following:

sudo usermod -aG vboxsf $(whoami)

*Note: Replace $(whoami) with your Ubuntu username

Ubuntu environment configuration

The Ubuntu packages required to compile the Tina Linux SDK are:

gcc,binutils,bzip2,flex, python,perl,make,ia32-libs,find,grep,diff,unzip,gawk,getopt,subversion,libz-dev,libc headers

Because the download server of the Ubuntu package is located in a large number of non-China regions, all download speeds will be very slow, or even impossible to download, so it is recommended to change the download source of apt to a domestic address before downloading. There are many organizations in China that provide open source mirror sites. Such as Tsinghua, Ali and so on.

*Thank you so much for the convenience these organizations have made for us! Respect!

Modification:

Replace all the contents of /etc/apt/sources.list under Ubuntu with the following: (modification requires sudo)

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse    
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse    
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse    
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse    
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted 
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse    
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse    
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse    

# Pre-release software sources, not recommended to enable  
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse  
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse  

Ubuntu can be installed directly by executing the following two commands:

Command 1:    
sudo apt-get update

Command 2:
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip lib32z1 lib32z1-dev lib32stdc++6 libstdc++6 -y

For Ubuntu 16.04 and above, some software packages are no longer available or other packages are used. When executing the above command, the package that fails to be installed can be ignored first, and further execute the following commands:

sudo apt-get install libc6:i386 libstdc++6:i386 lib32ncurses5 lib32z1

Use the configured virtual machine

If you cannot configure the compilation environment independently, we have prepared a configured Ubuntu 20.04 virtual machine for you to compile Tina. Modify the virtual machine configuration for the performance of your development PC. It is recommended that you increase the number of cores to improve the compilation speed.

This virtual machine is the OVA format of the open virtual machine platform, which supports importing virtual machine software such as VirtualBox and VMWare.

After VirtualBox imports the virtual machine, you also need to configure your own .ssh, git and other information.

Virtual machine download address (size: 6GB):https://netstorage.allwinnertech.com:5001/sharing/Wm9YiHMvf

OS: Ubuntu 20.04, User: allwinner, Password: Pass123456

The virtual machine includes:

  • Dependencies required to compile Tina Linux
  • Cross-compilation toolchain
  • apt configures Tsinghua source

The virtual machine does not have anything installed and needs to be configured by itself:

  • Tina Linux SDK
  • repo script
  • NPU toolchain

You can continue to read the following documentation to configure the relevant SDK

Virtual Machine Installation Instructions

First install a virtual machine software, the free and open source VirtualBox virtual machine is recommended. Of course, VMWare WorkStation, ESXi and other virtual machine software are also supported. Here VirtualBox is used as an example.

image-20220713153358551

Download the virtual machine file, a Ubuntu20.04.ova file, and double-click it to open it.

image-20220713153229932

Enter this configuration page and configure the virtual machine parameters as shown in the figure.

image-20220713153803299

Click Import to start importing (the virtual machine is larger and may be slower)

image-20220713153859110

Start after importing

image-20220713172228755

虚拟机使用说明

Virtual Machine Instructions

The virtual machine is installed, but there are still enhancements that need to be configured, such as copying of host and virtual machine files, shared folders, shared pasteboards, and more.

We first start the virtual machine and enter the password Pass123456 to enter the system.

image-20220714152336448

Go to Device -> Install Enhancements click and install the enhancements. image-20220714152622549

Click Run

image-20220714152722117

Input password Pass123456

image-20220714152750883

Installation is complete, press enter

image-20220714153054008

Restart the virtual machine

image-20220714153151076

Set shared pasteboard to bidirectional, drag and drop bidirectional

image-20220714153833260

You can also set up shared folders

image-20220714154002672