|
2 | 2 | %{!?_arch: %define _arch dummy}
|
3 | 3 | %{!?make: %define make make}
|
4 | 4 | %define makeflags %{?_smp_mflags} ARCH=%{ARCH}
|
5 |
| -%define __spec_install_post /usr/lib/rpm/brp-compress || : |
6 |
| -%define debug_package %{nil} |
7 | 5 |
|
8 | 6 | Name: kernel
|
9 | 7 | Summary: The Linux Kernel
|
@@ -46,6 +44,36 @@ This package provides kernel headers and makefiles sufficient to build modules
|
46 | 44 | against the %{version} kernel package.
|
47 | 45 | %endif
|
48 | 46 |
|
| 47 | +%if %{with_debuginfo} |
| 48 | +# list of debuginfo-related options taken from distribution kernel.spec |
| 49 | +# files |
| 50 | +%undefine _include_minidebuginfo |
| 51 | +%undefine _find_debuginfo_dwz_opts |
| 52 | +%undefine _unique_build_ids |
| 53 | +%undefine _unique_debug_names |
| 54 | +%undefine _unique_debug_srcs |
| 55 | +%undefine _debugsource_packages |
| 56 | +%undefine _debuginfo_subpackages |
| 57 | +%global _find_debuginfo_opts -r |
| 58 | +%global _missing_build_ids_terminate_build 1 |
| 59 | +%global _no_recompute_build_ids 1 |
| 60 | +%{debug_package} |
| 61 | +%endif |
| 62 | +# some (but not all) versions of rpmbuild emit %%debug_package with |
| 63 | +# %%install. since we've already emitted it manually, that would cause |
| 64 | +# a package redefinition error. ensure that doesn't happen |
| 65 | +%define debug_package %{nil} |
| 66 | + |
| 67 | +# later, we make all modules executable so that find-debuginfo.sh strips |
| 68 | +# them up. but they don't actually need to be executable, so remove the |
| 69 | +# executable bit, taking care to do it _after_ find-debuginfo.sh has run |
| 70 | +%define __spec_install_post \ |
| 71 | + %{?__debug_package:%{__debug_install_post}} \ |
| 72 | + %{__arch_install_post} \ |
| 73 | + %{__os_install_post} \ |
| 74 | + find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \\\ |
| 75 | + | xargs --no-run-if-empty chmod u-x |
| 76 | + |
49 | 77 | %prep
|
50 | 78 | %setup -q -n linux
|
51 | 79 | cp %{SOURCE1} .config
|
@@ -89,8 +117,22 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
|
89 | 117 | echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
|
90 | 118 | } > %{buildroot}/kernel.list
|
91 | 119 |
|
| 120 | +# make modules executable so that find-debuginfo.sh strips them. this |
| 121 | +# will be undone later in %%__spec_install_post |
| 122 | +find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \ |
| 123 | + | xargs --no-run-if-empty chmod u+x |
| 124 | + |
| 125 | +%if %{with_debuginfo} |
| 126 | +# copying vmlinux directly to the debug directory means it will not get |
| 127 | +# stripped (but its source paths will still be collected + fixed up) |
| 128 | +mkdir -p %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE} |
| 129 | +cp vmlinux %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE} |
| 130 | +%endif |
| 131 | + |
92 | 132 | %clean
|
93 | 133 | rm -rf %{buildroot}
|
| 134 | +rm -f debugfiles.list debuglinks.list debugsourcefiles.list debugsources.list \ |
| 135 | + elfbins.list |
94 | 136 |
|
95 | 137 | %post
|
96 | 138 | if [ -x /usr/bin/kernel-install ]; then
|
|
0 commit comments