mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
Merge tag 'kbuild-fixes-7.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux
Pull Kbuild fixes from Nathan Chancellor:
- Ensure tools/objtool is cleaned by 'make clean' and 'make mrproper'
- Fix test program for CONFIG_CC_CAN_LINK to avoid a warning, which is
made fatal by -Werror
- Drop explicit LZMA parallel compression in scripts/make_fit.py
- Several fixes for commit 62089b8048 ("kbuild: rpm-pkg: Generate
debuginfo package manually")
* tag 'kbuild-fixes-7.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux:
kbuild: rpm-pkg: Disable automatic requires for manual debuginfo package
kbuild: rpm-pkg: Fix manual debuginfo generation when using .src.rpm
kernel: rpm-pkg: Restore find-debuginfo.sh approach to -debuginfo package
kbuild: rpm-pkg: Restrict manual debug package creation
scripts/make_fit.py: Drop explicit LZMA parallel compression
kbuild: Fix CC_CAN_LINK detection
kbuild: Add objtool to top-level clean target
This commit is contained in:
11
Makefile
11
Makefile
@@ -1497,6 +1497,15 @@ ifneq ($(wildcard $(resolve_btfids_O)),)
|
|||||||
$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
|
$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
PHONY += objtool_clean
|
||||||
|
|
||||||
|
objtool_O = $(abspath $(objtree))/tools/objtool
|
||||||
|
|
||||||
|
objtool_clean:
|
||||||
|
ifneq ($(wildcard $(objtool_O)),)
|
||||||
|
$(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) clean
|
||||||
|
endif
|
||||||
|
|
||||||
tools/: FORCE
|
tools/: FORCE
|
||||||
$(Q)mkdir -p $(objtree)/tools
|
$(Q)mkdir -p $(objtree)/tools
|
||||||
$(Q)$(MAKE) O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
|
$(Q)$(MAKE) O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
|
||||||
@@ -1666,7 +1675,7 @@ vmlinuxclean:
|
|||||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
|
||||||
$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
|
$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
|
||||||
|
|
||||||
clean: archclean vmlinuxclean resolve_btfids_clean
|
clean: archclean vmlinuxclean resolve_btfids_clean objtool_clean
|
||||||
|
|
||||||
# mrproper - Delete all generated files, including .config
|
# mrproper - Delete all generated files, including .config
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ cat << "END" | $@ -Werror -Wl,--fatal-warnings -x c - -o /dev/null >/dev/null 2>
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("");
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
END
|
END
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ COMP_TOOLS = {
|
|||||||
'bzip2': CompTool('.bz2', 'pbzip2,bzip2'),
|
'bzip2': CompTool('.bz2', 'pbzip2,bzip2'),
|
||||||
'gzip': CompTool('.gz', 'pigz,gzip'),
|
'gzip': CompTool('.gz', 'pigz,gzip'),
|
||||||
'lz4': CompTool('.lz4', 'lz4'),
|
'lz4': CompTool('.lz4', 'lz4'),
|
||||||
'lzma': CompTool('.lzma', 'plzip,lzma'),
|
'lzma': CompTool('.lzma', 'lzma'),
|
||||||
'lzo': CompTool('.lzo', 'lzop'),
|
'lzo': CompTool('.lzo', 'lzop'),
|
||||||
'xz': CompTool('.xz', 'xz'),
|
'xz': CompTool('.xz', 'xz'),
|
||||||
'zstd': CompTool('.zstd', 'zstd'),
|
'zstd': CompTool('.zstd', 'zstd'),
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
%{!?_arch: %define _arch dummy}
|
%{!?_arch: %define _arch dummy}
|
||||||
%{!?make: %define make make}
|
%{!?make: %define make make}
|
||||||
%define makeflags %{?_smp_mflags} ARCH=%{ARCH}
|
%define makeflags %{?_smp_mflags} ARCH=%{ARCH}
|
||||||
%define __spec_install_post /usr/lib/rpm/brp-compress || :
|
|
||||||
%define debug_package %{nil}
|
|
||||||
|
|
||||||
Name: kernel
|
Name: kernel
|
||||||
Summary: The Linux Kernel
|
Summary: The Linux Kernel
|
||||||
@@ -47,14 +45,50 @@ This package provides kernel headers and makefiles sufficient to build modules
|
|||||||
against the %{version} kernel package.
|
against the %{version} kernel package.
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if %{with_debuginfo}
|
%if %{with_debuginfo_manual}
|
||||||
%package debuginfo
|
%package debuginfo
|
||||||
Summary: Debug information package for the Linux kernel
|
Summary: Debug information package for the Linux kernel
|
||||||
|
Group: Development/Debug
|
||||||
|
AutoReq: 0
|
||||||
|
AutoProv: 1
|
||||||
%description debuginfo
|
%description debuginfo
|
||||||
This package provides debug information for the kernel image and modules from the
|
This package provides debug information for the kernel image and modules from the
|
||||||
%{version} package.
|
%{version} package.
|
||||||
|
%define install_mod_strip 1
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%if %{with_debuginfo_rpm}
|
||||||
|
# list of debuginfo-related options taken from distribution kernel.spec
|
||||||
|
# files
|
||||||
|
%undefine _include_minidebuginfo
|
||||||
|
%undefine _find_debuginfo_dwz_opts
|
||||||
|
%undefine _unique_build_ids
|
||||||
|
%undefine _unique_debug_names
|
||||||
|
%undefine _unique_debug_srcs
|
||||||
|
%undefine _debugsource_packages
|
||||||
|
%undefine _debuginfo_subpackages
|
||||||
|
%global _find_debuginfo_opts -r
|
||||||
|
%global _missing_build_ids_terminate_build 1
|
||||||
|
%global _no_recompute_build_ids 1
|
||||||
|
%{debug_package}
|
||||||
|
|
||||||
|
# later, we make all modules executable so that find-debuginfo.sh strips
|
||||||
|
# them up. but they don't actually need to be executable, so remove the
|
||||||
|
# executable bit, taking care to do it _after_ find-debuginfo.sh has run
|
||||||
|
%define __spec_install_post \
|
||||||
|
%{?__debug_package:%{__debug_install_post}} \
|
||||||
|
%{__arch_install_post} \
|
||||||
|
%{__os_install_post} \
|
||||||
|
find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \\\
|
||||||
|
| xargs --no-run-if-empty chmod u-x
|
||||||
|
%else
|
||||||
|
%define __spec_install_post /usr/lib/rpm/brp-compress || :
|
||||||
|
%endif
|
||||||
|
# some (but not all) versions of rpmbuild emit %%debug_package with
|
||||||
|
# %%install. since we've already emitted it manually, that would cause
|
||||||
|
# a package redefinition error. ensure that doesn't happen
|
||||||
|
%define debug_package %{nil}
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n linux
|
%setup -q -n linux
|
||||||
cp %{SOURCE1} .config
|
cp %{SOURCE1} .config
|
||||||
@@ -67,7 +101,7 @@ patch -p1 < %{SOURCE2}
|
|||||||
mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE}
|
mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE}
|
||||||
cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz
|
cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz
|
||||||
# DEPMOD=true makes depmod no-op. We do not package depmod-generated files.
|
# DEPMOD=true makes depmod no-op. We do not package depmod-generated files.
|
||||||
%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} INSTALL_MOD_STRIP=1 DEPMOD=true modules_install
|
%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} %{?install_mod_strip:INSTALL_MOD_STRIP=1} DEPMOD=true modules_install
|
||||||
%{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
|
%{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
|
||||||
cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
|
cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
|
||||||
cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
|
cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
|
||||||
@@ -98,22 +132,30 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
|
|||||||
echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
|
echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
|
||||||
} > %{buildroot}/kernel.list
|
} > %{buildroot}/kernel.list
|
||||||
|
|
||||||
%if %{with_debuginfo}
|
%if 0%{with_debuginfo_manual}%{with_debuginfo_rpm} > 0
|
||||||
# copying vmlinux directly to the debug directory means it will not get
|
# copying vmlinux directly to the debug directory means it will not get
|
||||||
# stripped (but its source paths will still be collected + fixed up)
|
# stripped (but its source paths will still be collected + fixed up)
|
||||||
mkdir -p %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}
|
mkdir -p %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}
|
||||||
cp vmlinux %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}
|
cp vmlinux %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{with_debuginfo_rpm}
|
||||||
|
# make modules executable so that find-debuginfo.sh strips them. this
|
||||||
|
# will be undone later in %%__spec_install_post
|
||||||
|
find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \
|
||||||
|
| xargs --no-run-if-empty chmod u+x
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{with_debuginfo_manual}
|
||||||
echo /usr/lib/debug/lib/modules/%{KERNELRELEASE}/vmlinux > %{buildroot}/debuginfo.list
|
echo /usr/lib/debug/lib/modules/%{KERNELRELEASE}/vmlinux > %{buildroot}/debuginfo.list
|
||||||
|
|
||||||
while read -r mod; do
|
while read -r mod; do
|
||||||
mod="${mod%.o}.ko"
|
mod="${mod%.o}.ko"
|
||||||
dbg="%{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}/kernel/${mod}"
|
dbg="%{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}/kernel/${mod}"
|
||||||
buildid=$("${READELF}" -n "${mod}" | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p')
|
buildid=$("${READELF:-readelf}" -n "${mod}" | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p')
|
||||||
link="%{buildroot}/usr/lib/debug/.build-id/${buildid}.debug"
|
link="%{buildroot}/usr/lib/debug/.build-id/${buildid}.debug"
|
||||||
|
|
||||||
mkdir -p "${dbg%/*}" "${link%/*}"
|
mkdir -p "${dbg%/*}" "${link%/*}"
|
||||||
"${OBJCOPY}" --only-keep-debug "${mod}" "${dbg}"
|
"${OBJCOPY:-objcopy}" --only-keep-debug "${mod}" "${dbg}"
|
||||||
ln -sf --relative "${dbg}" "${link}"
|
ln -sf --relative "${dbg}" "${link}"
|
||||||
|
|
||||||
echo "${dbg#%{buildroot}}" >> %{buildroot}/debuginfo.list
|
echo "${dbg#%{buildroot}}" >> %{buildroot}/debuginfo.list
|
||||||
@@ -123,6 +165,10 @@ done < modules.order
|
|||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
%if %{with_debuginfo_rpm}
|
||||||
|
rm -f debugfiles.list debuglinks.list debugsourcefiles.list debugsources.list \
|
||||||
|
elfbins.list
|
||||||
|
%endif
|
||||||
|
|
||||||
%post
|
%post
|
||||||
if [ -x /usr/bin/kernel-install ]; then
|
if [ -x /usr/bin/kernel-install ]; then
|
||||||
@@ -162,7 +208,7 @@ fi
|
|||||||
/lib/modules/%{KERNELRELEASE}/build
|
/lib/modules/%{KERNELRELEASE}/build
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if %{with_debuginfo}
|
%if %{with_debuginfo_manual}
|
||||||
%files -f %{buildroot}/debuginfo.list debuginfo
|
%files -f %{buildroot}/debuginfo.list debuginfo
|
||||||
%defattr (-, root, root)
|
%defattr (-, root, root)
|
||||||
%exclude /debuginfo.list
|
%exclude /debuginfo.list
|
||||||
|
|||||||
@@ -23,15 +23,47 @@ else
|
|||||||
echo '%define with_devel 0'
|
echo '%define with_devel 0'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# use %{debug_package} machinery to generate -debuginfo
|
||||||
|
with_debuginfo_rpm=0
|
||||||
|
# manually generate -debuginfo package
|
||||||
|
with_debuginfo_manual=0
|
||||||
# debuginfo package generation uses find-debuginfo.sh under the hood,
|
# debuginfo package generation uses find-debuginfo.sh under the hood,
|
||||||
# which only works on uncompressed modules that contain debuginfo
|
# which only works on uncompressed modules that contain debuginfo
|
||||||
if grep -q CONFIG_DEBUG_INFO=y include/config/auto.conf &&
|
if grep -q CONFIG_DEBUG_INFO=y include/config/auto.conf &&
|
||||||
(! grep -q CONFIG_MODULE_COMPRESS=y include/config/auto.conf) &&
|
(! grep -q CONFIG_MODULE_COMPRESS=y include/config/auto.conf) &&
|
||||||
(! grep -q CONFIG_DEBUG_INFO_SPLIT=y include/config/auto.conf); then
|
(! grep -q CONFIG_DEBUG_INFO_SPLIT=y include/config/auto.conf); then
|
||||||
echo '%define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1}'
|
# If module signing is enabled (which may be required to boot with
|
||||||
else
|
# lockdown enabled), the find-debuginfo.sh machinery cannot be used
|
||||||
echo '%define with_debuginfo 0'
|
# because the signatures will be stripped off the modules. However, due
|
||||||
|
# to an rpm bug in versions prior to 4.20.0
|
||||||
|
#
|
||||||
|
# https://github.com/rpm-software-management/rpm/issues/3057
|
||||||
|
# https://github.com/rpm-software-management/rpm/commit/49f906998f3cf1f4152162ca61ac0869251c380f
|
||||||
|
#
|
||||||
|
# We cannot provide our own debuginfo package because it does not listen
|
||||||
|
# to our custom files list, failing the build due to unpackaged files.
|
||||||
|
# Manually generate the debug info package if using rpm 4.20.0. If not
|
||||||
|
# using rpm 4.20.0, avoid generating a -debuginfo package altogether,
|
||||||
|
# as it is not safe.
|
||||||
|
if grep -q CONFIG_MODULE_SIG=y include/config/auto.conf; then
|
||||||
|
rpm_ver_str=$(rpm --version 2>/dev/null)
|
||||||
|
# Split the version on spaces
|
||||||
|
IFS=' '
|
||||||
|
set -- $rpm_ver_str
|
||||||
|
if [ "${1:-}" = RPM -a "${2:-}" = version ]; then
|
||||||
|
IFS=.
|
||||||
|
set -- $3
|
||||||
|
rpm_ver=$(( 1000000 * $1 + 10000 * $2 + 100 * $3 + ${4:-0} ))
|
||||||
|
if [ "$rpm_ver" -ge 4200000 ]; then
|
||||||
|
with_debuginfo_manual='%{?_without_debuginfo:0}%{?!_without_debuginfo:1}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
with_debuginfo_rpm='%{?_without_debuginfo:0}%{?!_without_debuginfo:1}'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
echo "%define with_debuginfo_manual $with_debuginfo_manual"
|
||||||
|
echo "%define with_debuginfo_rpm $with_debuginfo_rpm"
|
||||||
|
|
||||||
cat<<EOF
|
cat<<EOF
|
||||||
%define ARCH ${ARCH}
|
%define ARCH ${ARCH}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
|||||||
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
RM ?= rm -f
|
||||||
|
|
||||||
LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/
|
LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/
|
||||||
ifneq ($(OUTPUT),)
|
ifneq ($(OUTPUT),)
|
||||||
LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd
|
LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd
|
||||||
|
|||||||
Reference in New Issue
Block a user