kernel: Disable support for 6RD
[ipfire-3.x.git] / kernel / kernel.nm
CommitLineData
166a6c21 1###############################################################################
802ea3af
MT
2# IPFire.org - An Open Source Firewall Solution #
3# Copyright (C) - IPFire Development Team <info@ipfire.org> #
166a6c21
MT
4###############################################################################
5
15a11c5b 6name = kernel
0619f7fe 7version = 4.20
f55e2a21 8release = 6
15a11c5b 9thisapp = linux-%{version}
166a6c21 10
81bb0557 11maintainer = Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
802ea3af
MT
12groups = System/Kernels
13url = http://www.kernel.org/
14license = GPLv2
15summary = The Linux kernel.
166a6c21 16
802ea3af 17description
4c928ab7
MT
18 The kernel package contains the Linux kernel (vmlinuz), the core of any
19 Linux operating system. The kernel handles the basic functions
20 of the operating system: memory allocation, process allocation, device
166a6c21 21 input and output, etc.
802ea3af 22end
166a6c21 23
802ea3af 24# Version helper variables.
bcf38aec
MT
25localversion = %{release}.%{DISTRO_DISTTAG}.%{DISTRO_ARCH}
26fullver = %{version}-%{localversion}
802ea3af 27
94cce289 28source_dl = http://www.kernel.org/pub/linux/kernel/v4.x/
fe014038 29sources = %{thisapp}.tar.xz
802ea3af
MT
30
31build
6b6a8ff6
MT
32 kernel_logo = /usr/share/pixmaps/kernel-logo.ppm
33
802ea3af 34 requires
662414a4 35 asciidoc
7f6f4de5 36 bc
849a0073 37 binutils >= 2.25
bcf38aec 38 binutils-devel
c6e2a6c8 39 bison
bcf38aec 40 elfutils-devel
c6e2a6c8 41 flex
461b7e77 42 gcc >= 4.9
fe2de317 43 gcc-plugin-devel
6e9df6a3 44 gettext
849a0073 45 hostname
81bb0557 46 libunwind-devel
802ea3af 47 ncurses-devel
ebeed08a 48 net-tools
7c69f2c2
MT
49 newt-devel
50 pciutils-devel
802ea3af 51 perl
bcf38aec 52 python-devel
849a0073 53 openssl-devel
7c69f2c2 54 slang-devel
662414a4 55 xmlto
bf6ee3f7 56 xz
4c928ab7
MT
57
58 /sbin/depmod
6b6a8ff6 59 %{kernel_logo}
bcf38aec
MT
60 end
61
62 # A list of kernels to build.
45088e83 63 kernels =
bcf38aec 64
34520606 65 kernel_arch = %{DISTRO_PLATFORM}
45088e83 66 kernel_target = bzImage
967da24b
MT
67 kernel_image = arch/%{kernel_arch}/boot/%{kernel_target}
68
c112b2e3
MT
69 if "%{DISTRO_ARCH}" == "x86_64"
70 build_kernel_default = 1
c112b2e3
MT
71 end
72
d5383c43 73 if "%{DISTRO_ARCH}" == "aarch64"
55586be2 74 build_kernel_default = 1
d5383c43
MT
75
76 kernel_arch = arm64
77 kernel_target = Image.gz
78 end
79
13c9d848 80 if "%{DISTRO_ARCH}" == "armv7hl"
7f6f4de5
MT
81 # Build the default unified kernel.
82 build_kernel_default = 1
83
7f6f4de5 84 kernel_target = zImage
967da24b
MT
85 end
86
87 # mkimage is a requirement to build uImage images.
88 if "%{kernel_target}" == "uImage"
89 requires += u-boot-tools
13c9d848
MT
90 end
91
45088e83
MT
92 # Build default kernel.
93 if "%{build_kernel_default}" == "1"
94 kernels += default
95 end
96
802ea3af 97 prepare_cmds
5e856224
MT
98 # Disable the colorize plugin.
99 # It's generally very nice but it clutters our
100 # logfiles.
101 sed -e "/^COLORIZE_PLUGIN_CFLAGS/d" \
102 -i Makefile
103
202187a3 104 sed -e "s/\$(HOST_LFS_CFLAGS)/& -fPIC/g" -i Makefile
802ea3af 105
6b6a8ff6 106 cp -vf %{kernel_logo} \
802ea3af
MT
107 drivers/video/logo/logo_linux_clut224.ppm
108
bcf38aec
MT
109 # Get rid of unwanted files resulting from patch fuzz.
110 find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null
111
112 # Remove unnecessary SCM files.
113 find . -name .gitignore -exec rm -f {} \; >/dev/null
114
ebeed08a
MT
115 # This prevents scripts/setlocalversion from mucking with our version numbers.
116 touch .scmversion
117
bcf38aec 118 mkdir -pv configs
4c928ab7
MT
119
120 cd %{DIR_SOURCE}
bcf38aec
MT
121 configure_kernel() {
122 local flavour=${1}
123 local suffix
124 if [ "${flavour}" != "default" ]; then
125 suffix="-${flavour}"
126 fi
127
4c928ab7
MT
128 scripts/configure --kernel-dir=%{DIR_APP} \
129 merge %{DISTRO_ARCH} ${flavour} %{DIR_APP}/configs/config.${flavour}
bcf38aec
MT
130 }
131
132 # Generate configuration files for all kernels we are going to
133 # build.
134 for kernel in %{kernels}; do
135 configure_kernel ${kernel}
136 done
802ea3af
MT
137 end
138
139 build
bcf38aec
MT
140 build_kernel() {
141 local flavour=${1}
142 local suffix
143 local localversion="%{localversion}"
144 local fullversion="%{fullver}"
145 if [ "${flavour}" != "default" ]; then
146 suffix="-${flavour}"
147 localversion="${localversion}.${flavour}"
148 fullversion="${fullversion}.${flavour}"
149 fi
802ea3af 150
ebeed08a
MT
151 # Label the build.
152 sed -i Makefile \
153 -e "s/^EXTRAVERSION.*/EXTRAVERSION = -${localversion}/"
154
bcf38aec
MT
155 # Clean up the source tree.
156 make mrproper
802ea3af 157
bcf38aec
MT
158 # Install configuration file.
159 cp configs/config.${flavour} .config
c6e2a6c8 160 cat .config
802ea3af 161
bcf38aec 162 # Run the build.
1349854e 163 make ARCH=%{kernel_arch} olddefconfig >/dev/null
65c2deba
MT
164 make ARCH=%{kernel_arch} %{kernel_target} modules \
165 %{PARALLELISMFLAGS}
bcf38aec 166
9d4be168
MT
167 # Compile Flattened Device Tree database
168 case "${DISTRO_ARCH}" in
d5383c43 169 aarch64|arm*)
9d4be168
MT
170 make ARCH=%{kernel_arch} dtbs
171
172 mkdir -pv %{BUILDROOT}/boot/dtb-${fullversion}
173 for file in arch/arm/boot/dts/*.dtb; do
174 [ -e "${file}" ] || continue
175
176 install -m 644 ${file} %{BUILDROOT}/boot/dtb-${fullversion} || exit 1
177 rm -f ${file}
178 done
179 ;;
180 esac
181
bcf38aec 182 # Install the results.
c4ef5c45 183 mkdir -pv %{BUILDROOT}/boot %{BUILDROOT}/usr/lib/modules/${fullversion}
bcf38aec
MT
184 install -m 755 %{kernel_image} %{BUILDROOT}/boot/vmlinuz-${fullversion}
185 install -m 644 .config %{BUILDROOT}/boot/config-${fullversion}
186 install -m 644 System.map %{BUILDROOT}/boot/System.map-${fullversion}
187
188 # Create empty initramfs (20M).
189 dd if=/dev/zero of=%{BUILDROOT}/boot/initramfs-${fullversion}.img bs=1M count=20
190
191 # Install modules.
81bb0557 192 make ARCH=%{kernel_arch} INSTALL_MOD_PATH=%{BUILDROOT}/usr mod-fw= V=1 \
bcf38aec 193 KERNELRELEASE=${fullversion} modules_install
c8f122e5 194
bcf38aec 195 # Create an empty settings file for dracut
7c69f2c2 196 mkdir -p %{BUILDROOT}/etc/ld.so.conf.d
bcf38aec
MT
197 echo "# Placeholder file, no vDSO hwcap entries used in this kernel." \
198 > %{BUILDROOT}/etc/ld.so.conf.d/kernel-${fullversion}.conf
802ea3af 199
bcf38aec
MT
200 # And now the scary looking part.
201 #
202 # Recreate source and build links.
7c69f2c2
MT
203 rm -f %{BUILDROOT}/usr/lib/modules/${fullversion}/{build,source}
204 mkdir -p %{BUILDROOT}/usr/lib/modules/${fullversion}/build
205 ln -sf build %{BUILDROOT}/usr/lib/modules/${fullversion}/source
802ea3af 206
bcf38aec 207 # Create dirs for extra modules.
7c69f2c2 208 mkdir -p %{BUILDROOT}/usr/lib/modules/${fullversion}/extra
802ea3af 209
7c69f2c2 210 cp --parents $(find -type f -name "Makefile*" -o -name "Kconfig*") \
c4ef5c45 211 %{BUILDROOT}/usr/lib/modules/${fullversion}/build
7c69f2c2 212 cp Module.symvers System.map \
c4ef5c45 213 %{BUILDROOT}/usr/lib/modules/${fullversion}/build
7c69f2c2 214 rm -rf %{BUILDROOT}/usr/lib/modules/${fullversion}/build/{Documentation,scripts,include}
bcf38aec 215
7c69f2c2
MT
216 cp .config %{BUILDROOT}/usr/lib/modules/${fullversion}/build
217 cp -a scripts %{BUILDROOT}/usr/lib/modules/${fullversion}/build
c4ef5c45 218 find %{BUILDROOT}/usr/lib/modules/${fullversion}/build/scripts -name "*.o" \
bcf38aec
MT
219 -exec rm -vf {} \;
220
7c69f2c2 221 cp -a --parents arch/%{kernel_arch}/include \
c4ef5c45 222 %{BUILDROOT}/usr/lib/modules/${fullversion}/build
7c69f2c2 223 cp -a include %{BUILDROOT}/usr/lib/modules/${fullversion}/build/include
bcf38aec
MT
224
225 # Make sure we can build external modules.
c4ef5c45
MT
226 touch -r %{BUILDROOT}/usr/lib/modules/${fullversion}/build/Makefile \
227 %{BUILDROOT}/usr/lib/modules/${fullversion}/build/include/linux/version.h
228 touch -r %{BUILDROOT}/usr/lib/modules/${fullversion}/build/.config \
229 %{BUILDROOT}/usr/lib/modules/${fullversion}/build/autoconf.h
7c69f2c2 230 cp %{BUILDROOT}/usr/lib/modules/${fullversion}/build/.config \
c4ef5c45
MT
231 %{BUILDROOT}/usr/lib/modules/${fullversion}/build/include/config/auto.conf
232
233 find %{BUILDROOT}/usr/lib/modules/${fullversion} -name "*.ko" -type f | \
bf6ee3f7 234 xargs --no-run-if-empty chmod u+x
bcf38aec 235
bcf38aec 236 # Move all development files to /usr/src.
7c69f2c2
MT
237 mkdir -p %{BUILDROOT}/usr/src/kernels
238 mv %{BUILDROOT}/usr/lib/modules/${fullversion}/build \
bcf38aec 239 %{BUILDROOT}/usr/src/kernels/${fullversion}
7c69f2c2 240 ln -sf ../../../src/kernels/${fullversion} \
c4ef5c45 241 %{BUILDROOT}/usr/lib/modules/${fullversion}/build
bcf38aec 242
81bb0557
MT
243 # Fix permissions.
244 find %{BUILDROOT}/usr/src/kernels -name "modules.order" \
245 -exec chmod 644 {} \;
246
bcf38aec 247 find %{BUILDROOT}/usr/src/kernels -name ".*.cmd" -exec rm -f {} \;
d27a5bdd
AF
248
249 # remove device tree compiler because there are dead links
250 rm -rf %{BUILDROOT}/usr/src/kernels/*/scripts/dtc
bcf38aec
MT
251 }
252
253 for kernel in %{kernels}; do
254 build_kernel ${kernel}
255 done
6e9df6a3 256
6e9df6a3 257 # cpupower
7c69f2c2
MT
258 chmod +x tools/power/cpupower/utils/version-gen.sh
259 make -C tools/power/cpupower CPUFREQ_BENCH=false %{PARALLELISMFLAGS}
260
302e8df8
MT
261 pushd tools/thermal/tmon
262 make
263 popd
bcf38aec
MT
264 end
265
266 install
4c928ab7
MT
267 # When no kernels are configured, we create a default config
268 # which enables us to install at least the header files.
269 [ -n "%{kernels}" ] || make ARCH=%{kernel_arch} defconfig
270
802ea3af 271 # Install the header files
c8f122e5 272 make ARCH=%{kernel_arch} INSTALL_HDR_PATH=dest headers_install
802ea3af
MT
273 mkdir -pv %{BUILDROOT}/usr/include
274 find dest/include \( -name .install -o -name ..install.cmd \) -delete
275 cp -rv dest/include/* %{BUILDROOT}/usr/include
276
277 # Glibc provides these headers
278 rm -rfv %{BUILDROOT}/usr/include/scsi \
279 %{BUILDROOT}/usr/include/asm*/atomic.h \
280 %{BUILDROOT}/usr/include/asm*/io.h \
281 %{BUILDROOT}/usr/include/asm*/irq.h
282
15a11c5b
MT
283 # Remove all firmware files which are distributed by linux-firmware
284 rm -rfv %{BUILDROOT}/lib/firmware
bcf38aec
MT
285
286 # Install tools.
6e9df6a3 287 # cpupower
7c69f2c2
MT
288 make -C tools/power/cpupower DESTDIR=%{BUILDROOT} libdir=%{libdir} \
289 mandir=%{mandir} CPUFREQ_BENCH=false install
290
7c69f2c2 291 chmod 0755 %{BUILDROOT}%{libdir}/libcpupower.so*
302e8df8 292
302e8df8
MT
293 # tmon
294 pushd tools/thermal/tmon
295 make INSTALL_ROOT=%{BUILDROOT} install
296 popd
802ea3af
MT
297 end
298end
299
300packages
bcf38aec 301 template KERNEL
aa3ab846 302 kernel_name = kernel
bcf38aec
MT
303 kernel_release = %{fullver}
304
305 summary = The Linux kernel %{kernel_release}.
306
1c9b6c79 307 prerequires
4c928ab7 308 /sbin/depmod
1c9b6c79
MT
309 end
310
311 provides
312 kernel=%{kernel_release}
313 end
314
802ea3af 315 requires
4c928ab7
MT
316 dracut
317 grubby
802ea3af
MT
318 linux-firmware
319 end
ad1ea534 320
bcf38aec
MT
321 files
322 /boot/System.map-%{kernel_release}
9d4be168 323 /boot/dtb-%{kernel_release}
bcf38aec
MT
324 /boot/vmlinuz-%{kernel_release}
325 /boot/initramfs-%{kernel_release}.img
326 /etc/ld.so.conf.d/kernel-%{kernel_release}.conf
c4ef5c45 327 /usr/lib/modules/%{kernel_release}
bcf38aec
MT
328 end
329
aa3ab846 330 _posttrans
c8f9fe35
MT
331 /sbin/new-kernel-pkg --package %{kernel_name} --mkinitrd --dracut --depmod --update %{kernel_release}
332 /sbin/new-kernel-pkg --package %{kernel_name} --rpmposttrans %{kernel_release}
aa3ab846
MT
333 end
334
ad1ea534 335 script posttransin
aa3ab846
MT
336 %{_posttrans}
337 end
338
339 script posttransup
340 %{_posttrans}
341 end
342
343 script postin
c8f9fe35 344 /sbin/new-kernel-pkg --package %{kernel_name} --install %{kernel_release}
aa3ab846
MT
345 end
346
347 script postup
348 /sbin/new-kernel-pkg --package %{kernel_name} --install %{kernel_release}
349 end
350
351 script preun
352 /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{kernel_release}
bcf38aec
MT
353 end
354 end
355
356 template KERNELDEVEL
357 kernel_release = %{fullver}
358
359 summary = Development files of kernel-%{kernel_release}.
360 description
361 %{summary}
362
363 Install this package in order to compile modules for
364 kernel release %{kernel_release}.
365 end
366
10756fd5
MT
367 provides
368 kernel-devel = %{thisver}
369 end
370
bcf38aec
MT
371 filter_requires
372 perl>=[0-9]\:.*
ad1ea534
MT
373 end
374
bcf38aec 375 files
c4ef5c45
MT
376 /usr/lib/modules/%{kernel_release}/build
377 /usr/lib/modules/%{kernel_release}/source
bcf38aec 378 /usr/src/kernels/%{kernel_release}
ad1ea534 379 end
802ea3af 380 end
bcf38aec 381
45088e83 382 if "%{build_kernel_default}" == "1"
7f6f4de5
MT
383 if "%{DISTRO_ARCH}" == "armv7hl"
384 package kernel
385 template KERNEL
58dc2060 386
7f6f4de5
MT
387 kernel_name = kernel
388 kernel_release = %{fullver}
bcf38aec 389
0db4b328
MT
390 # Replace the Exynos kernel.
391 obsoletes += kernel-exynos < %{kernel_release}
392 conflicts += kernel-exynos < %{kernel_release}
393
7f6f4de5
MT
394 # Replace the OMAP kernel.
395 obsoletes += kernel-omap < %{kernel_release}
396 conflicts += kernel-omap < %{kernel_release}
397 end
398
399 package kernel-devel
400 template KERNELDEVEL
401
402 kernel_name = kernel
403 kernel_release = %{fullver}
404
0db4b328
MT
405 # Replace the Exynos kernel.
406 obsoletes += kernel-exynos-devel < %{kernel_release}
407 conflicts += kernel-exynos-devel < %{kernel_release}
408
7f6f4de5
MT
409 # Replace the OMAP kernel.
410 obsoletes += kernel-omap-devel < %{kernel_release}
411 conflicts += kernel-omap-devel < %{kernel_release}
412 end
58dc2060 413
7f6f4de5
MT
414 else
415 package kernel
416 template KERNEL
417
418 kernel_name = kernel
419 kernel_release = %{fullver}
420 end
421
422 package kernel-devel
423 template KERNELDEVEL
424
425 kernel_name = kernel
426 kernel_release = %{fullver}
427 end
45088e83 428 end
bcf38aec 429 end
81bb0557 430
802ea3af 431 package kernel-headers
802ea3af
MT
432 summary = Header files of the kernel release %{fullver}.
433 desciption = %{summary}
c698e4be
MT
434
435 files
436 /usr/include
437 end
802ea3af 438 end
bcf38aec 439
ebeed08a
MT
440 package kernel-tools
441 summary = Assortment of tools for the Linux kernel.
442 description = %{summary}
443
444 filter_requires
445 perl>=[0-9]\:.*
446 end
447
448 files
449 /
450 !/boot
ebeed08a 451 !/usr/include
c4ef5c45 452 !/usr/lib/modules
ebeed08a 453 !/usr/src
fe2de317
MT
454 !/usr/src/debug
455 !/usr/lib/debug
ebeed08a
MT
456 end
457 end
802ea3af 458end