File u-boot-udoo.spec of Package u-boot-rock960-rk3399
328
1
#
2
# spec file for package u-boot-udoo
3
#
4
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
5
# Copyright (c) 2010 Texas Instruments Inc by Nishanth Menon
6
# Copyright (c) 2007-2010 by Silvan Calarco <silvan.calarco@mambasoft.it>
7
#
8
# All modifications and additions to the file contributed by third parties
9
# remain the property of their copyright owners, unless otherwise agreed
10
# upon. The license for this file, and modifications and additions to the
11
# file, is the same license as for the pristine package itself (unless the
12
# license for the pristine package is not an Open Source License, in which
13
# case the license is the MIT License). An "Open Source License" is a
14
# license that conforms to the Open Source Definition (Version 1.9)
15
# published by the Open Source Initiative.
16
17
# Please submit bugfixes or comments via https://bugs.opensuse.org/
18
#
19
20
21
%bcond_with uboot_atf
22
%bcond_with uboot_atf_pine64
23
24
%define mvebu_spl 0
25
%define x_loader 0
26
%define rockchip_spl 0
27
%define sunxi_spl 0
28
%define arndale_spl 0
29
%define origen_spl 0
30
%define imx6_spl 1
31
%define socfpga_spl 0
32
33
%if "udoo" == "rpi" || "udoo" == "rpi2" || "udoo" == "rpi3"
34
%define is_rpi 1
35
%endif
36
%if "udoo" == "evb-rk3399" || "udoo" == "firefly-rk3399" || "udoo" == "puma-rk3399" || "udoo" == "rock960-rk3399"
37
%define is_rk3399 1
38
%endif
39
%if "udoo" == "bananapim64" || "udoo" == "nanopia64" || "udoo" == "pine64plus" || "udoo" == "pinebook"
40
%define is_a64 1
41
%endif
42
%if "udoo" == "orangepipc2"
43
%define is_h5 1
44
%endif
45
%if "udoo" == "pineh64"
46
%define is_h6 1
47
%endif
48
49
# archive_version differs from version for RC version only
50
%define archive_version 2019.01
51
52
Name: u-boot-udoo
53
Version: 2019.01
54
Release: 0
55
Summary: The U-Boot firmware for the udoo platform
56
License: GPL-2.0-only
57
Group: System/Boot
58
Url: http://www.denx.de/wiki/U-Boot
59
Source: ftp://ftp.denx.de/pub/u-boot/u-boot-%{archive_version}.tar.bz2
60
Source1: ftp://ftp.denx.de/pub/u-boot/u-boot-%{archive_version}.tar.bz2.sig
61
Source2: arndale-bl1.img
62
Source3: update_git.sh
63
Source300: u-boot-rpmlintrc
64
Patch0001: 0001-XXX-openSUSE-XXX-Prepend-partition-.patch
65
Patch0002: 0002-Revert-Revert-omap3-Use-raw-SPL-by-.patch
66
Patch0003: 0003-rpi-Use-firmware-provided-device-tr.patch
67
Patch0004: 0004-Temp-workaround-for-Chromebook-snow.patch
68
Patch0005: 0005-zynqmp-Add-generic-target.patch
69
Patch0006: 0006-tools-zynqmpbif-Add-support-for-loa.patch
70
Patch0007: 0007-boo-1123170-Remove-ubifs-support-fr.patch
71
Patch0008: 0008-zynqmp-generic-fix-compilation.patch
72
Patch0009: 0009-efi_loader-Fix-serial-console-size-.patch
73
Patch0010: 0010-CVE-2019-13106-ext4-fix-out-of-boun.patch
74
Patch0011: 0011-CVE-2019-13104-ext4-check-for-under.patch
75
Patch0012: 0012-rpi-add-Compute-Module-3.patch
76
Patch0013: 0013-usb_kdb-only-process-events-success.patch
77
Patch0014: 0014-usb-usb_submit_int_msg-usb_int_msg.patch
78
Patch0015: 0015-usb-storage-submit_int_msg-usb_int_.patch
79
Patch0016: 0016-usb-Add-nonblock-argument-to-submit.patch
80
Patch0017: 0017-dwc2-use-the-nonblock-argument-in-s.patch
81
Patch0018: 0018-CVE-net-fix-unbounded-memcpy-of-UDP.patch
82
Patch0019: 0019-CVE-nfs-fix-stack-based-buffer-over.patch
83
Patch0020: 0020-CVE-2019-14194-CVE-2019-14198-nfs-f.patch
84
Patch0021: 0021-CVE-2019-14195-nfs-fix-unbounded-me.patch
85
Patch0022: 0022-CVE-2019-14196-nfs-fix-unbounded-me.patch
86
Patch0023: 0023-CVE-2019-13103-disk-stop-infinite-r.patch
87
Patch0024: 0024-cmd-gpt-Address-error-cases-during-.patch
88
Patch0025: 0025-Fix-ext4-block-group-descriptor-siz.patch
89
Patch0026: 0026-lib-uuid-Fix-unseeded-PRNG-on-RANDO.patch
90
Patch0027: 0027-image-Check-hash-nodes-when-checkin.patch
91
Patch0028: 0028-image-Load-the-correct-configuratio.patch
92
BuildRoot: %{_tmppath}/%{name}-%{version}-build
93
%if 0%{?is_rk3399} && %{with uboot_atf}
94
BuildRequires: arm-trusted-firmware-rk3399
95
%endif
96
%if (0%{?is_a64} || 0%{?is_h5}) && %{with uboot_atf}
97
BuildRequires: arm-trusted-firmware-sun50ia64
98
%endif
99
%if 0%{?is_h6} && %{with uboot_atf}
100
BuildRequires: arm-trusted-firmware-sun50ih6
101
%endif
102
BuildRequires: bc
103
BuildRequires: bison
104
# Arndale board needs DTC >= 1.4
105
BuildRequires: dtc >= 1.4.0
106
BuildRequires: flex
107
# u-boot-clearfog (tools/kwbimage.c) needs openssl to build
108
BuildRequires: libopenssl-devel
109
BuildRequires: python-devel
110
%if %{with uboot_atf}
111
%if "%{name}" == "u-boot-evb-rk3399" || "%{name}" == "u-boot-firefly-rk3399"
112
# make_fit_atf.py
113
BuildRequires: python-pyelftools
114
%endif
115
%endif
116
BuildRequires: swig
117
%if "%{name}" == "u-boot-qemu-ppce500"
118
# Owns /usr/share/qemu directory
119
BuildRequires: qemu
120
Provides: qemu-ppc:%{_datadir}/qemu/u-boot.e500
121
%endif
122
%if 0%{?is_rpi}
123
# Owns /boot/vc directory
124
BuildRequires: raspberrypi-firmware
125
%endif
126
%if "%{name}" == "u-boot-zynqmp"
127
BuildRequires: zynqmp-dts
128
%endif
129
%if 0%{?is_rpi}
130
# For mountpoint
131
Requires(post): util-linux
132
%endif
133
Provides: u-boot-loader
134
Conflicts: otherproviders(u-boot-loader)
135
%if %x_loader == 1
136
Obsoletes: x-loader-udoo
137
Provides: x-loader-udoo
138
%endif
139
ExclusiveArch: armv7l armv7hl
140
141
%description
142
Das U-Boot (or just "U-Boot" for short) is Open Source Firmware for Embedded PowerPC, ARM, MIPS and x86 processors.
143
This package contains the firmware for the udoo platform.
144
145
%package doc
146
Summary: Documentation for the U-Boot Firmware
147
Group: Documentation/Other
148
149
%description doc
150
Das U-Boot (or just "U-Boot" for short) is Open Source Firmware for Embedded PowerPC, ARM, MIPS and x86 processors.
151
This package contains documentation for U-Boot firmware.
152
153
%prep
154
%setup -q -n u-boot-%{archive_version}
155
%patch0001 -p1
156
%patch0002 -p1
157
%patch0003 -p1
158
%patch0004 -p1
159
%patch0005 -p1
160
%patch0006 -p1
161
%patch0007 -p1
162
%patch0008 -p1
163
%patch0009 -p1
164
%patch0010 -p1
165
%patch0011 -p1
166
%patch0012 -p1
167
%patch0013 -p1
168
%patch0014 -p1
169
%patch0015 -p1
170
%patch0016 -p1
171
%patch0017 -p1
172
%patch0018 -p1
173
%patch0019 -p1
174
%patch0020 -p1
175
%patch0021 -p1
176
%patch0022 -p1
177
%patch0023 -p1
178
%patch0024 -p1
179
%patch0025 -p1
180
%patch0026 -p1
181
%patch0027 -p1
182
%patch0028 -p1
183
184
%build
185
export SOURCE_DATE_EPOCH=$(date -d "$(head -n 2 %{_sourcedir}/%{name}.changes | tail -n 1 | cut -d- -f1 )" +%s)
186
%if 0%{?is_a64} || 0%{?is_h5}
187
export BL31=/usr/share/arm-trusted-firmware-sun50ia64/bl31.bin
188
%endif
189
%if 0%{?is_h6}
190
export BL31=/usr/share/arm-trusted-firmware-sun50ih6/bl31.bin
191
%endif
192
193
%if %{with uboot_atf}
194
%if "%{name}" == "u-boot-evb-rk3399" || "%{name}" == "u-boot-firefly-rk3399"
195
cp /usr/share/arm-trusted-firmware-rk3399/bl31.elf .
196
%endif
197
%endif
198
199
make %{?_smp_mflags} CROSS_COMPILE= HOSTCFLAGS="$RPM_OPT_FLAGS" udoo_defconfig
200
echo "Attempting to enable fdt apply command (.dtbo) support."
201
echo "CONFIG_OF_LIBFDT_OVERLAY=y" >> .config
202
make %{?_smp_mflags} CROSS_COMPILE= HOSTCFLAGS="$RPM_OPT_FLAGS" \
203
%if ("%{name}" == "u-boot-evb-rk3399" || "%{name}" == "u-boot-firefly-rk3399") && %{with uboot_atf}
204
all u-boot.itb
205
%else
206
all
207
%endif
208
209
%ifarch aarch64
210
%if %sunxi_spl == 1
211
cat spl/sunxi-spl.bin u-boot.itb > u-boot-sunxi-with-spl.bin
212
%endif
213
%endif
214
215
%if "%{name}" == "u-boot-snow" || "%{name}" == "u-boot-spring"
216
# Chromebook ARM (snow) and HP Chromebook 11 (spring) need a uImage format
217
export TEXT_START=$(awk '$NF == "_start" { printf "0x"$1 }' System.map)
218
./tools/mkimage -A arm -O linux -T kernel -C none -a $TEXT_START -e $TEXT_START -n uboot -d u-boot-dtb.bin u-boot.img
219
%endif
220
221
%if %rockchip_spl == 1
222
for t in ; do
223
./tools/mkimage -n -d spl/u-boot-spl.bin -T $t u-boot-spl.$t
224
done
225
%endif
226
227
%install
228
export SOURCE_DATE_EPOCH=$(date -d "$(head -n 2 %{_sourcedir}/%{name}.changes | tail -n 1 | cut -d- -f1 )" +%s)
229
export NO_BRP_STRIP_DEBUG=true
230
export NO_DEBUGINFO_STRIP_DEBUG=true
231
%define uboot_dir /boot
232
%if 0%{?is_rpi}
233
%define uboot_dir /boot/vc
234
%endif
235
%if "%{name}" == "u-boot-qemu-ppce500"
236
%define uboot_dir %{_datadir}/qemu
237
%endif
238
%if "%{name}" == "u-boot-jetson-tk1"
239
# tegra-uboot-flasher needs several intermediate files, under their original name.
240
for f in u-boot u-boot.dtb u-boot-dtb-tegra.bin u-boot-nodtb-tegra.bin spl/u-boot-spl; do
241
install -D -m 0644 $f %{buildroot}%{uboot_dir}/$f
242
done
243
%else
244
%if "%{name}" == "u-boot-p2371-2180"
245
# Jetson TX1 Driver Pack flash.sh needs several intermediate files, under their original name.
246
for f in u-boot u-boot.bin u-boot.dtb u-boot-dtb.bin; do
247
install -D -m 0644 $f %{buildroot}%{uboot_dir}/$f
248
done
249
%else
250
install -D -m 0644 u-boot.img %{buildroot}%{uboot_dir}/u-boot.img
251
%if ("%{name}" == "u-boot-evb-rk3399" || "%{name}" == "u-boot-firefly-rk3399") && %{with uboot_atf}
252
install -D -m 0644 u-boot.itb %{buildroot}%{uboot_dir}/u-boot.itb
253
%endif
254
%if "%{name}" == "u-boot-qemu-ppce500"
255
mv %{buildroot}%{uboot_dir}/u-boot.img %{buildroot}%{uboot_dir}/u-boot.e500
256
%endif
257
%endif
258
%endif
259
%if %x_loader == 1
260
install -D -m 0644 MLO %{buildroot}%{uboot_dir}/MLO
261
%endif
262
%if %origen_spl == 1
263
install -D -m 0644 spl/origen-spl.bin %{buildroot}%{uboot_dir}/origen-spl.bin
264
%endif
265
%if %arndale_spl == 1
266
install -D -m 0644 spl/arndale-spl.bin %{buildroot}%{uboot_dir}/arndale-spl.bin
267
install -D -m 0644 %{SOURCE2} %{buildroot}%{uboot_dir}/arndale-bl1.img
268
%endif
269
%if %mvebu_spl == 1
270
install -D -m 0644 u-boot-spl.kwb %{buildroot}%{uboot_dir}/u-boot-spl.kwb
271
%endif
272
%if %rockchip_spl == 1
273
install -D -m 0644 spl/u-boot-spl.bin %{buildroot}%{uboot_dir}/u-boot-spl.bin
274
for t in ; do
275
install -D -m 0644 u-boot-spl.$t %{buildroot}%{uboot_dir}/u-boot-spl.$t
276
done
277
%endif
278
%if %sunxi_spl == 1
279
install -D -m 0644 spl/sunxi-spl.bin %{buildroot}%{uboot_dir}/sunxi-spl.bin
280
install -D -m 0644 u-boot-sunxi-with-spl.bin %{buildroot}%{uboot_dir}/u-boot-sunxi-with-spl.bin
281
%endif
282
%if %imx6_spl == 1
283
install -D -m 0644 SPL %{buildroot}%{uboot_dir}/imx6-spl.bin
284
%endif
285
%if %socfpga_spl == 1
286
install -D -m 0644 u-boot-with-spl.sfp %{buildroot}%{uboot_dir}/u-boot-with-spl.sfp
287
%endif
288
%if "%{name}" == "u-boot-rpi3"
289
echo -e "# Boot in AArch64 mode\narm_control=0x200" > %{buildroot}%{uboot_dir}/ubootconfig.txt
290
%endif
291
292
%if 0%{?is_rpi}
293
%post
294
# On the Raspberry Pi we chain-load u-boot.bin from bootcode.bin via config.txt.
295
# It needs to be on the first FAT partition, wherever we mounted it.
296
# a) Unmounted, then do nothing.
297
# b) Mounted as /boot/vc, then they're in the right place already.
298
# c) Mounted as /boot/efi, with /boot/vc as symlink, then nothing to be done.
299
# d) Mounted as /boot/efi, with /boot/vc a directory, then copy files over.
300
if mountpoint -q /boot/efi; then
301
if ! [[ "$(readlink -f /boot/efi)" -ef "$(readlink -f %{uboot_dir})" ]]; then
302
[ -f %{uboot_dir}/ubootconfig.txt ] && cp %{uboot_dir}/ubootconfig.txt /boot/efi
303
cp %{uboot_dir}/u-boot.img /boot/efi/
304
fi
305
fi
306
%endif
307
308
%files
309
%defattr(-,root,root)
310
%license Licenses/gpl-2.0.txt
311
%doc README
312
%{uboot_dir}/*
313
314
%files doc
315
%defattr(-,root,root)
316
# Generic documents
317
%doc doc/README.JFFS2 doc/README.JFFS2_NAND doc/README.commands
318
%doc doc/README.autoboot doc/README.commands doc/README.console doc/README.dns
319
%doc doc/README.hwconfig doc/README.nand doc/README.NetConsole doc/README.serial_multi
320
%doc doc/README.SNTP doc/README.standalone doc/README.update doc/README.usb
321
%doc doc/README.video doc/README.VLAN doc/README.silent doc/README.POST
322
# Copy some useful kermit scripts as well
323
%doc tools/kermit/dot.kermrc tools/kermit/flash_param tools/kermit/send_cmd tools/kermit/send_image
324
# Now any h/w dependent Documentation
325
%doc doc/README.ARM-memory-map
326
327
%changelog
328