[sinlinx]allwinner固件打包工具介绍

本文详细介绍了全志处理器在固件打包过程中使用的各种工具,包括update_mbr用于更新主引导记录,merge_full_img合并成img固件包,script解析文本生成二进制文件,dragonsecboot涉及安全相关的TOC文件生成和打包,以及update_boot0、update_dtb等对固件不同部分的修正工具。这些工具在构建和定制系统时起到关键作用。
摘要由CSDN通过智能技术生成

目录

update_mbr

merge_full_img

script

dragonsecboot

update_boot0

update_dtb

update_fes1

signature

update_toc0

update_uboot

fsbuild

dragon


固件打包是指将我们编译出来的bootloader、内核和根文件系统一起写到一个镜像文件中,这个镜像文件也叫固件。然后可以将这个镜像写到nand、nor flash 或是sd 卡上,从而启动系统。打包成固件时需要使用到一些打包工具,打包脚本以及打包配置文件。本文主要就是介绍打包时需要哪些工具,需要哪些配置文件,以及固件的生成流程。

update_mbr

工具名称update_mbr
功能说明根据分区配置文件,更新主引导目录文件sunxi_mbr.fex ,sunxi_gpt.fex及分区的下载文件列表dlinfo.fex 。
使用方法

update_mbr <partition_file> (mbr_count)如果不指定mbr_count,mbr_count = 4;

update_mbr <partition_file> <mbr_countnt> <output_name>使用此用法必须指定mbr_count,本来输出的sunxi_mbr.fex 会改名为output_name。

参数说明

partition_file:分区配置文件,如sys_partition.bin

mbr_count:mbr 的备份数量,如果不指定,缺省mbr_count = 4;

output_name:修改sunxi_mbr.fex 的输出名,没有特殊需求不建议使用此用法。

应用举例

update_mbr sys_partition.bin 4

update_mbr sys_partition.bin 1 sunxi_mbr_tmp.fex(没有特殊需求不建议使用此用法)

merge_full_img

工具名称merge_full_img
功能说明指定起始逻辑地址,把boot0,boot1,mbr 及分区文件下载列表里的文件合并成img 固件包,应用于小容量的nor flash。此时没有分区的概念。
使用方法merge_full_img –out –boot0 <boot0.fex> –boot1 <boot1.fex> –mbr <mbr.fex> –partition <partition.fex> \–logic_start <512|256>–help
参数说明

–out :指定输出目标文件–boot0 <boot0.fex>:指定输入的boot0 文件

–boot1 <boot1.fex>:指定输入的boot1 文件

–mbr <mbr.fex>:指定输入的mbr 文件

–partition <partition.fex>:指定输入的分区配置文件

–logic_start <512|256>:指定起始逻辑地址

–help:显示使用方法

应用举例merge_full_img –out full_img.fex <br/>–boot0 boot0_spinor.fex <br/>–boot1 ${BOOT1_FILE} <br/>–mbr sunxi_mbr.fex <br/>–logic_start ${LOGIC_START} <br/>–partition_file

script

(1) 注意: 此处讲述的不是Linux 通用的script 工具(Linux 下script 工具用于终端会话录制)

(2) 它是全志实现的一个同名工具,工具功能说明如下:

工具名称script
功能说明解析输入文本文件的所有数据项,生成新的二进制bin 文件,以便程序解析。生成的目标文件与源文件名字(除后缀) 一样,但后缀为.bin。
使用方法script <source_file>
参数说明source_file:输入的文本文件,可多个
应用举例

script sys_config.fex

script sys_partition.fex

dragonsecboot

工具名称dragonsecboot
功能说明

1) 根据指定的keys 生成toc0 文件。

2) 根据指定的keys 和cnfbase 生成toc1 文件。

3) 根据配置文件生成keys。

4) 按配置文件的配置进行打包生成目的文件。

使用方法

dragonsecboot -toc0 <cfg_file> <version_file>

dragonsecboot -toc1 <cfg_file> <version_file>

dragonsecboot -key <cfg_file>

dragonsecboot -pack <cfg_file>

参数说明

-toc0:表示要生成toc0 文件

-toc1:表示要生成toc1 文件

-key:表示要生成key

-pack:表示进行打包

cfg_file:配置文件keypath:key 的路径cnfbase:输入的cnf_base.cnf 文件version_file:固件防回滚配置文件

