diff --git a/kernel.spec b/kernel.spec index 35a81db71..286c64e0e 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 @@ -652,6 +655,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 @@ -1741,6 +1755,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 @@ -1927,6 +1968,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)