@@ -213,6 +213,8 @@ Summary: The Linux kernel
213213%define with_arm64_16k %{?_with_arm64_16k: 1} %{?! _with_arm64_16k: 0}
214214# kernel-64k (aarch64 kernel with 64K page_size)
215215%define with_arm64_64k %{?_without_arm64_64k: 0} %{?! _without_arm64_64k: 1}
216+ # kernel-minimal (x86_64 kernel with minimal config)
217+ %define with_x86_64_minimal %{?_without_x86_64_minimal: 0} %{?! _without_x86_64_minimal: 1}
216218# we default reatime builds to off for fedora and on for rhel/centos/eln
217219%if 0%{?fedora }
218220# kernel-rt (x86_64 and aarch64 only PREEMPT_RT enabled kernel)
@@ -229,13 +231,14 @@ Summary: The Linux kernel
229231%define with_automotive %{?_with_automotive: 1} %{?! _with_automotive: 0}
230232
231233# Supported variants
232- # with_base with_debug with_gcov
233- # up X X X
234- # zfcpdump X X
235- # arm64_16k X X X
236- # arm64_64k X X X
237- # realtime X X X
238- # automotive X X X
234+ # with_base with_debug with_gcov
235+ # up X X X
236+ # zfcpdump X X
237+ # arm64_16k X X X
238+ # arm64_64k X X X
239+ # x86_64_minimal X X
240+ # realtime X X X
241+ # automotive X X X
239242
240243# kernel-doc
241244%define with_doc %{?_without_doc: 0} %{?! _without_doc: 1}
@@ -265,6 +268,8 @@ Summary: The Linux kernel
265268%define with_rtonly %{?_with_rtonly: 1} %{?! _with_rtonly: 0}
266269# Only build the automotive variant of the kernel (--with automotiveonly):
267270%define with_automotiveonly %{?_with_automotiveonly: 1} %{?! _with_automotiveonly: 0}
271+ # Only build the minimal variant of the kernel (--with minimalonly):
272+ %define with_minimalonly %{?_with_minimalonly: 1} %{?! _with_minimalonly: 0}
268273# Build the automotive kernel (--with automotive_build), this builds base variant with automotive config/options:
269274%define with_automotive_build %{?_with_automotive_build: 1} %{?! _with_automotive_build: 0}
270275# Only build the tools package
@@ -403,6 +408,7 @@ Summary: The Linux kernel
403408%define with_zfcpdump 0
404409%define with_arm64_16k 0
405410%define with_arm64_64k 0
411+ %define with_x86_64_minimal 0
406412%endif
407413
408414# if requested, only build the automotive variant of the kernel
@@ -432,6 +438,7 @@ Summary: The Linux kernel
432438%define with_realtime_arm64_64k 0
433439%define with_arm64_16k 0
434440%define with_arm64_64k 0
441+ %define with_x86_64_minimal 0
435442%define with_automotive 0
436443%define with_cross_headers 0
437444%define with_doc 0
@@ -445,6 +452,27 @@ Summary: The Linux kernel
445452%define with_configchecks 0
446453%endif
447454
455+ # if requested, only build minimal kernel
456+ %if %{with_minimalonly }
457+ %define with_x86_64_minimal 1
458+ %define with_up 0
459+ %define with_debug 0
460+ %define with_debuginfo 0
461+ %define with_vdso_install 0
462+ %define with_perf 0
463+ %define with_libperf 0
464+ %define with_tools 0
465+ %define with_selftests 0
466+ %define with_headers 0
467+ %define with_efiuki 0
468+ %define with_zfcpdump 0
469+ %define with_arm64_16k 0
470+ %define with_arm64_64k 0
471+ %define with_realtime 0
472+ %define with_realtime_arm64_64k 0
473+ %define with_automotive 0
474+ %endif
475+
448476# RT and Automotive kernels are only built on x86_64 and aarch64
449477%ifnarch x86_64 aarch64
450478%define with_realtime 0
@@ -533,6 +561,11 @@ Summary: The Linux kernel
533561%define with_realtime_arm64_64k 0
534562%endif
535563
564+ # minimal variant only for x86_64
565+ %ifnarch x86_64
566+ %define with_x86_64_minimal 0
567+ %endif
568+
536569%if 0%{?fedora }
537570# This is not for Fedora
538571%define with_zfcpdump 0
@@ -607,6 +640,7 @@ Summary: The Linux kernel
607640%define with_zfcpdump 0
608641%define with_arm64_16k 0
609642%define with_arm64_64k 0
643+ %define with_x86_64_minimal 0
610644%define with_realtime 0
611645%define with_realtime_arm64_64k 0
612646%define with_automotive 0
@@ -674,6 +708,11 @@ Summary: The Linux kernel
674708%else
675709%define with_realtime_arm64_64k_base 0
676710%endif
711+ %if %{with_x86_64_minimal } && %{with_base }
712+ %define with_x86_64_minimal_base 1
713+ %else
714+ %define with_x86_64_minimal_base 0
715+ %endif
677716
678717#
679718# Packages that need to be installed before the kernel is, because the %%post
@@ -1772,6 +1811,14 @@ It should only be installed when trying to gather additional information
17721811on kernel bugs, as some of these options impact performance noticably.
17731812%endif
17741813
1814+ %if %{with_x86_64_minimal_base }
1815+ %define variant_summary The Linux kernel built with a minimal configuration
1816+ %kernel_variant_package minimal
1817+ %description minimal-core
1818+ The kernel package contains a variant of the x86_64 Linux kernel built with
1819+ a minimal configuration.
1820+ %endif
1821+
17751822%if %{with_debug } && %{with_realtime }
17761823%define variant_summary The Linux PREEMPT_RT kernel compiled with extra debugging enabled
17771824%kernel_variant_package rt-debug
@@ -1916,6 +1963,14 @@ Prebuilt 64k unified kernel image for virtual machines.
19161963Prebuilt 64k unified kernel image addons for virtual machines.
19171964%endif
19181965
1966+ %if %{with_x86_64_minimal_base } && %{with_efiuki }
1967+ %description minimal-uki-virt
1968+ Prebuilt minimal unified kernel image for virtual machines.
1969+
1970+ %description minimal-uki-virt-addons
1971+ Prebuilt minimal unified kernel image addons for virtual machines.
1972+ %endif
1973+
19191974%ifnarch noarch %{nobuildarches }
19201975%kernel_modules_extra_matched_package
19211976%endif
@@ -3085,6 +3140,10 @@ BuildKernel %make_target %kernel_image %{_use_vdso} 16k
30853140BuildKernel %make_target %kernel_image %{_use_vdso } 64k
30863141%endif
30873142
3143+ %if %{with_x86_64_minimal_base }
3144+ BuildKernel %make_target %kernel_image %{_use_vdso } minimal
3145+ %endif
3146+
30883147%if %{with_realtime_base }
30893148BuildKernel %make_target %kernel_image %{_use_vdso } rt
30903149%endif
@@ -3102,7 +3161,7 @@ BuildKernel %make_target %kernel_image %{_use_vdso}
31023161%endif
31033162
31043163%ifnarch noarch i686 %{nobuildarches }
3105- %if ! %{with_debug } && ! %{with_zfcpdump } && ! %{with_up } && ! %{with_arm64_16k } && ! %{with_arm64_64k } && ! %{with_realtime } && ! %{with_realtime_arm64_64k } && ! %{with_automotive }
3164+ %if ! %{with_debug } && ! %{with_zfcpdump } && ! %{with_up } && ! %{with_arm64_16k } && ! %{with_arm64_64k } && ! %{with_x86_64_minimal } && ! %{ with_realtime } && ! %{with_realtime_arm64_64k } && ! %{with_automotive }
31063165# If only building the user space tools, then initialize the build environment
31073166# and some variables so that the various userspace tools can be built.
31083167%{log_msg "Initialize userspace tools build environment"}
@@ -4109,6 +4168,16 @@ fi\
41094168%kernel_variant_preun -v 64k -u virt -e
41104169%endif
41114170
4171+ %if %{with_x86_64_minimal_base }
4172+ %kernel_variant_preun -v minimal -e
4173+ %kernel_variant_post -v minimal
4174+ %endif
4175+
4176+ %if %{with_x86_64_minimal_base } && %{with_efiuki }
4177+ %kernel_variant_posttrans -v minimal -u virt
4178+ %kernel_variant_preun -v minimal -u virt -e
4179+ %endif
4180+
41124181%if %{with_realtime_base }
41134182%kernel_variant_preun -v rt
41144183%kernel_variant_post -v rt -r kernel
@@ -4491,6 +4560,7 @@ fi\
44914560%kernel_variant_files %{_use_vdso } %{with_zfcpdump } zfcpdump
44924561%kernel_variant_files %{_use_vdso } %{with_arm64_16k_base } 16k
44934562%kernel_variant_files %{_use_vdso } %{with_arm64_64k_base } 64k
4563+ %kernel_variant_files %{_use_vdso } %{with_x86_64_minimal_base } minimal
44944564%kernel_variant_files %{_use_vdso } %{with_realtime_arm64_64k_base } rt-64k
44954565%if %{with_realtime_arm64_64k }
44964566%kernel_variant_files %{_use_vdso } %{with_debug } rt-64k-debug
0 commit comments