生成FIT格式的系統鏡像

什麼是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 節點

  1. data = /incbin/("./Image"); 表示當前目錄下的Imange文件
  2. arch = “ppc”; 對應寫上自己的架構
  3. load = <0x00008000>; entry = <0x00008000>;裝載地址和入口地址

2 . 關於設備樹的描述

  1. data = /incbin/("./system.dtb");
  2. arch = “arm”;

生成最終系統鏡像

mkimage -f xx.its xx.ub

注意!!

 在工作目錄中要有描述文件中所描述的文件:xx.dtb image xx.its

最後配置uboot使其支持FIT格式系統鏡像。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章