Compilation environment configuration
In the embedded product development process, there are usually two key steps: compiling the source code and burning the firmware. To compile the source code, you need to prepare the compiling environment, while the firmware programming requires the manufacturer to provide a dedicated programming tool. This article mainly introduces how to build an environment to compile and package Tina sdk.
A typical embedded development environment includes local development host and target hardware board:
As a compilation server, the local development host needs to provide a Linux operating environment, establish a cross-compilation environment, provide code update downloads, and code cross-compilation services for software development.
The local development host is connected to the target hardware board through a serial port or USB, and the compiled image file can be burned to the target hardware board, and the system or application program can be debugged.
Compilation environment requirements
The Tina Linux SDK was developed and tested on Ubuntu 14.04, so we recommend using the Ubuntu 14.04 host environment for source code compilation. Users who are not in the Ubuntu 14.04 host environment can use the cross-platform open source virtual machine software Oracle VM VirtualBox to install the Linux virtual machine and build Ubuntu 14.04 environment.
Ubuntu 16, 18, 20 and other versions can also be supported, but the developer may need to configure some additional packages, or use the real machine to build the compilation environment. In order to help novices to set up a development environment faster, the following content is mainly based on the scenario of using Oracle VM VirtualBox to run the Ubuntu 14.04 virtual machine.
Oracle VM VirtualBox
Oracle VM VirtualBox is a powerful cross-platform open source virtual machine software. There are a lot of tutorials and materials about using this software to install the ubuntu14.04 virtual machine on the Internet. I won't repeat them here, but I will focus on some matters needing attention.
Download and install
Official website download address:< https://www.virtualbox.org/>
Reference link: Oracle VM VirtualBox official website download and installation tutorial: https://blog.csdn.net/kaixuansui/article/details/89334859/
Install Ubuntu on VirtualBox
(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 (larger space required for SDK) (3) After installing the Ubuntu 14.04 virtual machine environment, it is recommended not to upgrade the Ubuntu version online
Reference link: Oracle VM VirtualBox installation Ubuntu14.04 environment tutorial: https://blog.csdn.net/weixin_42135087/article/details/108193641
Shared clipboard and the shared folder
Install the enhanced function to realize the shared clipboard function and the shared folder function. The shared clipboard can paste copied content between the PC and the virtual machine. 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. These two functions can greatly improve our development efficiency
Note: If the path of the shared folder is the folder of the Windows system, you may not be able to download Tina's SDK code successfully. Please note that the download directory of the SDK should not be set in the shared folder.
Install enhanced features
Method 1: Click [Device]-[Install Enhanced Features] in the menu bar on the top of the virtual machine interface. Then you can see that the enhanced iso file (VBoxGuestAdditions.iso) is automatically loaded in the CD-ROM drive of the virtual machine, click the [Run] button. Then 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 realize the shared folder:
The reference link for creating a shared folder in VirtualBox is as follows: http://www.koudaipe.com/funny/1002.html
After sharing the folder, you may not be able to operate due to permission issues. You need to do the following:
sudo usermod -aG vboxsf $(whoami)
*$(whoami) Replace 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 in a large number of areas outside of China, all download speeds will be very slow, or even hard 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 University, Ali, etc.
**I sincerely thank these organizations for their convenience! Respect!
Modification method: Replace all the contents of Ubuntu下/etc/apt/sources.list with the following contents: (need 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 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 packages are no longer provided or other packages are used. When the above command is executed, the package that fails to install can be ignored first, and the following commands are further executed:
sudo apt-get install libc6:i386 libstdc++6:i386 lib32ncurses5 lib32z1
Configured virtual machine download
If you cannot configure the compilation environment independently, we have prepared a configured Ubuntu14.04 virtual machine that can compile Tina. This virtual machine is based on Oracle VM VirtualBox version 6.1.16 and configured with a single-core 4G memory. You can configure it according to your The performance of the development PC is to modify the configuration of the virtual machine. It is recommended that you increase the number of cores to improve compilation speed.
After importing the virtual machine in VirtualBox, you also need to configure your own .ssh, git and other information.
The download address of the virtual machine is as follows (larger, 1.6G): Oraclr VM VirtualBox Ubuntu14.04 can compile Tina SDK
*Virtual machine administrator password: 123456