Tina Linux System Introduction
D1 Nezha development board comes with Tina Linux system by default.
Tina Linux is an embedded software system for intelligent hardware products developed by Allwinner Technology based on the Linux kernel. Tina Linux is based on the OpenWrt-14.07 version of the software development kit, which contains the kernel source code, drivers, tools, system middleware, and application packages used in Linux system development.
*OpenWrt is a well-known open-source embedded Linux system automatic construction framework, which is composed of a Makefile script and a Kconfig configuration file. This allows users to configure through menuconfig and compile a complete Linux system software that can be directly burned to the machine to run.
Block Diagram of System
The Tina system software architecture is shown in the figure. From bottom to top, there are four layers: Kernel && Driver, Libraries, System Services, and Applications.
Kernel && Driver
The main layer of Kernel&&Driver provides the standard implementation of Linux Kernel. The Linux Kernel of the Tina platform uses Linux3.4, Linux3.10, Linux4.4, Linux4.9, Linux5.4, and other kernels. Different hardware platforms use different kernel versions to provide security, memory management, thread management, network protocol stacks, etc. Basic support, and through the Linux kernel management device hardware, such as CPU scheduling, cache, memory, I/O, etc. The D1 resource adaptation is the Linux 5.4 kernel.
The library layer corresponds to the general embedded system and corresponds to the middleware layer. Including its various basic system libraries, support for open source libraries, API development interfaces, system customizers, and applications can develop new system services and applications based on library layer APIs.
The system service layer corresponds to the system service layer, including system startup management, configuration management, hot-swap management, storage management, multimedia middleware, etc.
The application layer is mainly to implement specific product functions and interaction logic. Developers can develop and implement their programs to provide end-users with various capabilities of the system.
The Tina Linux SDK is mainly composed of the build system, configuration tools, toolchains, host toolkit, target device applications, documents, scripts, Linux kernel, and bootloader. Below are the files and directories contained in the Tina home directory.
Tina-SDK/ ├── build ├── config ├── Config.in ├── device ├── dl ├── lichee ├── Makefile ├── out ├── package ├── prebuilt ├── rules.mk ├── scripts ├── target ├── tmp ├── toolchain └── tools
The contents contained in the following main directories are briefly introduced.
build is the build file system of Tina Linux. This directory structure is mainly based on the .mk file written in the Make specification. The main functions are:
(1) Check whether the current build environment meets the build requirements of Tina Linux;
(2) Generate host package (PC-side software package) compilation rules;
(3) Compilation rules for generating toolchain;
(4) Compilation rules for generating the target package;
(5) Generate compilation rules for linux kernel;
(6) Generating rules for generating system nodes.
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 mainly stores the interface of the configuration menu in Tina Linux and some fixed configuration items. The configuration menu is written based on the kernel's mconf specification.
config/ ├── Config-build.in ├── Config-devel.in ├── Config-images.in ├── Config-kernel.in ├── Config-systeminit.in └── top_config.in
devices is used to store the configuration files of the program, including kernel configuration, env configuration, partition table configuration, sys_config.fex (Allwinner custom board-level configuration file),
board.dts (Linux standard device tree file), etc.
*These configurations are saved in the target directory on the old version of Tina (before Tina3.0), and the new versions have been moved to the device directory, but defconfig is still saved in the target directory
device/ └── config ├── chips │ └── d1 └── common ├── cert ├── debug ├── dtb ├── hdcp ├── imagecfg ├── partition ├── sign_config ├── toc ├── tools └── version
Among them, config/chips/d1 stores D1 platform-related configuration, and its directory structure is as follows:
d1 ├── bin ├── boot-resource │ └── boot-resource │ └── bat ├── configs │ ├── default │ ├── evb1 │ │ ├── linux -> linux-5.4 │ │ └── linux-5.4 │ └── fpga │ └── linux-5.4 └── tools
bin directory stores bin files such as compiled boot. When Tina SDK builds or recompiles boot, the corresponding files will be replaced. Shortcut jump command: cbin.
boot-resource stores resources such as boot animations.
tools stores the tools needed to build the solution.
configs stores multiple hardware solution configuration files corresponding to the CHIP platform. Among them, default is the public configuration, evb1 corresponds to the scheme configuration of the hardware evb1 board, and fpga is the scheme configuration of the fpga board. If there are more hardware schemes, a new corresponding scheme directory will be created in this directory. If the same configuration file exists in the common configuration directory default and the solution configuration directory, the solution configuration is preferred. Shortcut jump command: cconfigs (this command will jump to the linux directory under this directory).
d1/configs/evb1/ ├── board.dts -> linux-5.4/board.dts ├── env.cfg ├── linux -> linux-5.4 ├── linux-5.4 │ ├── board.dts │ └── config-5.4 ├── sys_config.fex └── sys_partition.fex
Take the evb1 program as an example, briefly describe the specific content under the program configuration directory:
env.cfg: environment variable configuration file, Uboot passes this environment variable to the kernel.
linux/config-5.4: Linux5.4 kernel configuration file, the default linux kernel function under the configuration scheme.
sys_config.fex: The packaging stage updates the headers of the bin files such as boot0, uboot, optee, etc. according to the sys_config configuration, such as updating dram parameters, uart parameters, etc.
sys_partition.fex: partition configuration file.
lichee mainly stores bootloader, linux kernel, DSP and other codes. Among them, DSP code and compilation environment are involved in the copyright of the DSP supplier, so a separate application is required. The structure of the lichee directory is as follows:
Tina-SDK ├── brandy-2.0 │ ├── build.sh │ ├── tools │ └── u-boot-2018 └── linux-5.4
package tores the source code and compilation rules of the software packages supported by the Tina system. The directory is classified according to the function of the target software package. This directory contains the software packages of the entire Tina system (including the Allwinner R/H/F/V/T series) , But not all software packages are adapted to the D1 scheme, and some software packages require developers to adapt themselves.
package/ ├── add-rootfs-demo ├── admin ├── allwinner ... ├── utils └── wayland
prebuild stores the pre-compiled cross-compiler, and the directory structure is as follows. gcc/riscv is the toolchain directory used to compile D1
prebuilt/ └── gcc └── linux-x86 ├── host └── riscv └── toolchain-thead-glibc
scripts is used to store some scripts used on the host side (PC side, the same below) or target side (small machine side, the target machine, the same below).
*Generally, the script that specifies the interpreter as
#!/bin/bash is host
#!/bin/sh and the script is the target-side tool.
scripts/ ├── add_initramfs.sh ├── arm-magic.sh ├── ...
target is used to store the configuration related to the target board and the specifications generated by the SDK and toolchain.
target/ ├── allwinner ├── Config.in ├── imagebuilder ├── Makefile ├── sdk └── toolchain
Quick jump command: cdevice.
The toolchain directory contains cross-toolchain construction configuration and rules.
toolchain/ ├── binutils ├── fortify-headers ├── gcc ├── gdb ├── glibc ├── insight ├── kernel-headers ├── musl └── wrapper
tools is used to store the compilation rules of host-side tools.
out is used to save the temporary files and final image files related to the compilation. This directory is automatically generated after compilation. Take the compilation of d1-evb1 as an example.
out/ ├── d1-evb1 └── host
Among them, host is used to store host-side tools and some development-related files.
d1-evb1 is the directory corresponding to the scheme. The structure of the project directory is as follows:
out/d1-evb1/ ├── boot.img ├── compile_dir ├── d1-evb1-boot.img ├── d1-evb1-Image ├── d1-evb1-uImage ├── image ├── md5sums ├── packages ├── rootfs.img ├── sha256sums ├── staging_dir ├── tina_d1-evb1_uart0.img └── usr.img
Among them, - tina_d1-evb1_uart0.img is the final firmware package (system image), and the serial port information is output through the serial port. If pack -d is used, the generated firmware package is xxx_card0.img, and the serial port information is forwarded to the tf card socket for output. - boot.img is the data finally burned to the system boot partition, which may be in boot.img format or uImage format. - rootfs.img is the data finally burned to the rootfs partition of the system, which is in squashfs format by default. - d1-evb1-Image is the image format image of the kernel, used to further generate uImage. - d1-evb1-uImage is the uImage format image of the kernel. If it is configured as uImage format, it will be copied into boot.img. - d1-evb1-boot.img is the boot.img format image of the kernel. If it is configured as boot.img format, it will be copied into boot.img - compile_dir is the directory of temporary files for compiling the host, target and toolchain for the SDK, and stores the source code of each software package. - staging_dir is the directory where the results of each directory are saved during the SDK compilation process. - The packages directory saves the final generated ipk software package.
Shortcut jump command: cout.
Download source code
Please refer to: Download source code
Compilation environment configuration
Please refer to: Compilation environment configuration
Compile and flash
Please refer to: Compile and flash