From: Don Zickus <dzickus(a)redhat.com>
Fix ppc64le cross build packaging
CKI has been failing to cross build a ppc64le rpm for a while now. The
reason why is the ppc64le-gnu-strip command could not recognize the
scripts/dtc/libfdt/fdt_strerror.o file because it was an x86_64 file
type. That is a result of the cross env.
What should have happened is, none of the *.o files in the script
directory should be there and thus the strip command would have nothing
to strip.
Having x86_64 files lying around to be packaged in kernel-devel is
another problem. But for this build problem, just remove all the *.o
files in the script/ area.
The spec file tries to do this, but fails to remove *.o's at another
directory layer (libfdt). Let's just replace the 'rm' commands with a
'find and rm' command instead.
Tested in a CKI container. After this change, the rpm builds.
Signed-off-by: Don Zickus <dzickus(a)redhat.com>
diff a/redhat/kernel.spec.template b/redhat/kernel.spec.template
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -1759,8 +1759,7 @@ BuildKernel() {
if [ -f arch/%{asmarch}/kernel/module.lds ]; then
cp -a --parents arch/%{asmarch}/kernel/module.lds
$RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
fi
- rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*.o
- rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o
+ find $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts \( -iname "*.o"
-o -iname "*.cmd" \) -exec rm -f {} +
%ifarch ppc64le
cp -a --parents arch/powerpc/lib/crtsavres.[So]
$RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
%endif
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1105