xref: /rk3399_rockchip-uboot/arch/arm/mach-rockchip/make_fit_boot.sh (revision effae6d71544d6cab5ae01aa7160bb709b3a3e6e)
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	gzip -k -f -9 ${srctree}/images/ramdisk
18	SUFFIX=".gz"
19else
20	COMPRESSION="none"
21	SUFFIX=
22fi
23
24cat << EOF
25/*
26 * Copyright (C) 2020 Fuzhou Rockchip Electronics Co., Ltd
27 *
28 * Minimal dts for a FIT image.
29 *
30 * SPDX-License-Identifier: GPL-2.0
31 */
32
33/dts-v1/;
34/ {
35	description = "FIT source file for Linux";
36	#address-cells = <1>;
37
38	images {
39		fdt {
40			data = /incbin/("./images/rk-kernel.dtb");
41			type = "flat_dt";
42			arch = "${ARCH}";
43			compression = "none";
44			load  = <0xffffff00>;
45			hash {
46				algo = "sha256";
47			};
48		};
49
50		kernel {
51EOF
52echo "			data = /incbin/(\"./images/kernel${SUFFIX}\");"
53echo "			compression = \"${COMPRESSION}\";"
54cat << EOF
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 {
66EOF
67echo "			data = /incbin/(\"./images/ramdisk${SUFFIX}\");"
68echo "			compression = \"${COMPRESSION}\";"
69cat << EOF
70			type = "ramdisk";
71			arch = "${ARCH}";
72			os = "linux";
73			load  = <0xffffff02>;
74			hash {
75				algo = "sha256";
76			};
77		};
78
79		resource {
80			data = /incbin/("./images/resource");
81			type = "multi";
82			arch = "${ARCH}";
83			compression = "none";
84			hash {
85				algo = "sha256";
86			};
87		};
88	};
89
90	configurations {
91		default = "conf";
92		conf {
93			description = "Boot Linux kernel with FDT blob";
94			rollback-index = <0x0>;
95			fdt = "fdt";
96			kernel = "kernel";
97			ramdisk = "ramdisk";
98			multi = "resource";
99			signature {
100				algo = "sha256,rsa2048";
101				padding = "pss";
102				key-name-hint = "dev";
103				sign-images = "fdt", "kernel", "ramdisk", "multi";
104			};
105		};
106	};
107};
108
109EOF
110