全志 Tina Linux 系列的 SDK 源码学习

Tina Linux 使用了 openwrt linux 系统为原型,所以编译方法是相通的,只是会多一点自己的特色。

有如下基础用法,我这里只是简化和说明源头:

1、下载源码

2、进入目录后source build/envsetup.sh后可以用如下命令,具体可以查看envsetup脚本


== before all ==
- lunch:        lunch <product_name>-<build_variant>

== build project ==
- m:            Make from the top of the tree.
- mm:           Build package in the current directory, but not their dependencies.
- mmb:          Clean and build package in the current directory, but not their dependencies.
- p:            Pack from the top of the tree.
- pd:           Pack card0 from the top of the tree.
- mp:           Make and pack from the top of the tree
- mpd:          Make and pack card0 from the top of the tree
- mboot:        Build boot0 and uboot, including uboot for nor.
- mboot0:       Just build boot0.
- muboot:       Build uboot, including uboot for nor.
- muboot_nor:   Just build uboot for nor.
- mkernel:      Build kernel.
- mlibc:        Build c library.

== jump directory ==
- croot:    Jump to the top of the tree.
- cboot:    Jump to uboot.
- cboot0:   Jump to boot0.
- cdts:     Jump to device tree.
- cbin:     Jump to uboot/boot0 bin directory.
- ckernel:  Jump to kernel.
- cdevice:  Jump to target.
- ccommon:  Jump to platform common.
- cconfigs: Jump to configs of target.
- cout:     Jump to out directory of target.
- ctarget:  Jump to target of compile directory.
- crootfs:  Jump to rootfs of compile directory.
- ctoolchain: Jump to toolchain directory.
- callwinnerpk: Jump to package allwinner directory.
- ctinatest:  Jump to tinateset directory.
- godir:    Go to the directory containing a file.

== grep file ==
- cgrep:    Greps on all local C/C++ files.

命令主要就用这几个就好。

croot 到工程根目录, cout 同理到 out 编译目录。

make 编译工程全部内容,mkernel 同理单独编译 kernel (mboot 同理)。

make menuconfig 和 make kernel_menuconfig 分别是配置 package 和 kernel 的所选功能的。

pack 打包当前的编译结果成一个 img 文件,供 livesuit 工具烧录。

全志的烧录工具网上多,这里不再赘述

cgrep test 是快速的 grep -rn "test" 查代码用的。

现在我们具备了编译,打包,烧录的基础,顺便说一下一些常用的注意点。

make 只在 croot 的目录下有效,编译主要分 uboot kernel package 三大块的编译。

我们通常只需要关心 package 编译即可,编译系统和 openwrt 一致,这个可以从网上获取相关用法。

单包编译 make package/allwinner/eyesee-mpp/middleware/compile

清理单包 make package/allwinner/eyesee-mpp/middleware/clean

具体的包描述可以看目录下的 Makefile 和 Config.in ,如果想要加一个包,就可以通过仿照其他包加入编译系统,甚至是从 github 获取别人移植好的包。

例如给系统加入 libuv ,我们可以github 搜索到获得别人加入的。

这样一些软件包的编译规则就可以不用自己写了,这是一个软件包常用的偷懒小技巧(不是),驱动代码有时候也可以这样操作,但自己最好熟悉整体的编译系统是最好的。

# 单独编译boot0和uboot:(可在Tina任意目录下使用)
mboot
# 单独编译boot0:(可在Tina任意目录下使用)
mboot0
# 单独编译uboot:(可在Tina任意目录下使用)
muboot
# 单独编译内核:(可在Tina任意目录下使用)
mkernel

mm

# 单独编译某个包:(只能在编译的包路径下操作)
# 如包路径为 tina/package/utils/rwcheck,则需要进入到 tina/package/utils/rwcheck路径下再输入 mm 命令,
# 编译出来对应的安装包的路径在 tina/out/d1-nezha/packages/base下
mm命令,

# 在根目录下编译某个软件包:(需要在根目录下操作)
make <应用包的路径>/install    # 如 make package/utils/rwcheck/install

# 在根目录下清空应用包临时文件:(需要在根目录下操作)
make <应用包的路径>/clean        # 如 make package/utils/rwcheck/clean
 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值