Tina sdk 编译

Tina SDK(Tina Linux SDK)是全志科技(Allwinner)为其 Tina Linux 嵌入式操作系统提供的官方软件开发工具包。它专为全志系列处理器定制,集成了从编译工具到系统镜像生成所需的一切资源,旨在帮助开发者快速构建、定制和部署智能硬件产品

1. 编译环境

1.1 建议虚拟机配置

  • 虚拟机软件:Vmware17
  • 开发环境操作系统:Ubuntu20.04 64 位版
  • 硬盘空间:大于 70 GB
  • 内存大小:16 GB

1.2 安装工具包

安装 SDK 编译所需必要的工具包,需保证网络可正常使用,打开终端输入指令

sudo apt-get update
sudo apt-get install openssh-server vim git fakeroot make automake \
autoconf libtool libssl-dev bc dosfstools mtools parted iproute2 kmod libyaml-dev \
device-tree-compiler python-is-python3 flex bison build-essential u-boot-tools \
libncurses-dev lib32stdc++6 lib32z1 libc6:i386

2. 源码获取

3. YPT153EVB 源码常见文件路径

文件类型 路径
板载配置 device/config/chips/t153/configs/t153_nand_base
内核配置文件 device/config/chips/t153/configs/t153_nand_base/linux-5.10-origin/buildroot_linux_defconfig
设备树文件 bsp/configs/linux-5.10-origin/sun8iw22p1.dtsi
分区配置 device/config/chips/t153/configs/t153_nand_base/buildroot/sys_partition.fex
uboot环境变量设置 device/config/chips/t153/configs/t153_nand_base/buildroot/env.cfg
buildroot文件系统默认配置 buildroot/buildroot-202205/configs/sun8iw22p1_t153_nand_defconfig
构建脚本 yz_build.sh

4. YPT153EVB SDK 设备树配置逻辑

不同主板型号需要不同设备树配置,采用 基础板载配置 + 型号配置 的方案。
通过 yz_build.sh 把基础板载配置、型号配置集合输出到 board.dts 和 uboot-board.dts,以便在编译系统时使用

4.1 型号设备树配置目录

BoardConfig/        设备树配置目录
├── BoardType                            # 内核板载配置
│   ├── T153pie-board.dts                # T153 椰子派内核板载配置
│   └── ...
│   ...
├── uboot_dts                            # uboot 板载配置
│   ├── T153pie-board.dts                # T153 椰子派 uboot 配置
│   └── uboot-board.dts
│   └── ...
│   ...

4.2 基础板载配置

device/config/chips/t153/configs/t153_nand_base
├── bsp
│   └── BoardConfig.mk
├── buildroot
│   ├── BoardConfig.mk
│   ├── env.cfg                        # uboot 和 内核 变量配置
│   └── sys_partition.fex            # 内核系统分区配置文件
├── linux-5.10-origin
│   ├── base-board.dtsi                # 基础内核板载配置
│   ├── board.dts                    # 编译内核用的设备树文件
│   ├── bsp_defconfig
│   └── buildroot_linux_defconfig    # 文件系统默认配置文件
├── base-uboot-board.dtsi            # 基础 uboot 板载配置
├── board.dts -> linux-5.10-origin/board.dts
└── uboot-board.dts                    # 编译 uboot 用的设备树文件

4.3 自定义文件系统

BoardConfig/filesSystem 文件夹保存自定义文件系统,由 yz_build.sh 选择,会先把 default 文件夹内容复制到 buildroot/buildroot-202205/overlay中,再由选中的文件夹覆盖,实现自定义文件

BoardConfig/filesSystem/
├── default            # 默认的 overlay 内容
│   ├── etc
│   ├── lib
│   ├── opt
│   ├── root
│   └── usr
└── ypt153evb        # 自定义的文件夹,可覆盖 default
    └── etc

5. SDK 配置与编译

5.1 配置编译选项

进入源码目录执行如下指令,配置板载型号、LCD 类型、nand flash 大小、自定义文件系统等

yztiot@ubuntu:~$ cd ~/systemcode/ypt153evb
yztiot@ubuntu:~/systemcode/ypt153evb$./yz_build.sh config

备注:首次运行配置命令会出现官方阅读说明,在等待倒计时结束后输入”Y”,按回车确认即可。

5.2 全量编译和系统打包

执行指令直接进行 U-Boot、内核、Buildroot 等系统编译,然后打包为 img 文件

yztiot@ubuntu:~/systemcode/ypt153evb$./yz_build.sh

首次编译耗时较长,大约 1~3 小时

5.3 单独编译模块

用法: yz_build.sh [子命令]

可用子命令:
  uboot              构建 U-Boot
  kernel             构建内核

5.4 menuconfig

需要先完整编译一次 SDK

用法: yz_build.sh [子命令]

可用子命令:
  kernelconfig       进入内核配置菜单
  buildrootconfig    进入 Buildroot 配置菜单

5.5 官方的构建脚本

官方构建脚本是源码根目录的 build.sh,也可以用来编译和配置模块,推荐使用 yz_build.sh 来配置编译选项

yztiot@ubuntu:~/systemcode/ypt153evb$ ./build.sh help
09-11 15:47:19.059 1449355 E mkcommon  : Unknown command: help
Usage: /home/yztiot/systemcode/ypt153evb/build/mkcommon.sh [command] [options]

Build environment commands:
  config|autoconfig          - Configure build environment
  clean|distclean            - Clean build artifacts

Component build commands:
  build <target>             - Build specific component
    Targets: kernel, uboot, modules, dtb, bootimg, dts, arisc, dsp
             brandy, bootloader, baremetal, rtos
      modules                - Usage: build.sh modules [mod_dir]
                             - Build in-tree modules: [mod_dir] should be 'drivers/...'

Filesystem commands:
  bsp_rootfs                 - Build BSP root filesystem
  buildroot_rootfs           - Build Buildroot filesystem
  openwrt_rootfs             - Build OpenWrt filesystem
  debian_rootfs              - Build Debian filesystem
  rootfs                     - Build default root filesystem

Configuration commands:
  menuconfig                 - Configure Linux kernel
  uboot_menuconfig [defconfig]  - Configure U-Boot with default defconfig [or specified defconfig]
  recovery_menuconfig        - Configure recovery
  buildroot_menuconfig       - Configure Buildroot
  loadconfig                 - Load kernel config from device defconfig
  uboot_loadconfig           - Load U-Boot config from given defconfig
  saveconfig                 - Save kernel config
  uboot_saveconfig [defconfig]  - Save U-Boot to default defconfig [or specified defconfig]

Firmware operations:
  pack[opt]                  - Generate firmware image
    Options:
      debug                  - Debug firmware
      secure                 - Secure boot firmware
      dump                   - Crash dump firmware
      raw                    - Programmer image
      (combine with _ e.g. pack_debug_secure)

Special operations:
  recovery                   - Build recovery image
  ramfs <action> <src> <dst> - Handle RAM filesystem
  independent_package        - Build standalone packages
  tina                       - Full Tina Linux build

Verification commands:
  check_whitelist            - Verify symbol whitelist
  check_gki                  - Check GKI compliance
  check_gkidefconfig         - Validate GKI defconfig

Miscellaneous:
  bsp                        - BSP subsystem operations
  uboot_force                - Force rebuild U-Boot
  bootloader                 - Build BootLoader

Note: Running without commands performs full build
作者:陈柏林  创建时间:2026-09-11 11:43
最后编辑:陈柏林  更新时间:2026-10-12 11:13