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