打印
[技术讨论]

全志D1s软件入门之Tina Linux编译教程

[复制链接]
358|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
神棍地海棠|  楼主 | 2024-6-5 09:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
[color=rgba(0, 0, 0, 0.87)]在搭建好编译环境并下载好源码后,即可对源码进行编译,编译打包好后,即可将打包好的固件烧写到设备中去。本文主要介绍编译和烧写的方法。
Tina Linux 编译
[color=rgba(0, 0, 0, 0.87)]Tina Linux 的编译大致分为以下流程:
code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">(1) source build/envsetup.sh  # 获取 Tina 环境变量(2) lunch                     # 载入方案列表,选择方案(3) mp                        # 编译打包
[color=rgba(0, 0, 0, 0.87)](1)获取 Tina 环境变量
code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">source build/envsetup.sh
[color=rgba(0, 0, 0, 0.87)][color=var(--md-typeset-a-color)]
[color=rgba(0, 0, 0, 0.87)](2)载入方案列表,选择方案
[color=rgba(0, 0, 0, 0.87)]之后使用 lunch 命令载入方案列表,可以看到 方案 5 对应的是 d1s_nezha 板子,也正是 D1s Nezha 开发板。输入 5 回车即可。如果是其他板子,也可以输入对应板子的序号选择方案。
code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">lunch
[color=rgba(0, 0, 0, 0.87)][color=var(--md-typeset-a-color)]
[color=rgba(0, 0, 0, 0.87)]之后 SDK 会自动根据你所选择的方案解压编译工具链,创建环境,耐心等待下即可。
[color=rgba(0, 0, 0, 0.87)](3)编译打包
[color=rgba(0, 0, 0, 0.87)]Tina Linux 里可以使用 make 命令进行编译,pack 命令打包。
code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">make
[color=rgba(0, 0, 0, 0.87)][color=var(--md-typeset-a-color)]
[color=rgba(0, 0, 0, 0.87)]当然,也可以在 make 命令后面增加参数,支持多线程编译,例如:
code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">make -j128       # 以 128 线程编译 SDK
[color=rgba(0, 0, 0, 0.87)]不过有些时候因为软件包的依赖关系,多线程编译可能会导致编译失败。如果出现编译失败可以使用 make -j1 指定单线程编译解决依赖问题。有些时候软件包也可能不完全适配芯片与开发板,这时候也会报错,同样也需要 make -j1 查看实际的错误。
[color=rgba(0, 0, 0, 0.87)]编译完成之后,使用 pack 命令打包。
code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">pack
[color=rgba(0, 0, 0, 0.87)]最后,如果编译完成,则会输出以下内容,代表编译打包完成,可以在/out/d1s-nezha/tina_d1s-nezha_uart0.img 目录下找到打包完成的固件。
[color=rgba(0, 0, 0, 0.87)][color=var(--md-typeset-a-color)]
进阶编译操作
[color=rgba(0, 0, 0, 0.87)]Tina Linux 提供了大量方便使用的快捷跳转命令。方便开发使用。
快捷命令[color=rgba(0, 0, 0, 0.87)]
命令
命令有效目录
作用

maketina根目录编译整个sdk
make menuconfigtina根目录启动软件包配置界面
make kernel_menuconfigtina根目录启动内核配置界面
croottina下任意目录快速切换到tina根目录
cconfigstina下任意目录快速切换到方案的bsp配置目录
cplattina下任意目录快速切换到方案配置目录
ctargettina下任意目录快速切换到openWrt软件包编译产物目录
crootfstina下任意目录快速切换到openWrt rootfs目录
copsrctina下任意目录快速切换到openWrt目录
couttina下任意目录快速切换到方案的输出目录
cboottina下任意目录快速切换到bootloader目录
cgreptina下任意目录在c/c++/h文件中查找字符串
mm [-B]软件包目录编译软件包,-B指编译前先clean
packtina根目录打包固件
mtina下任意目录make的快捷命令,编译整个sdk
ptina下任意目录pack的快捷命令,打包固件



使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

225

主题

233

帖子

0

粉丝