summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaura Abbott <labbott@redhat.com>2018-07-23 10:17:44 -0700
committerLaura Abbott <labbott@redhat.com>2018-07-23 10:17:44 -0700
commit606a7e904bc8f49a3dcac2c59e3006a55711662b (patch)
treedbdec983453e8f09e1bf9da00d05ce758d8afc84
parent39deac3020ad0990fae44b8fba7c14c538136c1b (diff)
downloadkernel-606a7e904bc8f49a3dcac2c59e3006a55711662b.tar.gz
kernel-606a7e904bc8f49a3dcac2c59e3006a55711662b.tar.xz
kernel-606a7e904bc8f49a3dcac2c59e3006a55711662b.zip
Fix cross build issues (rhbz 1607158)
The %{build_cflags} and %{build_ldflags} assume host == arch which isn't true on cross builds. Don't use these flags when cross building.
-rw-r--r--kernel.spec12
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel.spec b/kernel.spec
index f18fb3649..a36563e3b 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -1192,8 +1192,14 @@ cp_vmlinux()
# they come from the kernel package, we can't just use find-debuginfo.sh to
# rewrite only those binaries. The easiest option right now is just to have
# the build id be a uuid for the host programs.
+#
+# Note we need to disable these flags for cross builds because the flags
+# from redhat-rpm-config assume that host == target so target arch
+# flags cause issues with the host compiler.
+%if !%{with_cross}
%define build_hostcflags %{build_cflags}
%define build_hostldflags %{build_ldflags} -Wl,--build-id=uuid
+%endif
BuildKernel() {
MakeTarget=$1
@@ -1245,12 +1251,12 @@ BuildKernel() {
Arch=`head -1 .config | cut -b 3-`
echo USING ARCH=$Arch
- make %{?make_opts} HOSTCFLAGS="%{build_hostcflags}" HOSTLDFLAGS="%{build_hostldflags}" ARCH=$Arch olddefconfig
+ make %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" ARCH=$Arch olddefconfig
# This ensures build-ids are unique to allow parallel debuginfo
perl -p -i -e "s/^CONFIG_BUILD_SALT.*/CONFIG_BUILD_SALT=\"%{KVERREL}\"/" .config
- %{make} %{?make_opts} HOSTCFLAGS="%{build_hostcflags}" HOSTLDFLAGS="%{build_hostldflags}" ARCH=$Arch %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags}
- %{make} %{?make_opts} HOSTCFLAGS="%{build_hostcflags}" HOSTLDFLAGS="%{build_hostldflags}" ARCH=$Arch %{?_smp_mflags} modules %{?sparse_mflags} || exit 1
+ %{make} %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" ARCH=$Arch %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags}
+ %{make} %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" ARCH=$Arch %{?_smp_mflags} modules %{?sparse_mflags} || exit 1
mkdir -p $RPM_BUILD_ROOT/%{image_install_path}
mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer