掌機 - Miyoo Flip - Repack U-Boot FIT Image



參考資訊:
https://opensource.rock-chips.com/wiki_Main_Page

方法如下:

$ ./mkimage -f u-boot.its -E uboot.itb
$ cat uboot.itb > uboot.img
$ truncate -s %2048K uboot.img
$ cat uboot.itb > uboot.img
$ truncate -s %2048K uboot.img

u-boot.its

/*
 * Copyright (C) 2020 Rockchip Electronic Co.,Ltd
 *
 * Simple U-boot fit source file containing ATF/OP-TEE/U-Boot/dtb/MCU
 */

/dts-v1/;

/ {
	description = "FIT Image with ATF/OP-TEE/U-Boot/MCU";
	#address-cells = <1>;

	images {

		uboot {
			description = "U-Boot";
			data = /incbin/("u-boot-nodtb.bin");
			type = "standalone";
			arch = "arm64";
			os = "U-Boot";
			compression = "none";
			load = <0x00a00000>;
			hash {
				algo = "sha256";
			};
		};
		atf-1 {
			description = "ARM Trusted Firmware";
			data = /incbin/("./bl31_0x00040000.bin");
			type = "firmware";
			arch = "arm64";
			os = "arm-trusted-firmware";
			compression = "none";
			load = <0x00040000>;
			hash {
				algo = "sha256";
			};
		};
		atf-2 {
			description = "ARM Trusted Firmware";
			data = /incbin/("./bl31_0xfdcc1000.bin");
			type = "firmware";
			arch = "arm64";
			os = "arm-trusted-firmware";
			compression = "none";
			load = <0xfdcc1000>;
			hash {
				algo = "sha256";
			};
		};
		atf-3 {
			description = "ARM Trusted Firmware";
			data = /incbin/("./bl31_0x0006b000.bin");
			type = "firmware";
			arch = "arm64";
			os = "arm-trusted-firmware";
			compression = "none";
			load = <0x0006b000>;
			hash {
				algo = "sha256";
			};
		};
		atf-4 {
			description = "ARM Trusted Firmware";
			data = /incbin/("./bl31_0xfdcd0000.bin");
			type = "firmware";
			arch = "arm64";
			os = "arm-trusted-firmware";
			compression = "none";
			load = <0xfdcd0000>;
			hash {
				algo = "sha256";
			};
		};
		atf-5 {
			description = "ARM Trusted Firmware";
			data = /incbin/("./bl31_0xfdcce000.bin");
			type = "firmware";
			arch = "arm64";
			os = "arm-trusted-firmware";
			compression = "none";
			load = <0xfdcce000>;
			hash {
				algo = "sha256";
			};
		};
		atf-6 {
			description = "ARM Trusted Firmware";
			data = /incbin/("./bl31_0x00069000.bin");
			type = "firmware";
			arch = "arm64";
			os = "arm-trusted-firmware";
			compression = "none";
			load = <0x00069000>;
			hash {
				algo = "sha256";
			};
		};
		optee {
			description = "OP-TEE";
			data = /incbin/("tee.bin");
			type = "firmware";
			arch = "arm64";
			os = "op-tee";
			compression = "none";
			
			load = <0x8400000>;
			hash {
				algo = "sha256";
			};
		};
		fdt {
			description = "U-Boot dtb";
			data = /incbin/("./u-boot.dtb");
			type = "flat_dt";
			arch = "arm64";
			compression = "none";
			hash {
				algo = "sha256";
			};
		};
	};

	configurations {
		default = "conf";
		conf {
			description = "rk3568-evb";
			rollback-index = <0x0>;
			firmware = "atf-1";
			loadables = "uboot", "atf-2", "atf-3", "atf-4", "atf-5", "atf-6", "optee";
			
			fdt = "fdt";
			signature {
				algo = "sha256,rsa2048";
				
				key-name-hint = "dev";
				sign-images = "fdt", "firmware", "loadables";
			};
		};
	};
};