xref: /rk3399_rockchip-uboot/arch/arm/mach-rockchip/make_fit_boot.sh (revision 9d5c314b35defd1c678227deba13c3b4dfd4a0f3)
1#!/bin/bash
2#
3# Copyright (C) 2020 Rockchip Electronics Co., Ltd
4#
5# SPDX-License-Identifier:     GPL-2.0+
6#
7
8# Process args and auto set variables
9source ./${srctree}/arch/arm/mach-rockchip/make_fit_args.sh
10
11if [ ! -f ${srctree}/images/ramdisk ]; then
12	touch ${srctree}/images/ramdisk
13fi
14
15if [ "${COMPRESSION}" == "gzip" ]; then
16	gzip -k -f -9 ${srctree}/images/kernel
17	SUFFIX=".gz"
18elif [ "${COMPRESSION}" == "lz4" ]; then
19	lz4c -9 -f ${srctree}/images/kernel > ${srctree}/images/kernel.lz4
20	SUFFIX=".lz4"
21else
22	COMPRESSION="none"
23	SUFFIX=
24fi
25
26cat << EOF
27/*
28 * Copyright (C) 2020 Fuzhou Rockchip Electronics Co., Ltd
29 *
30 * Minimal dts for a FIT image.
31 *
32 * SPDX-License-Identifier: GPL-2.0
33 */
34
35/dts-v1/;
36/ {
37	description = "FIT source file for Linux";
38	#address-cells = <1>;
39
40	images {
41		fdt {
42			data = /incbin/("./images/rk-kernel.dtb");
43			type = "flat_dt";
44			arch = "${ARCH}";
45			compression = "none";
46			load  = <0xffffff00>;
47			hash {
48				algo = "sha256";
49			};
50		};
51
52		kernel {
53			data = /incbin/("./images/kernel${SUFFIX}");
54			compression = "${COMPRESSION}";
55			type = "kernel";
56			arch = "${ARCH}";
57			os = "linux";
58			entry = <0xffffff01>;
59			load  = <0xffffff01>;
60			hash {
61				algo = "sha256";
62			};
63		};
64
65		ramdisk {
66			data = /incbin/("./images/ramdisk");
67			compression = "none";
68			type = "ramdisk";
69			arch = "${ARCH}";
70			os = "linux";
71			load  = <0xffffff02>;
72			hash {
73				algo = "sha256";
74			};
75		};
76
77		resource {
78			data = /incbin/("./images/resource");
79			type = "multi";
80			arch = "${ARCH}";
81			compression = "none";
82			hash {
83				algo = "sha256";
84			};
85		};
86	};
87
88	configurations {
89		default = "conf";
90		conf {
91			description = "Boot Linux kernel with FDT blob";
92			rollback-index = <0x0>;
93			fdt = "fdt";
94			kernel = "kernel";
95			ramdisk = "ramdisk";
96			multi = "resource";
97			signature {
98				algo = "sha256,rsa2048";
99				padding = "pss";
100				key-name-hint = "dev";
101				sign-images = "fdt", "kernel", "ramdisk", "multi";
102			};
103		};
104	};
105};
106
107EOF
108