blob: c9a9371c78c3e71e112f6e5b119b0d5b6d66f00b (
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
|
# kernel 6.18.50 (upstream: gregkh/linux tag v6.18.50)
# topdir: linux-6.18.50 (确认方式: tar tf linux-6.18.50.tar.xz | head -1)
#
# 构建说明: 内核使用 Makefile/Kbuild 构建(无 CMake/meson/autotools),
# 本 spec 以 x86_64 defconfig 为基准构建 bzImage + modules,
# 关闭调试信息 / BTF / 模块签名以缩短构建时间并避免依赖外部密钥。
%global debug_package %{nil}
%global _build_id_links none
%global _missing_build_ids_terminate_build 0
# 内核模块不是普通共享库,跳过 rpm 的 strip / find-requires / find-provides 后处理
%global __os_install_post %{nil}
%global __find_provides %{nil}
%global __find_requires %{nil}
# SRPM 内的裸 tarball 已 xz 压缩,payload 用最快档,避免重复压缩耗时
%global _source_payload w0.gzdio
%global _binary_payload w3.zstdio
# 各架构最终内核镜像路径(%build 生成的同名产物)
%ifarch x86_64
%global kernel_image arch/x86/boot/bzImage
%endif
%ifarch aarch64
%global kernel_image arch/arm64/boot/Image
%endif
Name: kernel
Version: 6.18.50
Release: 1%{?dist}
Summary: The Linux kernel
License: GPL-2.0-only
URL: https://github.com/gregkh/linux
Source0: https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-%{version}.tar.xz
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: binutils
BuildRequires: make
BuildRequires: bc
BuildRequires: bison
BuildRequires: flex
BuildRequires: openssl
BuildRequires: openssl-devel
BuildRequires: elfutils-libelf-devel
BuildRequires: perl
BuildRequires: python3
BuildRequires: rsync
BuildRequires: tar
BuildRequires: xz
BuildRequires: gzip
BuildRequires: bzip2
BuildRequires: zstd
BuildRequires: lz4
BuildRequires: cpio
BuildRequires: kmod
BuildRequires: dwarves
BuildRequires: hostname
BuildRequires: diffutils
BuildRequires: findutils
BuildRequires: which
BuildRequires: glibc-devel
BuildRequires: ncurses-devel
BuildRequires: ca-certificates
Requires(post): kmod
Requires(postun): kmod
%description
The Linux kernel, version %{version}, built from the upstream stable tree
(gregkh/linux tag v%{version}). This package provides the kernel image
(bzImage), the in-tree modules, the kernel configuration and System.map.
%prep
%autosetup -n linux-%{version}
%build
# 目标架构默认配置
make defconfig
# 精简构建:关闭调试信息 / BTF / 模块签名 / WERROR,避免构建期依赖外部密钥与
# 新版 pahole,并显著缩短构建时间(gcc 12.3.1 下 -Werror 风险高)
for opt in DEBUG_INFO DEBUG_INFO_DWARF5 DEBUG_INFO_BTF DEBUG_INFO_BTF_MODULES \
GDB_SCRIPTS MODULE_SIG MODULE_SIG_ALL MODULE_COMPRESS WERROR \
LOCALVERSION_AUTO; do
./scripts/config --file .config -d "$opt" || :
done
./scripts/config --file .config --set-str SYSTEM_TRUSTED_KEYS "" || :
make olddefconfig
if grep -q '^CONFIG_DEBUG_INFO=y' .config; then
echo "ERROR: failed to disable CONFIG_DEBUG_INFO" >&2
exit 1
fi
echo "[kernel] kernelrelease = $(make -s kernelrelease)"
test "$(make -s kernelrelease)" = "%{version}"
%ifarch x86_64
make %{?_smp_mflags} bzImage modules
%endif
%ifarch aarch64
make %{?_smp_mflags} Image modules
%endif
%install
make modules_install INSTALL_MOD_PATH=%{buildroot} INSTALL_MOD_STRIP=1
install -D -p -m 0755 %{kernel_image} %{buildroot}/boot/vmlinuz-%{version}
install -D -p -m 0644 System.map %{buildroot}/boot/System.map-%{version}
install -D -p -m 0644 .config %{buildroot}/boot/config-%{version}
# 源码树符号链接指向构建目录,安装包中必须去掉
rm -f %{buildroot}/lib/modules/%{version}/build \
%{buildroot}/lib/modules/%{version}/source
%post
/sbin/depmod -a %{version} >/dev/null 2>&1 || :
%postun
/sbin/depmod -a %{version} >/dev/null 2>&1 || :
%files
%license COPYING
%doc README
/boot/vmlinuz-%{version}
/boot/System.map-%{version}
/boot/config-%{version}
/lib/modules/%{version}
%changelog
* Sat Nov 07 2026 openEuler Builder <builder@openeuler.org> - 6.18.50-1
- Initial package of the Linux kernel 6.18.50 from gregkh/linux v6.18.50
|