1723 views|5 replies

6063

Posts

4

Resources
The OP
 

TinaLinux cross-compilation application basics part 1 (T113-S3) [Copy link]

 

TinaLinux cross-compilation application basics part 1 (T113-S3)

1. To build a vmware virtual machine, the current version is 15.5, but later versions should also be possible.
2. Install Ubuntu 18.04. Other versions have not been tried.
3. Install dependency packages (the following are all run under user permissions):
sudo apt-get install -y sed make binutils build-essential gcc
g++ bash patch gzip bzip2 perl tar cpio unzip rsync file bc wget
python cvs git mercurial rsync subversion android-tools mkbootimg
vim libssl-dev android-tools-fastboot
4. If you find that your Ubuntu virtual machine cannot be copied and pasted into Ubuntu through the Windows command when it is started for the first time.
You need to first run the following command to install a shared clip for the virtual machine and Windows.
sudo apt install open-vm-tools-desktop After the installation is complete, restart Linux
5. Get Tina-sdk V2.0 source package and install the sdk package as introduced in the previous article.
6. Tina-LInux Directory Introduction
build
The build directory stores Tina Linux's build system files. This directory structure mainly contains a series of Makefile-based
mk file written by specification. The main functions are:
  1. Check whether the current compilation environment meets the building requirements of Tina Linux.
  2. Generate host package compilation rules.
  3. Generate compilation rules for the toolchain.
  4. Generate compilation rules for the target package.
  5. Generate compilation rules for the Linux kernel.
  6. Generate build rules for system firmware
build
|--autotools.mk
|--aw-upgrade.mk
|--board.mk
|--cmake.mk
|--config.mk
|--debug.mk
|--depends.mk
|--device.mk
|--device_table.txt
|--download.mk
|--dumpvar.mk
|--envsetup.sh
config
Config.in
The config directory mainly stores the configuration menu interface and some fixed configuration items in Tina Linux.
Written based on the kernel's mconf specification.
config/
|--Config-build.in
|--Config-devel.in
|--Config-images.in
|--Config-kernel.in
|--top_config.in
device
The devices directory is used to store solution configuration files, including kernel configuration, env configuration, partition table configuration, sys_config.fex, board.dts, etc. These configurations are saved in the target directory in the old version, and are moved to the device directory in the new version.
Note that defconfig is still saved in the target directory.
device/
|--config
|--chips
|--common
|--rootfs_tar
dl
docs
The docs directory mainly stores documents used for development, written in markdown format.
This catalog is no longer updated, please refer to the Allwinner Customer Service Platform System Documentation. I can't see it in the system here.
docs/
lichee
The lichee directory mainly stores bootloader, kernel, arisc, dsp and other codes.
Makefile
out
The out directory is used to store compilation-related temporary files and final image files. This directory is automatically generated after compilation.
Such as the compilation plan r328s2-perf1.
out/
├── t113-100ask
└── host
package
The package directory stores the source code and compilation rules of the target machine's software package. The directory is based on the function of the target software package.
Can be classified.
package/
|--allwinner
|--base-files
|--delve
|--dragonst //? Didn't see it
|--firmware
|--kernel
|--....
|--utils
prebuild
The prebuild directory stores the precompiled cross compiler. The directory structure is as follows
rules.mk
scripts
The scripts directory is used to store some build and compilation related scripts.
target
The target directory is used to store target board related configurations and specifications generated by SDK and toolchain.
tmp
toolchain
The toolchain directory contains cross-toolchain build configurations and rules.
toolchain/
├── binutils
├── Config.in
├── fortify-headers
├── gcc
├── gdb
├── glibc
├── info.mk
├── insight
├── kernel-headers
├── Makefile
├── musl
└── wrapper
tools
The tools directory is used to store compilation rules for host-side tools.
tools/
├── autoconf
├── automake
├── aw_tools
├── b43-tools
├── ......
That's it for the directory structure.
7. Kernel compilation is introduced in another article. Here we introduce the compilation of application programs.
The prebuild directory stores precompiled cross compilers, so in order to use the cross-compilation tool chain in any location or terminal, you need to add the tool chain bin path to the ubuntu PATH environment variable separately, which can be added to ~/.bashrc or configured separately in each terminal.
Export PATH=$PATH:home/ubuntu/tina-d1-h/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin
After the configuration is complete, execute arm-openwrt-linux-muslgnueabi-gcc -v to verify whether it is configured.
success.
After the tool chain is added to the environment variable, you can use Makefile to point the cross tool chain and compile the application.
Take hello.c as an example
After copying to the shared folder, use adb in window10 to transfer the file to the t113-s3 board. Remember to modify the file's running properties. Then run to view the results.
In this way, the construction of the C application compilation environment and the basic testing of using Makefile are basically completed, and the next step is how to write the application.
8. Using CMake to build the language
There are some differences between using CMake to build the language and Makefile. The following demonstration example provides the same
hello.c program, use CMake build language to specify the location of cross-compilation toolchain header file lib library, etc., write
Output the CMakeLists.txt compilation rule file, and finally use cmake to compile and generate
First, check whether cmake is installed in ubuntu18.04. If not, install it, as shown below
sudo apt install cmake
Copy hello.c to another directory such as hello-cmake, and write the CMakeLists.txt file as follows:
Then create a build directory in this directory, and then run cmake in this directory.
Perform a pre-compilation check, and then use the make command to compile and generate the hello executable program.
Also transfer it to window10 sharing and use adb to push it to the board for running.
Okay, that’s all I have to report for now. Thank you everyone.
This post is from Domestic Chip Exchange

Latest reply

What about the system? We now use apt to install cross   Details Published on 2024-3-26 09:54
 
 

6827

Posts

11

Resources
2
 
Thank you for your hard work. Now I get a headache when I see that I need to compile. It takes time and takes up hard disk space!
This post is from Domestic Chip Exchange

Comments

No way. I want to make products in this area.  Details Published on 2024-3-14 10:09
 
 
 

6063

Posts

4

Resources
3
 
lugl4313820 posted on 2024-3-14 10:05 Thank you for your hard work. I have a headache now when I see the compilation. It takes time and takes up hard disk space!

No way. I want to make products in this area.

This post is from Domestic Chip Exchange
 
 
 

7422

Posts

2

Resources
4
 

Do you still need to compile the toolchain yourself?

This post is from Domestic Chip Exchange

Comments

There is one in the prebuild directory.  Details Published on 2024-3-21 22:08
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

6063

Posts

4

Resources
5
 
freebsder posted on 2024-3-21 17:27 Do you still need to compile the toolchain yourself?

There is one in the prebuild directory.

This post is from Domestic Chip Exchange

Comments

What about the system? We now use apt to install cross  Details Published on 2024-3-26 09:54
 
 
 

7422

Posts

2

Resources
6
 
damiaa posted on 2024-3-21 22:08 It is in the prebuild directory.

What about the system? We now use apt to install cross

This post is from Domestic Chip Exchange
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list