From 26ab2848acc6e07b338be8712491eff498d101b3 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Sat, 7 Nov 2026 09:37:37 +0000 Subject: automatic import of kernel --- .gitignore | 1 + kernel.spec | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 134 insertions(+) create mode 100644 kernel.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..bb36005 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/linux-6.18.50.tar.xz diff --git a/kernel.spec b/kernel.spec new file mode 100644 index 0000000..c9a9371 --- /dev/null +++ b/kernel.spec @@ -0,0 +1,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 - 6.18.50-1 +- Initial package of the Linux kernel 6.18.50 from gregkh/linux v6.18.50 diff --git a/sources b/sources new file mode 100644 index 0000000..e737ca3 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +7128d4e244f41d32f8bb8292b8245ca7 linux-6.18.50.tar.xz -- cgit v1.2.3