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