应用举例

dragonsecboot -pack boot_package.cfg

dragonsecboot -key dragon_toc.cfg keys

dragonsecboot -toc0 dragon_toc.cfg keys version_base.mk

dragonsecboot -toc1 dragon_toc.cfg keys cnf_base.cnf version_base.mk

在do_signature函数中有以下两行代码:

update_boot0

工具名称update_boot0
功能说明根据配置脚本内容,修正boot0 头部的参数。修正参数:debug_mode、dram_para 参数、uart 参数、bootcpu、jtag 参数、NAND 参数等。
使用方法update_boot0 <sys_config_file> <storage_type>
参数说明

boot0:boot0 文件

sys_config_file:系统配置文件

storage_type:存储介质类型

应用举例 update_boot0 boot0_nand.fex        sys_config.bin NAND > /dev/null
 update_boot0 boot0_spinand.fex    sys_config.bin SDMMC_CARD > /dev/null
 update_boot0 boot0_sdcard.fex    sys_config.bin SDMMC_CARD > /dev/null

update_dtb

工具名称update_dtb
功能说明把Linux 设备树二进制dtb 文件进行512 字节对齐后再预留空间。
使用方法update_dtb <dtb_file> <reserve_size>
参数说明

dtb_file:输入的Linux 设备树二进制dtb 文件

reserve_size:输出目标文件预留多少字节

应用举例update_dtb sunxi.fex 4096

update_fes1

工具名称update_fes1
功能说明从系统配置文件中取出数据对fes1 头部相关参数进行修正。修正参数包括:DRAM 参数、UART 参数、JTAG 参数等。
使用说明update_fes1 <fes1_file> <config_file>
参数说明

fes1_file:更修正的FES1 文件

config_file:输入的系统配置文件

应用举例update_fes1 fes1.fex sys_config.bin

signature

工具名称signature
功能说明对MBR 指定要进行签名的分区文件进行签名。
使用方法signature <sunxi_mbr_file> <dlinfo_file>
参数说明

sunxi_mbr_file:输入的MBR 文件

dlinfo_file:输入的分区下载列表文件

应用举例signature sunxi_mbr.fex dlinfo.fex

update_toc0

工具名称update_toc0
功能说明从系统配置文件中取出相关参数对toc0 配置参数进行修正,修正参数包括:DRAM、UART、JTAG、NAND、卡0 、卡2 、secure 参数等。
使用方法update_toc0 <toc0_file> <config_file>
参数说明

toc0_file:输入的toc0 文件

config_file:输入的系统配置文件

应用举例update_toc0 toc0.fex sys_config.bin

update_uboot

工具名称update_uboot
功能说明从系统配置文件中取出相关参数对uboot 头部参数进行修正。修正参数包括:UART 参数、TWI 参数、target 参数、SDCARD 参数等。
使用方法

update_uboot <uboot_file> <config_file>

update_uboot -merge <uboot_file> <config_file>

update_uboot -no_merge <uboot_file> <config_file>

参数说明

uboot_file:要更新的uboot 文件

config_file:系统配置文件

-merge:系统配置文件会拼接在uboot 文件尾部

-no_merge:系统配置文件不会拼接在uboot 文件尾部

注意:没有显式指明-no_merge 参数默认会把系统配置文件拼接在uboot 文件尾部

应用举例

update_uboot u-boot.fex sys_config.bin

update_uboot -merge u-boot.fex sys_config.bin

update_uboot -no_merge u-boot.fex sys_config.bin

fsbuild

工具名称fsbuild
功能说明根据boot-resource.ini 生成fat 格式文件。
使用方法fsbuild <rootfs_config_file> <magic_file>
参数说明

rootfs_config_file:fat 系统配置文件

magic:用于fat 文件系统校验

应用举例fsbuild boot-resource.ini split_xxxx.fex

dragon

工具名称dragon
功能说明根据img 配置文件和分区配置文件生成固件。
使用方法dragon <img_config> <partition_file>
参数说明

img_config:配置文件,描述img 文件格式和包含其他文件列表

partition_file:分区配置文件

应用举例dragon image.cfg sys_partition.fex

Tina_Linux打包流程说明指南_new-腾讯云开发者社区-腾讯云

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李小白20200202

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值