在构建FIT镜像时,需要将ramdisk放在initrd子节点中,并在bootargs中指定initrd的位置和大小。
示例代码:
/dts-v1/;
/ {
description = "FIT image with Linux kernel, DTB and ramdisk";
#address-cells = <1>;
#size-cells = <1>;
images {
kernel {
description = "Linux kernel";
data = /incbin/("zImage");
type = "kernel";
arch = "arm";
os = "linux";
compression = "gzip";
load = <0x80008000>;
entry = <0x80008000>;
hash {
algo = "sha1";
};
};
fdt {
description = "Flattened Device Tree blob";
data = /incbin/("device-tree.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash {
algo = "sha1";
};
};
ramdisk {
description = "Initial RAMdisk";
data = /incbin/("ramdisk.cpio.gz");
type = "ramdisk";
arch = "arm";
os = "linux";
compression = "gzip";
load = <0x82000000>;
entry = <0x82000000>;
hash {
algo = "sha1";
};
};
};
configurations {
default = "conf";
conf {
description = "Boot Linux kernel with DTB and ramdisk";
kernel = "kernel";
fdt = "fdt";
ramdisk {
description = "initramfs";
image = "ramdisk";
type = "initrd";
arch = "arm";
os = "linux";
compression = "gzip";
};
signature {
algo = "sha1,rsa2048";
key-name-hint = "test-key";
sign-images = "kernel,fdt,ramdisk";
};
};
};
}
在U-Boot中使用命令bootefi启动:
setenv bootargs "console=ttyS0,115200n8 root=/dev/ram0 rw rdinit=/sbin/init"
bootefi 0x82000000:$filesize