forked from clearlinux-pkgs/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinux.spec
More file actions
339 lines (282 loc) · 10.1 KB
/
Copy pathlinux.spec
File metadata and controls
339 lines (282 loc) · 10.1 KB
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
330
331
332
333
334
335
336
337
338
339
#
# note to self: Linus releases need to be named 5.x.0 not 5.x or various
# things break
#
#
Name: linux
Version: 6.2.8
Release: 1293
License: GPL-2.0
Summary: The Linux kernel
Url: http://www.kernel.org/
Group: kernel
Source0: https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.2.8.tar.xz
Source1: config
Source2: cmdline
%define ktarget native
%define kversion %{version}-%{release}.%{ktarget}
BuildRequires: buildreq-kernel
Requires: systemd-bin
Requires: init-rdahead-extras
Requires: linux-license = %{version}-%{release}
# don't strip .ko files!
%global __os_install_post %{nil}
%define debug_package %{nil}
%define __strip /bin/true
#cve.start cve patches from 0001 to 050
#cve.end
#mainline: Mainline patches, upstream backport and fixes from 0051 to 0099
#mainline.end
#Serie.clr 01XX: Clear Linux patches
Patch0101: 0101-i8042-decrease-debug-message-level-to-info.patch
Patch0102: 0102-increase-the-ext4-default-commit-age.patch
Patch0103: 0103-silence-rapl.patch
Patch0104: 0104-pci-pme-wakeups.patch
Patch0105: 0105-ksm-wakeups.patch
Patch0106: 0106-intel_idle-tweak-cpuidle-cstates.patch
Patch0107: 0107-bootstats-add-printk-s-to-measure-boot-time-in-more-.patch
Patch0108: 0108-smpboot-reuse-timer-calibration.patch
Patch0109: 0109-initialize-ata-before-graphics.patch
Patch0111: 0111-ipv4-tcp-allow-the-memory-tuning-for-tcp-to-go-a-lit.patch
Patch0112: 0112-init-wait-for-partition-and-retry-scan.patch
#Patch0113: 0113-print-fsync-count-for-bootchart.patch
Patch0114: 0114-add-boot-option-to-allow-unsigned-modules.patch
Patch0115: 0115-enable-stateless-firmware-loading.patch
Patch0116: 0116-migrate-some-systemd-defaults-to-the-kernel-defaults.patch
Patch0117: 0117-xattr-allow-setting-user.-attributes-on-symlinks-by-.patch
Patch0118: 0118-add-scheduler-turbo3-patch.patch
Patch0120: 0120-do-accept-in-LIFO-order-for-cache-efficiency.patch
Patch0121: 0121-locking-rwsem-spin-faster.patch
Patch0122: 0122-ata-libahci-ignore-staggered-spin-up.patch
Patch0123: 0123-print-CPU-that-faults.patch
Patch0124: 0124-x86-microcode-Add-an-option-to-reload-microcode-even.patch
Patch0125: 0125-nvme-workaround.patch
Patch0126: 0126-don-t-report-an-error-if-PowerClamp-run-on-other-CPU.patch
Patch0127: 0127-lib-raid6-add-patch.patch
Patch0128: 0128-itmt_epb-use-epb-to-scale-itmt.patch
Patch0130: 0130-itmt2-ADL-fixes.patch
Patch0131: 0131-add-a-per-cpu-minimum-high-watermark-an-tune-batch-s.patch
Patch0132: 0132-prezero-20220308.patch
Patch0133: 0133-novector.patch
Patch0134: 0134-md-raid6-algorithms-scale-test-duration-for-speedier.patch
Patch0135: 0135-initcall-only-print-non-zero-initcall-debug-to-speed.patch
Patch0136: scale.patch
Patch0137: libsgrowdown.patch
Patch0138: kdf-boottime.patch
Patch0139: adlrdt.patch
Patch0140: kvm-printk.patch
Patch0141: epp-retune.patch
Patch0142: tcptuning.patch
Patch0143: 0001-powerbump-functionality.patch
Patch0144: 0002-add-networking-support-for-powerbump.patch
Patch0145: 0003-futex-bump.patch
Patch0146: 0001-add-umonitor-umwait-C0.x-C-states.patch
Patch0147: 0001-mm-memcontrol-add-some-branch-hints-based-on-gcov-an.patch
Patch0148: 0002-sched-core-add-some-branch-hints-based-on-gcov-analy.patch
Patch0149: backport-ioboost.patch
Patch0151: rcuref-1.patch
Patch0152: rcuref-2.patch
Patch0153: rcuref-3.patch
Patch0154: 0136-crypto-kdf-make-the-module-init-call-a-late-init-cal.patch
#Serie.end
#backports
#Patch0200: mm-lru_cache_disable-use-synchronize_rcu_expedited.patch
Patch0401: sched-hybrid1.patch
Patch0402: sched-hybrid2.patch
Patch0403: sched-hybrid3.patch
Patch0404: sched-hybrid4.patch
Patch0500: 0001-sched-migrate.patch
Patch0501: 0002-sched-migrate.patch
%description
The Linux kernel.
%package extra
License: GPL-2.0
Summary: The Linux kernel extra files
Group: kernel
Requires: linux-license = %{version}-%{release}
%description extra
Linux kernel extra files
%package license
Summary: license components for the linux package.
Group: Default
%description license
license components for the linux package.
%package cpio
License: GPL-2.0
Summary: cpio file with kenrel modules
Group: kernel
%description cpio
Creates a cpio file with some modules
%package dev
License: GPL-2.0
Summary: The Linux kernel
Group: kernel
Requires: linux = %{version}-%{release}
Requires: linux-extra = %{version}-%{release}
Requires: linux-license = %{version}-%{release}
%description dev
Linux kernel build files
%prep
%setup -q -n linux-6.2.8
#cve.patch.start cve patches
#cve.patch.end
#mainline.patch.start Mainline patches, upstream backport and fixes
#mainline.patch.end
#Serie.patch.start Clear Linux patches
%patch0101 -p1
%patch0102 -p1
%patch0103 -p1
%patch0104 -p1
%patch0105 -p1
%patch0106 -p1
%patch0107 -p1
%patch0108 -p1
%patch0109 -p1
%patch0111 -p1
%patch0112 -p1
#%patch0113 -p1
%patch0114 -p1
%patch0115 -p1
%patch0116 -p1
%patch0117 -p1
#%patch0118 -p1
%patch0120 -p1
%patch0121 -p1
%patch0122 -p1
%patch0123 -p1
%patch0124 -p1
%patch0125 -p1
%patch0126 -p1
%patch0127 -p1
%patch0128 -p1
%patch0130 -p1
%patch0131 -p1
#patch0132 -p1
%patch0133 -p1
%patch0134 -p1
%patch0135 -p1
%patch0136 -p1
%patch0137 -p1
#%patch0138 -p1
%patch0139 -p1
%patch0140 -p1
%patch0141 -p1
%patch0142 -p1
%patch0143 -p1
%patch0144 -p1
%patch0145 -p1
%patch0146 -p1
%patch0147 -p1
%patch0148 -p1
%patch0149 -p1
%patch0151 -p1
%patch0152 -p1
%patch0153 -p1
%patch0154 -p1
#Serie.patch.end
# backports
%patch0401 -p1
%patch0403 -p1
%patch0404 -p1
%patch0500 -p1
%patch0501 -p1
cp %{SOURCE1} .
%build
BuildKernel() {
Target=$1
Arch=x86_64
ExtraVer="-%{release}.${Target}"
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = ${ExtraVer}/" Makefile
make O=${Target} -s mrproper
cp config ${Target}/.config
make O=${Target} -s ARCH=${Arch} olddefconfig
make O=${Target} -s ARCH=${Arch} CONFIG_DEBUG_SECTION_MISMATCH=y %{?_smp_mflags} %{?sparse_mflags}
}
BuildKernel %{ktarget}
%install
InstallKernel() {
Target=$1
Kversion=$2
Arch=x86_64
KernelDir=%{buildroot}/usr/lib/kernel
DevDir=%{buildroot}/usr/lib/modules/${Kversion}/build
mkdir -p ${KernelDir}
install -m 644 ${Target}/.config ${KernelDir}/config-${Kversion}
install -m 644 ${Target}/System.map ${KernelDir}/System.map-${Kversion}
install -m 644 ${Target}/vmlinux ${KernelDir}/vmlinux-${Kversion}
install -m 644 %{SOURCE2} ${KernelDir}/cmdline-${Kversion}
cp ${Target}/arch/x86/boot/bzImage ${KernelDir}/org.clearlinux.${Target}.%{version}-%{release}
chmod 755 ${KernelDir}/org.clearlinux.${Target}.%{version}-%{release}
mkdir -p %{buildroot}/usr/lib/modules
make O=${Target} -s ARCH=${Arch} INSTALL_MOD_PATH=%{buildroot}/usr modules_install
rm -f %{buildroot}/usr/lib/modules/${Kversion}/build
rm -f %{buildroot}/usr/lib/modules/${Kversion}/source
mkdir -p ${DevDir}
find . -type f -a '(' -name 'Makefile*' -o -name 'Kbuild*' -o -name 'Kconfig*' ')' -exec cp -t ${DevDir} --parents -pr {} +
find . -type f -a '(' -name '*.sh' -o -name '*.pl' ')' -exec cp -t ${DevDir} --parents -pr {} +
cp -t ${DevDir} -pr ${Target}/{Module.symvers,tools}
ln -s ../../../kernel/config-${Kversion} ${DevDir}/.config
ln -s ../../../kernel/System.map-${Kversion} ${DevDir}/System.map
cp -t ${DevDir} --parents -pr arch/x86/include
cp -t ${DevDir}/arch/x86/include -pr ${Target}/arch/x86/include/*
cp -t ${DevDir}/include -pr include/*
cp -t ${DevDir}/include -pr ${Target}/include/*
cp -t ${DevDir} --parents -pr scripts/*
cp -t ${DevDir}/scripts -pr ${Target}/scripts/*
find ${DevDir}/scripts -type f -name '*.[cho]' -exec rm -v {} +
find ${DevDir} -type f -name '*.cmd' -exec rm -v {} +
# Cleanup any dangling links
find ${DevDir} -type l -follow -exec rm -v {} +
# Kernel default target link
ln -s org.clearlinux.${Target}.%{version}-%{release} %{buildroot}/usr/lib/kernel/default-${Target}
}
# cpio file for keyboard drivers
createCPIO() {
Target=$1
Kversion=$2
KernelDir=%{buildroot}/usr/lib/kernel
ModDir=/usr/lib/modules/${Kversion}
mkdir -p cpiofile${ModDir}/kernel/drivers/input/{serio,keyboard}
mkdir -p cpiofile${ModDir}/kernel/drivers/hid
cp %{buildroot}${ModDir}/kernel/drivers/input/serio/i8042.ko cpiofile${ModDir}/kernel/drivers/input/serio
cp %{buildroot}${ModDir}/kernel/drivers/input/serio/libps2.ko cpiofile${ModDir}/kernel/drivers/input/serio
cp %{buildroot}${ModDir}/kernel/drivers/input/keyboard/atkbd.ko cpiofile${ModDir}/kernel/drivers/input/keyboard
cp %{buildroot}${ModDir}/kernel/drivers/hid/hid-logitech-dj.ko cpiofile${ModDir}/kernel/drivers/hid
cp %{buildroot}${ModDir}/kernel/drivers/hid/hid-logitech-hidpp.ko cpiofile${ModDir}/kernel/drivers/hid
cp %{buildroot}${ModDir}/kernel/drivers/hid/hid-apple.ko cpiofile${ModDir}/kernel/drivers/hid
cp %{buildroot}${ModDir}/modules.order cpiofile${ModDir}
cp %{buildroot}${ModDir}/modules.builtin cpiofile${ModDir}
depmod -b cpiofile/usr ${Kversion}
(
cd cpiofile
find . | cpio --create --format=newc \
| xz --check=crc32 --lzma2=dict=512KiB > ${KernelDir}/initrd-org.clearlinux.${Target}.%{version}-%{release}
)
}
InstallKernel %{ktarget} %{kversion}
createCPIO %{ktarget} %{kversion}
rm -rf %{buildroot}/usr/lib/firmware
mkdir -p %{buildroot}/usr/share/package-licenses/linux
cp COPYING %{buildroot}/usr/share/package-licenses/linux/COPYING
cp -a LICENSES/* %{buildroot}/usr/share/package-licenses/linux
%files
%dir /usr/lib/kernel
%dir /usr/lib/modules/%{kversion}
/usr/lib/kernel/config-%{kversion}
/usr/lib/kernel/cmdline-%{kversion}
/usr/lib/kernel/org.clearlinux.%{ktarget}.%{version}-%{release}
/usr/lib/kernel/default-%{ktarget}
/usr/lib/modules/%{kversion}/kernel
/usr/lib/modules/%{kversion}/modules.*
%files extra
%dir /usr/lib/kernel
/usr/lib/kernel/System.map-%{kversion}
/usr/lib/kernel/vmlinux-%{kversion}
%files license
%defattr(0644,root,root,0755)
/usr/share/package-licenses/linux
%files cpio
/usr/lib/kernel/initrd-org.clearlinux.%{ktarget}.%{version}-%{release}
%files dev
%defattr(-,root,root)
/usr/lib/modules/%{kversion}/build