The kernel-headers package it primarily used in Fedora to build the
toolchain components. This works fine for native builds, but we do
not have cross-architecture headers available. That means that the
cross compiler toolchains we have can only be built without headers
and therefore are only useful for building the kernel. Given that
Fedora does not allow cross-compiling of it's packages, that hasn't
been a problem to date.
However, the toolchains might be used by application developers to
build their own software. Providing the ability to build cross
toolchains that offer glibc as well may benefit these users. This
provides a kernel-cross-headers package that will at least allow
this possibility.
---
kernel.spec | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/kernel.spec b/kernel.spec
index 5578b2c..5253426 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -90,6 +90,7 @@ Summary: The Linux kernel
%define with_debug %{?_without_debug: 0} %{?!_without_debug: 1}
# kernel-headers
%define with_headers %{?_without_headers: 0} %{?!_without_headers: 1}
+%define with_cross_headers %{?_without_cross_headers: 0} %{?!_without_cross_headers: 1}
# perf
%define with_perf %{?_without_perf: 0} %{?!_without_perf: 1}
# tools
@@ -227,6 +228,7 @@ Summary: The Linux kernel
%ifarch noarch
%define with_up 0
%define with_headers 0
+%define with_cross_headers 0
%define with_tools 0
%define with_perf 0
%define all_arch_configs kernel-%{version}-*.config
@@ -291,6 +293,7 @@ Summary: The Linux kernel
# just like we used to only build them on i386 for x86
%ifnarch armv7hl
%define with_headers 0
+%define with_cross_headers 0
%define with_perf 0
%define with_tools 0
%endif
@@ -649,6 +652,17 @@ header files define structures and constants that are needed for
building most standard programs and are also needed for rebuilding the
glibc package.
+%package cross-headers
+Summary: Header files for the Linux kernel for use by cross-glibc
+Group: Development/System
+%description cross-headers
+Kernel-cross-headers includes the C header files that specify the interface
+between the Linux kernel and userspace libraries and programs. The
+header files define structures and constants that are needed for
+building most standard programs and are also needed for rebuilding the
+cross-glibc package.
+
+
%package bootwrapper
Summary: Boot wrapper files for generating combined kernel + initrd images
Group: Development/System
@@ -1738,6 +1752,33 @@ find $RPM_BUILD_ROOT/usr/include \
%endif
+%if %{with_cross_headers}
+mkdir -p $RPM_BUILD_ROOT/usr/tmp-headers
+make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/tmp-headers headers_install_all
+
+find $RPM_BUILD_ROOT/usr/tmp-headers/include \
+ \( -name .install -o -name .check -o \
+ -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
+
+# Copy all the architectures we care about to their respective asm directories
+for arch in arm arm64 powerpc s390 x86 ; do
+mkdir -p $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include
+mv $RPM_BUILD_ROOT/usr/tmp-headers/include/asm-${arch} $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/asm
+cp -a $RPM_BUILD_ROOT/usr/tmp-headers/include/asm-generic $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/.
+done
+
+# Remove the rest of the architectures
+rm -rf $RPM_BUILD_ROOT/usr/tmp-headers/include/arch*
+rm -rf $RPM_BUILD_ROOT/usr/tmp-headers/include/asm-*
+
+# Copy the rest of the headers over
+for arch in arm arm64 powerpc s390 x86 ; do
+cp -a $RPM_BUILD_ROOT/usr/tmp-headers/include/* $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/.
+done
+
+rm -rf $RPM_BUILD_ROOT/usr/tmp-headers
+%endif
+
%if %{with_perf}
# perf tool binary and supporting scripts/binaries
%{perf_make} DESTDIR=$RPM_BUILD_ROOT lib=%{_lib} install-bin install-traceevent-plugins
@@ -1924,6 +1965,12 @@ fi
/usr/include/*
%endif
+%if %{with_cross_headers}
+%files cross-headers
+%defattr(-,root,root)
+/usr/*-linux-gnu/include/*
+%endif
+
%if %{with_bootwrapper}
%files bootwrapper
%defattr(-,root,root)
--
2.5.0