blob: 02237d1f05489206a5cab45e21c2ec8bf960bae7 (
plain)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
# Ignore double dash in version for rpmbuild
%define _wrong_version_format_terminate_build 0
%define config_name tizen_bcm2711_defconfig
%define config_name_rt tizen_bcm2711_rt_defconfig
%ifarch aarch64
%define buildarch arm64
%else
%define buildarch arm
%endif
%define target_board rpi4
%define variant %{buildarch}-%{target_board}
Name: rpi4-linux-kernel
Summary: The Linux Kernel for Raspberry Pi4
Version: 6.6.60
Release: 0
License: GPL-2.0
ExclusiveArch: %{arm} aarch64
Group: System/Kernel
Vendor: The Linux Community
URL: https://www.kernel.org
Source0: linux-kernel-%{version}.tar.xz
BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root
%define fullVersion %{version}-%{variant}
BuildRequires: bc
BuildRequires: module-init-tools
BuildRequires: bison
BuildRequires: flex
BuildRequires: pkgconfig(openssl3)
BuildRequires: libunwind-devel
BuildRequires: libdw-devel
BuildRequires: libelf-devel
BuildRequires: elfutils
BuildRequires: xz-devel
BuildRequires: binutils-devel
BuildRequires: python3
BuildRequires: rsync
%description
The Linux Kernel, the operating system core itself
# kernel
%package -n %{variant}-linux-kernel
License: GPL-2.0
Summary: Tizen kernel for %{target_board}
Group: System/Kernel
Provides: %{variant}-kernel-uname-r = %{fullVersion}
Provides: linux-kernel = %{version}-%{release}
%description -n %{variant}-linux-kernel
This package contains the Linux kernel for Tizen (arch %{buildarch}, target board %{target_board})
%package -n %{variant}-rt-linux-kernel
License: GPL-2.0
Summary: Tizen kernel for %{target_board}
Group: System/Kernel
Provides: %{variant}-kernel-uname-r = %{fullVersion}-rt
Provides: linux-kernel = %{version}-%{release}-rt
%description -n %{variant}-rt-linux-kernel
This package contains the Linux kernel for Tizen (arch %{buildarch}, target board %{target_board})
# modules
%package -n %{variant}-linux-kernel-modules
Summary: Kernel modules for %{target_board}
Group: System/Kernel
Provides: %{variant}-kernel-modules = %{fullVersion}
Provides: %{variant}-kernel-modules-uname-r = %{fullVersion}
%description -n %{variant}-linux-kernel-modules
Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board}
%package -n %{variant}-rt-linux-kernel-modules
Summary: Kernel modules for %{target_board}
Group: System/Kernel
Provides: %{variant}-kernel-modules = %{fullVersion}-rt
Provides: %{variant}-kernel-modules-uname-r = %{fullVersion}-rt
%description -n %{variant}-rt-linux-kernel-modules
Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board}
with the PREEMPT_RT patch
# devel
%package -n %{variant}-linux-kernel-devel
License: GPL-2.0
Summary: Linux support kernel map and etc for other packages
Group: System/Kernel
Provides: %{variant}-kernel-devel = %{fullVersion}
Provides: %{variant}-kernel-devel-uname-r = %{fullVersion}
%description -n %{variant}-linux-kernel-devel
This package provides kernel map and etc information.
%package -n %{variant}-rt-linux-kernel-devel
License: GPL-2.0
Summary: Linux support kernel map and etc for other packages
Group: System/Kernel
Provides: %{variant}-kernel-devel = %{fullVersion}-rt
Provides: %{variant}-kernel-devel-uname-r = %{fullVersion}-rt
%description -n %{variant}-rt-linux-kernel-devel
This package provides kernel map and etc information.
#headers
%package -n %{variant}-linux-kernel-headers
License: GPL-2.0
Summary: Linux support headers for userspace development
Group: System/Kernel
Provides: kernel-headers-tizen-dev
%description -n %{variant}-linux-kernel-headers
This package provides userspaces headers from the Linux kernel. These
headers are used by the installed headers for GNU glibc and other system
libraries.
%package -n linux-kernel-perf
Summary: The perf performance counter tool
Group: System/Kernel
Provides: perf = %{version}
%description -n linux-kernel-perf
This package provides the "perf" tool that can be used to monitor performance
counter events as well as various kernel internal events.
%prep
%setup -q
%build
%{?asan:/usr/bin/gcc-unforce-options}
%{?ubsan:/usr/bin/gcc-unforce-options}
%if "%{dev_wos}" == "1"
# build as permissive mode
./scripts/config --file arch/%{buildarch}/configs/%{config_name} -u CONFIG_SECURITY_SMACK -u CONFIG_SECURITY_SMACK_APPEND_SIGNALS -e CONFIG_NETLABEL -e CONFIG_SECURITY_NETWORK
./scripts/config --file arch/%{buildarch}/configs/%{config_name_rt} -u CONFIG_SECURITY_SMACK -u CONFIG_SECURITY_SMACK_APPEND_SIGNALS -e CONFIG_NETLABEL -e CONFIG_SECURITY_NETWORK
%endif
for target in %{variant} %{variant}-rt; do
echo "-${target}" > localversion-tizen
# extract uapi headers
make O=build/${target} headers_install %{?_smp_mflags}
# Set config file
case $target in
%{variant})
make O=build/${target} %{config_name} %{?_smp_mflags}
# Build perf
# WERROR=0 make O=build/${target} -s -C tools/lib/traceevent %{?_smp_mflags}
WERROR=0 make O=build/${target} -s -C tools/perf EXTRA_CFLAGS="-fPIE -rdynamic" %{?_smp_mflags} NO_LIBTRACEEVENT=1 NO_JEVENTS=1
;;
%{variant}-rt)
cat _localversion-rt > localversion-rt
make O=build/${target} %{config_name_rt} %{?_smp_mflags}
;;
esac
# Build Image/Image.gz
make O=build/${target} %{?_smp_mflags}
# Build dtbs
make O=build/${target} dtbs %{?_smp_mflags}
# Build modules
make O=build/${target} modules %{?_smp_mflags}
done
%install
QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT
# Destination directories
mkdir -p %{buildroot}/boot
mkdir -p %{buildroot}/lib/modules
# Install boot binary files
%ifarch aarch64
install -m 644 rpi4/boot/config_64bit.txt %{buildroot}/boot/config.txt
%else
install -m 644 rpi4/boot/config.txt %{buildroot}/boot/
%endif
install -m 644 rpi4/boot/LICENCE.broadcom %{buildroot}/boot/
install -m 644 rpi4/boot/start*.elf %{buildroot}/boot/
install -m 644 rpi4/boot/fixup*.dat %{buildroot}/boot/
# Install kernel DTB
install -m 644 build/%{variant}/arch/%{buildarch}/boot/dts/broadcom/bcm*.dtb %{buildroot}/boot/
mkdir -p %{buildroot}/boot/overlays
install -m 644 build/%{variant}/arch/%{buildarch}/boot/dts/overlays/*.dtb* %{buildroot}/boot/overlays/
# Install kernel headers
make O=build/%{variant} headers_install %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr
for target in %{variant} %{variant}-rt; do
# Install kernel binary
case $target in
%{variant})
%ifarch aarch64
install -m 644 build/${target}/arch/%{buildarch}/boot/Image %{buildroot}/boot/Image
%else
install -m 644 build/${target}/arch/%{buildarch}/boot/zImage %{buildroot}/boot/zImage
%endif
# Install perf
WERROR=0 make O=build/${target} -s -C tools/perf EXTRA_CFLAGS="-fPIE -rdynamic" DESTDIR=%{buildroot}/usr install NO_LIBTRACEEVENT=1 NO_JEVENTS=1
rm -rf %{buildroot}/usr/etc
rm -rf %{buildroot}/usr/lib/debug
rm -rf %{buildroot}/usr/lib/perf
rm -rf %{buildroot}/usr/share
;;
%{variant}-rt)
%ifarch aarch64
install -m 644 build/${target}/arch/%{buildarch}/boot/Image %{buildroot}/boot/Image_rt
%else
install -m 644 build/${target}/arch/%{buildarch}/boot/zImage %{buildroot}/boot/zImage_rt
%endif
;;
esac
# Install modules
make O=build/${target} INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install
# Copy files for devel package
mkdir -p %{buildroot}/boot/kernel/devel/kernel-devel-${target}
rsync -r \
--include "/scripts/**.c" \
--exclude "/debug*.list" \
--exclude "/documentation.list" \
--exclude "/*.manifest" \
--exclude "/packaging/" \
--exclude "/.gbs.conf" \
--exclude "/.git**" \
--exclude ".gitignore" \
--exclude "*\.c" \
--exclude ".tmp_vmlinux*" \
--exclude ".*dtb*tmp" \
--exclude ".*dtb" \
--exclude "*.*tmp" \
--exclude "vmlinux" \
--exclude "Image" \
--exclude "zImage" \
--exclude "Image.gz" \
--exclude "*.cmd" \
--exclude "*.ko" \
--exclude "*.o" \
--exclude "*.S" \
--exclude "*.HEX" \
--exclude "/build/" \
./ build/${target}/ %{buildroot}/boot/kernel/devel/kernel-devel-${target}
done
%clean
rm -rf %{buildroot}
%post -n %{variant}-rt-linux-kernel
%ifarch aarch64
mv /boot/Image_rt /boot/Image
%else
mv /boot/zImage_rt /boot/zImage
%endif
%preun -n %{variant}-rt-linux-kernel
%ifarch aarch64
mv /boot/Image /boot/Image_rt
%else
mv /boot/zImage /boot/zImage_rt
%endif
%files -n %{variant}-linux-kernel-modules
%ifarch aarch64
/lib/modules/*%{variant}-v8/
%else
/lib/modules/*%{variant}-v7l/
%endif
%files -n %{variant}-rt-linux-kernel-modules
%ifarch aarch64
/lib/modules/*%{variant}-rt-v8/
%else
/lib/modules/*%{variant}-rt-v7l/
%endif
%files -n %{variant}-linux-kernel-devel
/boot/kernel/devel/*%{variant}/
%files -n %{variant}-rt-linux-kernel-devel
/boot/kernel/devel/*%{variant}-rt/
%files -n %{variant}-linux-kernel
%license COPYING
%ifarch aarch64
/boot/Image
%else
/boot/zImage
%endif
/boot/bcm*.dtb
/boot/overlays/*.dtb*
/boot/config.txt
/boot/LICENCE.broadcom
/boot/start*.elf
/boot/fixup*.dat
%files -n %{variant}-rt-linux-kernel
%license COPYING
%ifarch aarch64
/boot/Image_rt
%else
/boot/zImage_rt
%endif
/boot/bcm*.dtb
/boot/overlays/*.dtb*
/boot/config.txt
/boot/LICENCE.broadcom
/boot/start*.elf
/boot/fixup*.dat
%files -n %{variant}-linux-kernel-headers
/usr/include/*
%files -n linux-kernel-perf
%license COPYING
/usr/bin/*
/usr/libexec/*
|