packaging: update version from 2021.10 to 2022.10
[platform/kernel/u-boot.git] / packaging / u-boot-amlogic.spec
1 %define TARGET_VIM3 tizen-khadas-vim3
2 %define TARGET_VIM3L tizen-khadas-vim3l
3 %define TARGET_ODROID_N2 tizen-odroid-n2
4 %define TARGET_ODROID_C4 tizen-odroid-c4
5
6 Name: u-boot-amlogic
7 Version: 2022.10
8 Release: 0
9 Summary: Das U-Boot - Tizen bootloader
10 Group: System/Kernel
11 License: GPL-2.0+
12 ExclusiveArch: aarch64
13 URL: https://source.denx.de/u-boot/u-boot.git
14 Source0: u-boot-%{version}.tar.bz2
15 Source1001: u_boot_amlogic.manifest
16
17 BuildRequires: gcc >= 6.0
18 BuildRequires: bc
19 BuildRequires: flex
20 BuildRequires: bison
21 BuildRequires: libopenssl1.1-devel
22
23 %description
24 u-boot - Tizen bootloader for Embedded boards based on ARM processor
25
26 %package -n u-boot-amlogic-common
27 Summary: U-boot Amlogic Common Files
28 Group: System/Kernel
29 License: GPL-2.0+
30
31 %description -n u-boot-amlogic-common
32 u-boot-amlogic-common - Tizen Amlogic Boot Script, Tizen Logo Image, and common files
33
34 %package -n u-boot-c4
35 Summary: Das U-Boot - Tizen bootloader
36 Group: System/Kernel
37 License: GPL-2.0+
38 Requires: u-boot-amlogic-common
39
40 %description -n u-boot-c4
41 u-boot-c4 - Tizen bootloader for Embedded boards based on ARM processor
42
43 %package -n u-boot-n2
44 Summary: Das U-Boot - Tizen bootloader
45 Group: System/Kernel
46 License: GPL-2.0+
47 Requires: u-boot-amlogic-common
48
49 %description -n u-boot-n2
50 u-boot-n2 - Tizen bootloader for Embedded boards based on ARM processor
51
52 %package -n u-boot-vim3
53 Summary: Das U-Boot - Tizen bootloader
54 Group: System/Kernel
55 License: GPL-2.0+
56 Requires: u-boot-amlogic-common
57
58 %description -n u-boot-vim3
59 u-boot-vim3 - Tizen bootloader for Embedded boards based on ARM processor
60
61 %package -n u-boot-vim3l
62 Summary: Das U-Boot - Tizen bootloader
63 Group: System/Kernel
64 License: GPL-2.0+
65 Requires: u-boot-amlogic-common
66
67 %description -n u-boot-vim3l
68 u-boot-vim3l - Tizen bootloader for Embedded boards based on ARM processor
69
70 %define TARGETS %{TARGET_VIM3} %{TARGET_VIM3L} %{TARGET_ODROID_N2} %{TARGET_ODROID_C4}
71
72 %prep
73 %setup -q -n u-boot-%{version}
74
75 %build
76 %{?asan:/usr/bin/gcc-unforce-options}
77 cp %{SOURCE1001} .
78
79 for i in %{TARGETS}; do
80         target=$i
81         case $target in
82         tizen-odroid-n2)
83                 FIP=fip/n2
84                 ENCRYPT=fip/aml_encrypt_g12b
85                 OUTPUT_BIN=u-boot-n2.bin
86                 PARAMS=params-n2.bin
87         ;;
88         tizen-odroid-c4)
89                 FIP=fip/c4
90                 ENCRYPT=fip/aml_encrypt_g12a
91                 OUTPUT_BIN=u-boot-c4.bin
92                 PARAMS=params-c4.bin
93         ;;
94         tizen-khadas-vim3)
95                 FIP=fip/kvim3
96                 ENCRYPT=fip/aml_encrypt_g12b
97                 OUTPUT_BIN=u-boot-vim3.bin
98                 PARAMS=params-vim3.bin
99         ;;
100         tizen-khadas-vim3l)
101                 FIP=fip/kvim3l
102                 ENCRYPT=fip/aml_encrypt_g12a
103                 OUTPUT_BIN=u-boot-vim3l.bin
104                 PARAMS=params-vim3l.bin
105         ;;
106         esac
107         # Make directory
108         mkdir -p %{_builddir}/${target}
109
110         ## 1. Build ##
111         # 1-0. Clean
112         make mrproper
113
114         # 1-2. Set configuration
115         make ${target}_defconfig
116
117         # 1-3. Build tools
118         make %{?_smp_mflags} HOSTCC="gcc $RPM_OPT_FLAGS" HOSTSTRIP=/bin/true tools
119
120         make HOSTCC="gcc $RPM_OPT_FLAGS" envtools
121
122         # 1-4. Build u-boot
123         export PATH="$PATH:tools:"
124         make %{?_smp_mflags} EXTRAVERSION=`echo %{vcs} | sed 's/.*u-boot.*#\(.\{9\}\).*/-g\1-TIZEN.org/'`
125
126         # 1-5. Encryption
127         chmod +x ${ENCRYPT}
128         ${ENCRYPT} --bl3sig --input u-boot.bin --compress lz4 \
129                                         --output ${FIP}/bl33.bin.enc \
130                                         --level v3 --type bl33 --compress lz4
131         ${ENCRYPT} --bootmk \
132                 --output %{_builddir}/${target}/${OUTPUT_BIN} \
133                 --bl2 ${FIP}/bl2.n.bin.sig \
134                 --bl30 ${FIP}/bl30_new.bin.enc \
135                 --bl31 ${FIP}/bl31.img.enc \
136                 --bl33 ${FIP}/bl33.bin.enc \
137                 --ddrfw1 ${FIP}/ddr4_1d.fw \
138                 --ddrfw2 ${FIP}/ddr4_2d.fw \
139                 --ddrfw3 ${FIP}/ddr3_1d.fw \
140                 --ddrfw4 ${FIP}/piei.fw \
141                 --ddrfw5 ${FIP}/lpddr4_1d.fw \
142                 --ddrfw6 ${FIP}/lpddr4_2d.fw \
143                 --ddrfw7 ${FIP}/diag_lpddr4.fw \
144                 --ddrfw8 ${FIP}/aml_ddr.fw \
145                 --level v3
146
147         # 1-6. Generate params.bin
148         ./scripts/get_default_envs.sh > default_envs.txt
149         mkenvimage -s 16384 -o ${PARAMS} default_envs.txt
150         rm default_envs.txt
151 done
152
153 # 1-7. Build Boot script
154 mkimage -A arm64 -T script -C none -n "Tizen Amlogic u-boot helper" -d ./tizen/bootscript/tizen-boot-amlogic-64b.scr ./boot.scr.uimg
155
156 %install
157 rm -rf %{buildroot}
158
159 # 2. u-boot installation
160
161 mkdir -p %{buildroot}/boot
162 mkdir -p %{buildroot}/var/tmp/u-boot-amlogic
163 install -d %{buildroot}/var/tmp/u-boot-amlogic
164
165 for i in %{TARGETS}; do
166         target=$i
167         case $target in
168         tizen-odroid-n2)
169                 OUTPUT_BIN=u-boot-n2.bin
170                 PARAMS=params-n2.bin
171         ;;
172         tizen-odroid-c4)
173                 OUTPUT_BIN=u-boot-c4.bin
174                 PARAMS=params-c4.bin
175         ;;
176         tizen-khadas-vim3)
177                 OUTPUT_BIN=u-boot-vim3.bin
178                 PARAMS=params-vim3.bin
179         ;;
180         tizen-khadas-vim3l)
181                 OUTPUT_BIN=u-boot-vim3l.bin
182                 PARAMS=params-vim3l.bin
183         ;;
184         esac
185
186         install -m 755 %{_builddir}/$target/$OUTPUT_BIN %{buildroot}/var/tmp/u-boot-amlogic
187         install -m 755 $PARAMS %{buildroot}/boot
188 done
189
190 install -m 755 boot.scr.uimg %{buildroot}/boot
191 install -m 755 images/tizen_logo.bmp.gz %{buildroot}/boot
192
193 %clean
194 rm -rf %{_builddir}
195
196 %files -n u-boot-amlogic-common
197 %manifest u_boot_amlogic.manifest
198 %defattr(-,root,root,-)
199 /boot/boot.scr.uimg
200 /boot/tizen_logo.bmp.gz
201
202 %files -n u-boot-c4
203 %manifest u_boot_amlogic.manifest
204 %defattr(-,root,root,-)
205 /var/tmp/u-boot-amlogic/u-boot-c4.bin
206 /boot/params-c4.bin
207
208 %files -n u-boot-n2
209 %manifest u_boot_amlogic.manifest
210 %defattr(-,root,root,-)
211 /var/tmp/u-boot-amlogic/u-boot-n2.bin
212 /boot/params-n2.bin
213
214 %files -n u-boot-vim3
215 %manifest u_boot_amlogic.manifest
216 %defattr(-,root,root,-)
217 /var/tmp/u-boot-amlogic/u-boot-vim3.bin
218 /boot/params-vim3.bin
219
220 %files -n u-boot-vim3l
221 %manifest u_boot_amlogic.manifest
222 %defattr(-,root,root,-)
223 /var/tmp/u-boot-amlogic/u-boot-vim3l.bin
224 /boot/params-vim3l.bin