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