Skip to content

Compile Environment Configuration

There are usually two key steps in the embedded product development process, compiling the source code and burning the firmware. The source code compilation needs to prepare the compilation environment first, while the firmware burning requires a special burning tool from the manufacturer. This article introduces how to build an environment to compile and package Tina sdk.

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

  • The local development host acts as a compilation server, which needs to provide linux operating environment, establish cross-compilation environment, provide code update download and code cross-compilation service for software development.

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

Compiler Environment Requirements

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

Ubuntu 16, 18, 20 and other versions can also be supported, but may require the developer to configure some additional packages, or you can use the real machine to build the compiled environment. In order to help newbies to set up the development environment faster, the following content is mainly based on the scenario of using Oracle VM VirtualBox to run Ubuntu 14.04 virtual machine.

Oracle VM VirtualBox

Oracle VM VirtualBox is a powerful cross-platform open-source virtual machine software. There are many tutorials and materials available on the web about using this software to install ubuntu 14.04 virtual machines, so I won't go into them all here, but I will highlight some things to keep in mind.

Download and install

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

参考链接: Oracle VM VirtualBox官网下载安装教程: https://blog.csdn.net/kaixuansui/article/details/89334859/

VirtualBox installation of Ubuntu

Notes:

(1) Memory size setting: greater than 2GB is recommended (2) Virtual hard disk size setting: at least 50GB is recommended (larger space required for SDK) (3) After installing the Ubuntu 14.04 virtual machine environment, it is recommended that you do not upgrade the Ubuntu version online

Reference link: Oracle VM VirtualBox official website download and installation tutorial: https://blog.csdn.net/weixin_42135087/article/details/108193641

Enhancements

Installing enhancements allows for shared clipboard functionality shared folder functionality. Shared Pasteboard allows you to paste and copy content between PCs and virtual machines. Folder sharing allows you to create a folder under the local host and then VirtualBOX maps that folder to a specified folder under the virtual machine so that we can access the subfolders and files under that folder. Both of these features can greatly improve our development efficiency

Note: If the path to the shared folder is in the windows folder, you may not be able to download Tina's SDK code successfully, so be careful not to set the SDK download directory in the shared folder.

How to install enhancements

Method 1: Click [Device] - [Install Enhancements] in the menu bar on the top of the virtual machine interface. Then you can see the enhanced iso file (VBoxGuestAdditions.iso) automatically loaded in the CD-ROM drive of the virtual machine, click the [Run] button to run. Then you can follow the steps guided by the virtual machine.

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

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 may not be operable due to permission issues, you need to do the following.

sudo usermod -aG vboxsf $(whoami)

Replace *$(whoami) with your Ubuntu username

Ubuntu environment configuration

The Ubuntu packages needed 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 Ubuntu package download servers in a large number of non-Chinese regions, all downloads will be very slow, and may not even download, so it is recommended to change the download source of apt to a domestic address before downloading. There are several organizations in China that provide open-source mirror sites, such as Tsinghua, Ali, etc..

*heartfelt thanks to these organizations to provide us with the convenience of Respect!

Modification

Ubuntu /etc/apt/sources.list under the contents of all replaced 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 source, not recommended  
# 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 one:

sudo apt-get update

Command two:

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 packages are no longer available or other packages have been used. When executing the above commands, you can ignore the failed packages and further execute the following commands.

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

Configured Virtual Machine Download

If you are unable to configure the compilation environment independently, we have prepared a configured Ubuntu 14.04 virtual machine for you to compile Tina, which is based on Oracle VM VirtualBox version 6.1.16 and configured with a single core of 4G memory. It is recommended to increase the number of cores to increase the compilation speed.

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

The virtual machine can be downloaded at the following address (larger, 1.6G): Oraclr VM VirtualBox Ubuntu14.04 Virtual Machine with Tina compiler