什么是FIT格式?
全称是flattened image tree uImage,为了更好的支持单个固件的通用性,类似于kernel device tree机制,uboot也需要对这种uImage固件进行支 持。FIT uImage中加入多个dtb文件,和ramdisak文件,当然如果需要的话,同样可以支持多个kernel文件。
## 需要准备的文件和工具
1. DTC工具
2. mkimage
3. image (在arch/arm/boot目录下)
4. 设备树文件
5. .its文件
以上前四个文件在传统生成系统镜像文件都会得到,这里不再介绍。下面着重介绍.its文件的制作。
生成its文件
在uboot/juboot-1.0/doc/uImage.FIT目录下有生成好的kernel.its 文件,我们可以参考它制作我们自己需要的.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";
};
};
};
为了适应我们自己的平台,我们需要对以下几点进行修改:
1.关于内核的描述kernel 节点
- data = /incbin/("./Image"); 表示当前目录下的Imange文件
- arch = “ppc”; 对应写上自己的架构
- load = <0x00008000>; entry = <0x00008000>;装载地址和入口地址
2 . 关于设备树的描述
- data = /incbin/("./system.dtb");
- arch = “arm”;
生成最终系统镜像
mkimage -f xx.its xx.ub
注意!!
在工作目录中要有描述文件中所描述的文件:xx.dtb image xx.its