Compile Tina Linux
After building the compilation environment and downloading the source code, the source code can be compiled, and after the compilation and packaging, the packaged firmware can be programmed into the device. This chapter mainly introduces the methods of compiling and programming.
V853 officially adapts to Tina5.0 version. Tina5.0 supports both openWrt
and buildroot
dual compilation environments.
-
For the method of building the compilation environment, link: Tina Compilation Environment Configuration
-
For the method of source code download, link: Tina SDK source code acquisition
-
More Tina v5.0 infomation:Tina Linux v5.0
This article will be divided into two parts, which will introduce the openWrt
compilation method and the buildroot
compilation method respectively.
The two build systems are not completely independent, the kernel menuconfig modified in openWrt will affect the kernel configuration of buildroot
openWrt Compile
The compilation of openWrt
is roughly divided into the following processes:
(1) source build/envsetup.sh # Get Tina environment variables
(2) lunch # Load the plan list, select the plan
(3) mp # Compile and pack
(1) Get Tina environment variables
tina@VirtualBox:~/tina-v853$ source build/envsetup.sh
NOTE: The SDK(/home/tina/tina-v853) was successfully loaded
load openwrt... ok
Please run lunch next for openwrt.
load buildroot,sata,dragonboard,bsp...ok
Please run ./build.sh config next for buildroot, bsp.
(2) Load the program list and select the program
Then use the lunch
command to load the scheme list, you can see that the scheme 1
corresponds to the v853-vision
board, which is also the V853 development board. Just type 1
and hit enter. If it is another board, you can also enter the serial number of the corresponding board to select a plan.
tina@VirtualBox:~/tina-v853$ lunch
You're building on Linux
Lunch menu... pick a combo:
1 v853-vision-tina
Which would you like? []: 1
For the first time lunch
, you need to read the use agreement, and agree to agree to the relevant user agreement of Allwinner Technology and the use agreement of the SDK. If you agree, just type y
.
......
You can read /home/tina/tina-v853/build/disclaimer/Allwinnertech_Disclaimer(Cn_En)_20181122.md for detailed information.
You read time left 8 seconds....
I have already read, understood and accepted the above terms? [Y/N]
After that, the SDK will automatically decompress and compile the toolchain according to the solution you selected, create an environment, and wait patiently. The output is as follows:
Jump to longan autoconfig
/home/tina/tina-v853/build.sh autoconfig -o openwrt -i v853 -b vision -n default
========ACTION List: mk_autoconfig -o openwrt -i v853 -b vision -n default;========
options :
INFO: Prepare toolchain ...
INFO: kernel defconfig: generate /home/tina/tina-v853/kernel/linux-4.9/.config by /home/tina/tina-v853/device/config/chips/v853/configs/vision/linux-4.9/config-4.9
INFO: Prepare toolchain ...
make: Entering directory `/home/tina/tina-v853/kernel/linux-4.9'
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
*** Default configuration is based on '../../../../../device/config/chips/v853/configs/vision/linux-4.9/config-4.9'
#
# configuration written to .config
#
make: Leaving directory `/home/tina/tina-v853/kernel/linux-4.9'
INFO: clean buildserver
INFO: prepare_buildserver
If you see INFO: prepare_buildserver
and no error is reported, the build environment is ready.
(3) Compile and package
In Tina Linux, you can use the make
command to compile, and the pack
command to package.
tina@VirtualBox:~/tina-v853$ make
Of course, you can also add parameters after the make
command to support multi-threaded compilation and choose whether to output logs, for example:
make -j128 # 128 thraeds compile SDK
make V=s # open all compile log
make V=s -j128 # 128 thraed compile SDK and open all compile log
After compiling, use the pack
command to pack.
tina@VirtualBox:~/tina-v853$ pack
Finally, if the compilation is completed, the following output will be output, indicating that the compilation and packaging are completed, and the packaged firmware can be found in the /home/tina/tina-v853/out/v853/vision/openwrt
----------image is at----------
27M /home/tina/tina-v853/out/v853/vision/openwrt/v853_linux_vision_uart0.img
pack finish
buildroot Compile
The compilation of buildroot
is roughly divided into the following processes:
(1) ./build.sh config # Configure compilation mode and project file
(2) ./build.sh # Complie
(3) ./build.sh pack # pack
(1) Configure the compilation mode and project file
Use ./build.sh config
to configure build mode and project files.
tina@VirtualBox:~/tina-v853$ ./build.sh config
========ACTION List: mk_config ;========
options :
All available platform: # input 1 choose linux
0. android
1. linux
Choice [linux]:
All available linux_dev: # input 1 choose buildroot
0. bsp
1. buildroot
2. tinyos
3. openwrt
Choice [openwrt]: 1
All available ic: # input 0 choose v853
0. v853
Choice [t113]: 0
All available board: # input 0 choose vision
0. vision
Choice [vision]: 0
All available flash: # input 0 choose default
0. default
1. nor
Choice [default]: 0
(2) Compile the firmware
Use ./build.sh
to build the firmware.
tina@VirtualBox:~/tina-v853$ ./build.sh
========ACTION List: build_linuxdev;========
options :
INFO: ----------------------------------------
INFO: build linuxdev ...
INFO: chip: sun8iw21p1
INFO: platform: linux
INFO: kernel: linux-4.9
INFO: board: vision
......
After successful compilation, the following information will be displayed.
sun8iw21p1 compile Kernel successful
INFO: ----------------------------------------
INFO: build Tina OK.
INFO: ----------------------------------------
(3) Package firmware
Compile the firmware with ./build.sh pack
. The packaged firmware can be found in the /home/tina/tina-v853/out/v853/vision/buildroot/
directory.
tina@VirtualBox:~/tina-v853$ ./build.sh pack
......
Dragon execute image.cfg SUCCESS !
----------image is at----------
71M /home/tina/tina-v853/out/v853/vision/buildroot/v853_linux_vision_uart0.img
pack finish
Advanced Compilation Operations
Reprogram an application individually
The application scenario of reprogramming the application package is generally: Only modify the application, do not want to re-program the firmware, just install the application installation package. Please make sure to compile the firmware once, and make sure that the SDK base has been compiled before you can recompile the application package separately. Make sure the tina environment is loaded before compiling:
$ source build/envsetup.sh
$ lunch
(1) Method 1
When in the application package's directory (including its subdirectories), the executable
$ mm [-B]
=> B means clean the temporary files of this application before compiling
Example:
If the package path is:openwrt/package/feeds/utils/memtester/
, so:
$ cd openwrt/package/feeds/utils/memtester/
$ mm -B
The saved path of the compiled application installation package is:
out/IC name/project name/openwrt/extra/packages/arm_cortex-a7_neon/base/memtester_4.3.0-1_arm_cortex-a7_neon.ipk
So v853 dev board is:
out/v853/vision/openwrt/extra/packages/arm_cortex-a7_neon/base/memtester_4.3.0-1_arm_cortex-a7_neon.ipk
(1) Method 2
Execute in any directory
$ mmo [-B] [pack name]
=> B means clean the temporary files of this application before compiling
Example: If the package path is: openwrt/package/feeds/utils/memtester/,the package name is determined by PKG_NAME, i.e.memtester:
$ mmo -B memtester
Other Shortcut Commands
Command | Command valid directory | Function |
---|---|---|
make | tina | Compile whole sdk |
make menuconfig | tina | Start the package configuration interface |
make kernel_menuconfig | tina | Start the kernel configuration interface |
croot | tina/* | Quickly switch to the tina root directory |
cconfigs | tina/* | Quickly switch to the bsp configuration directory of the scheme |
cplat | tina/* | Quickly switch to the scheme configuration directory |
ctarget | tina/* | Quickly switch to the openWrt package compilation product directory |
crootfs | tina/* | Quickly switch to the openWrt rootfs directory |
copsrc | tina/* | Quickly switch to the openWrt directory |
cout | tina/* | Quickly switch to the output directory of the scheme |
cboot | tina/* | Quickly switch to the bootloader directory |
cgrep | tina/* | find string in .c/.c++/.h filr |
mm [-B] | package directory | Compile the package, -B means clean before compiling |
mmo [-B] pkg | tina/* | Compile the specified package, -B means clean before compiling |
pack | tina | pack firmware |
m | tina/* | = make |
p | tina/* | = pack |
Compile exception problem solving
Due to the different system environments of different computers, different compilation exceptions often occur, and each exception is different, which is a difficult and miscellaneous disease, which is also a major difficulty for beginners to learn embedded development.
To this end, the Allwinner online developer community has specially opened a Compilation and programming problem area. If there is an error, you can go to Allwinner Developer Forum - Compilation and Programming Problem Area to communicate and discuss with the developers in the community. The community has engineers patrolling the field to solve problems, and many enthusiastic friends actively offer suggestions.
Question Notes:
(1) Post your log;
(2) Explain your compilation environment and operations, modifications, etc.;
(4) Be polite.