FIT Image 配置和启动
Read time: 2 minute(s)
FIT,即 Flattened Image Tree,是参考 Flattened Device Tree 命令而来,具有以下优势。
-
更灵活的处理各种类型的 image 类型(压缩、非压缩、各种格式,各种配置组合)
-
可以处理安全启动过程中的安全校验(签名校验)
FIT
原始参考文档如下:
source/uboot-2021.10/doc/usage/fit.rst source/uboot-2021.10/doc/uImage.FIT/howto.txt source/uboot-2021.10/doc/uImage.FIT/source_file_format.txt source/uboot-2021.10/doc/uImage.FIT/command_syntax_extensions.txt
Flattened Image Tree,使用 DTS 的语法, 通过一些新增的节点,描述生成镜像文件所使用的 Image 文件和配置。下文以
source/uboot-2021.10/doc/uImage.FIT/kernel_fdt.its
为例进行说明:
/dts-v1/; / { description = "Simple image with single Linux kernel and FDT blob"; #address-cells = <1>; images { kernel { description = "Vanilla Linux kernel"; data = /incbin/("./vmlinux.bin.gz"); type = "kernel"; arch = "ppc"; os = "linux"; compression = "gzip"; load = <00000000>; entry = <00000000>; hash-1 { algo = "crc32"; }; hash-2 { algo = "sha1"; }; }; fdt-1 { description = "Flattened Device Tree blob"; data = /incbin/("./target.dtb"); type = "flat_dt"; arch = "ppc"; compression = "none"; hash-1 { algo = "crc32"; }; hash-2 { algo = "sha1"; }; }; }; configurations { default = "conf-1"; conf-1 { description = "Boot Linux kernel with FDT blob"; kernel = "kernel"; fdt = "fdt-1"; }; }; };
上述示例包含了其中包含了 fdt + kernel,以及校验方式的配置。
FIT image 启动命令说明如下:
-
生成 itb image 的命令:
mkimage -f kernel_fdt.its kernel_fdt.itb
-
使用默认的配置进行启动:
bootm <kernel itb addr>
-
如果 its 中有多个配置,可以指定启动的配置组合,例如 bootm 0x81000000#conf-2。
bootm <kernel itb addr>#<conf-name>
更多说明请参考:source/uboot-2021.10/doc/uImage.FIT/command_syntax_extensions.txt