When comiling a custom kernel using 4.14 source from git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git an error occurs executing the task do_shared_workdir: ERROR: linux-kernel-4.14.23-r0 do_shared_workdir: Function failed: do_shared_workdir (log file is located at /home/guille/Documentos/Yocto/build-ppc64/tmp/work/powermacg5-poky-linux/linux-kernel/4.14.23-r0/temp/log.do_shared_workdir.8575) ERROR: Logfile of failure stored in: /home/guille/Documentos/Yocto/build-ppc64/tmp/work/powermacg5-poky-linux/linux-kernel/4.14.23-r0/temp/log.do_shared_workdir.8575 Log data follows: | DEBUG: Executing shell function do_shared_workdir | cp: cannot stat 'arch/powerpc/lib/crtsavres.o': No such file or directory | WARNING: /home/guille/Documentos/Yocto/build-ppc64/tmp/work/powermacg5-poky-linux/linux-kernel/4.14.23-r0/temp/run.do_shared_workdir.8575:1 exit 1 from 'cp arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o' | ERROR: Function failed: do_shared_workdir (log file is located at /home/guille/Documentos/Yocto/build-ppc64/tmp/work/powermacg5-poky-linux/linux-kernel/4.14.23-r0/temp/log.do_shared_workdir.8575) ERROR: Task (/home/guille/Documentos/Yocto/poky/meta-progress-bsp/recipes-kernel/linux/linux-kernel_4.14.bb:do_shared_workdir) failed with exit code '1' The error is caused by the following code in meta/classes/kernel.bbclass # As of Linux kernel version 3.0.1, the clean target removes # arch/powerpc/lib/crtsavres.o which is present in # KBUILD_LDFLAGS_MODULE, making it required to build external modules. if [ ${ARCH} = "powerpc" ]; then mkdir -p $kerneldir/arch/powerpc/lib/ cp arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o fi There is a change in the kernel (4.14) source that makes the previous code fail. The code can be found at arch/powerpc/lib/Makefile obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o # See corresponding test in arch/powerpc/Makefile # 64-bit linker creates .sfpr on demand for final link (vmlinux), # so it is only needed for modules, and only for older linkers which # do not support --save-restore-funcs ifeq ($(call ld-ifversion, -lt, 225000000, y),y) extra-$(CONFIG_PPC64) += crtsavres.o endif This makes behave different ppc32 and ppc64 regarding crtsavres.o A possible fix is to repace the if condition in meta/classes/kernel.bbclass by # As of Linux kernel version 3.0.1, the clean target removes # arch/powerpc/lib/crtsavres.o which is present in # KBUILD_LDFLAGS_MODULE, making it required to build external modules. if [ ${ARCH} = "powerpc" ] && [ -e arch/powerpc/lib/crtsavres.o ]; then mkdir -p $kerneldir/arch/powerpc/lib/ cp arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o fi
You need to attach your kernel recipe. We are building 4.14, 4.15 and 4.16 for qemuppc without any issues. I need to reproduce the error here, before considering any changes. Yes, adding more checks for some of the files make sense, but again, not until I've reproduced the error. qemuppc login: root root@qemuppc:~# uname -a Linux qemuppc 4.15.0-yocto-standard #1 PREEMPT Thu Mar 1 10:10:29 EST 2018 ppc GNU/Linux root@qemuppc:~#
Created attachment 4220 [details] Custom kernel 4.14 recipe If I'm not wrong qemuppc is ppc32 and should not fail when executing do_shared_workdir. I'm using a maching called powermacg5 which is a custom definition of a ppc64 machine. I can provide a tar.gz with all the layers if required
I'm also building ppc64 as arch testing, and so far so good. I'll have a look at the attachment and create a patch based on my findings.
Can I get your BSP layer attached to the bug ? My reference ppc64 platform, using the 4.15 kernel and the default gcc/linker combo in master are still building crtsavres.o Yes, I understand why and I could absolutely make this code change and only test that it doesn't break my ppc64 case, but I'd also like to test it against yours as well.
Created attachment 4223 [details] Layers Sure! Find all the layers I'm using here. The BSP is called meta-progres-bsp and I'm including my local.conf within the build-ppc64 directory. I haven't tried 4.15 yet. If it helps this is the commit introducing the change in kernel 4.15 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/arch/powerpc/lib?h=v4.15.7&id=efe0160cfd40a99c052a00e174787c1f4158a9cd
Fantastic. I expect to have a patch by end of day.
What branch are you seeing this error ? I'm now building your BSP layer without issues (or my change). So it must be the linker that is triggering the different behaviour, and I want to remove that last doubt.
I'm using rocko branch
Merged with oe-core af58819253a2d4526dc8871a17e1492bd1d92951