Merge tag 'kbuild-fixes-6.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux

Pull Kbuild fixes from Nicolas Schier:

- Generate rpm-pkg debuginfo package manually, allowing signed kernel
modules in rpm package, again

- Fix permissions of modules.builtin.modinfo

- Do not run kernel-doc when building external modules

* tag 'kbuild-fixes-6.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux:
kbuild: Do not run kernel-doc when building external modules
kbuild: Fix permissions of modules.builtin.modinfo
kbuild: rpm-pkg: Generate debuginfo package manually

+34 -36
+2
scripts/Makefile.build
··· 166 166 cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< 167 167 endif 168 168 169 + ifeq ($(KBUILD_EXTMOD),) 169 170 ifneq ($(KBUILD_EXTRA_WARN),) 170 171 cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \ 171 172 $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \ 172 173 $< 174 + endif 173 175 endif 174 176 175 177 # Compile C sources (.c)
+2 -1
scripts/Makefile.vmlinux
··· 113 113 # what kmod expects to parse. 114 114 quiet_cmd_modules_builtin_modinfo = GEN $@ 115 115 cmd_modules_builtin_modinfo = $(cmd_objcopy); \ 116 - sed -i 's/\x00\+$$/\x00/g' $@ 116 + sed -i 's/\x00\+$$/\x00/g' $@; \ 117 + chmod -x $@ 117 118 118 119 OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary 119 120
+30 -35
scripts/package/kernel.spec
··· 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} 5 7 6 8 Name: kernel 7 9 Summary: The Linux Kernel ··· 48 46 %endif 49 47 50 48 %if %{with_debuginfo} 51 - # list of debuginfo-related options taken from distribution kernel.spec 52 - # files 53 - %undefine _include_minidebuginfo 54 - %undefine _find_debuginfo_dwz_opts 55 - %undefine _unique_build_ids 56 - %undefine _unique_debug_names 57 - %undefine _unique_debug_srcs 58 - %undefine _debugsource_packages 59 - %undefine _debuginfo_subpackages 60 - %global _find_debuginfo_opts -r 61 - %global _missing_build_ids_terminate_build 1 62 - %global _no_recompute_build_ids 1 63 - %{debug_package} 49 + %package debuginfo 50 + Summary: Debug information package for the Linux kernel 51 + %description debuginfo 52 + This package provides debug information for the kernel image and modules from the 53 + %{version} package. 64 54 %endif 65 - # some (but not all) versions of rpmbuild emit %%debug_package with 66 - # %%install. since we've already emitted it manually, that would cause 67 - # a package redefinition error. ensure that doesn't happen 68 - %define debug_package %{nil} 69 - 70 - # later, we make all modules executable so that find-debuginfo.sh strips 71 - # them up. but they don't actually need to be executable, so remove the 72 - # executable bit, taking care to do it _after_ find-debuginfo.sh has run 73 - %define __spec_install_post \ 74 - %{?__debug_package:%{__debug_install_post}} \ 75 - %{__arch_install_post} \ 76 - %{__os_install_post} \ 77 - find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \\\ 78 - | xargs --no-run-if-empty chmod u-x 79 55 80 56 %prep 81 57 %setup -q -n linux ··· 67 87 mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE} 68 88 cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz 69 89 # DEPMOD=true makes depmod no-op. We do not package depmod-generated files. 70 - %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} DEPMOD=true modules_install 90 + %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} INSTALL_MOD_STRIP=1 DEPMOD=true modules_install 71 91 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install 72 92 cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE} 73 93 cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config ··· 98 118 echo "%exclude /lib/modules/%{KERNELRELEASE}/build" 99 119 } > %{buildroot}/kernel.list 100 120 101 - # make modules executable so that find-debuginfo.sh strips them. this 102 - # will be undone later in %%__spec_install_post 103 - find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \ 104 - | xargs --no-run-if-empty chmod u+x 105 - 106 121 %if %{with_debuginfo} 107 122 # copying vmlinux directly to the debug directory means it will not get 108 123 # stripped (but its source paths will still be collected + fixed up) 109 124 mkdir -p %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE} 110 125 cp vmlinux %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE} 126 + 127 + echo /usr/lib/debug/lib/modules/%{KERNELRELEASE}/vmlinux > %{buildroot}/debuginfo.list 128 + 129 + while read -r mod; do 130 + mod="${mod%.o}.ko" 131 + dbg="%{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}/kernel/${mod}" 132 + buildid=$("${READELF}" -n "${mod}" | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p') 133 + link="%{buildroot}/usr/lib/debug/.build-id/${buildid}.debug" 134 + 135 + mkdir -p "${dbg%/*}" "${link%/*}" 136 + "${OBJCOPY}" --only-keep-debug "${mod}" "${dbg}" 137 + ln -sf --relative "${dbg}" "${link}" 138 + 139 + echo "${dbg#%{buildroot}}" >> %{buildroot}/debuginfo.list 140 + echo "${link#%{buildroot}}" >> %{buildroot}/debuginfo.list 141 + done < modules.order 111 142 %endif 112 143 113 144 %clean 114 145 rm -rf %{buildroot} 115 - rm -f debugfiles.list debuglinks.list debugsourcefiles.list debugsources.list \ 116 - elfbins.list 117 146 118 147 %post 119 148 if [ -x /usr/bin/kernel-install ]; then ··· 160 171 %defattr (-, root, root) 161 172 /usr/src/kernels/%{KERNELRELEASE} 162 173 /lib/modules/%{KERNELRELEASE}/build 174 + %endif 175 + 176 + %if %{with_debuginfo} 177 + %files -f %{buildroot}/debuginfo.list debuginfo 178 + %defattr (-, root, root) 179 + %exclude /debuginfo.list 163 180 %endif