diff mbox series

[V2] kernel-devsrc: copy arch/powerpc/tools contents

Message ID 20250717025948.1442716-1-Qi.Chen@windriver.com
State New
Headers show
Series [V2] kernel-devsrc: copy arch/powerpc/tools contents | expand

Commit Message

Chen, Qi July 17, 2025, 2:59 a.m. UTC
From: Chen Qi <Qi.Chen@windriver.com>

For now, using qemuppc64 as MACHINE and building things inside SDK,
we'll get the following error:

  ERROR: modpost: "_mcount" undefined

This is because after [1], MPROFILE_KERNEL is using arch/powerpc/tools/
contents to do the check. This in turn affects HAVE_OBJTOOL.
"""
arch/powerpc/Kconfig:   select HAVE_OBJTOOL                     if ARCH_USING_PATCHABLE_FUNCTION_ENTRY || MPROFILE_KERNEL || PPC32
"""

The current MPROFILE_KERNEL for powerpc:
"""
config MPROFILE_KERNEL
            depends on PPC64_ELF_ABI_V2 && FUNCTION_TRACER
            def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mlittle-endian) if CPU_LITTLE_ENDIAN
            def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mbig-endian) if CPU_BIG_ENDIAN
"""

If MPROFILE_KERNEL is disabled, thus HAVE_OBJTOOL being disabled, then
FTRACE_MCOUNT_USE_RECORDMCOUNT will be enabled, causing this error.

Note that there are 6 scripts under arch/powerpc/tools directory and we
need to copy them all. They are needed in the same way as MPROFILE_KERNEL
needing gcc-check-mprofile-kernel.sh.

For example, gcc-check-fpatchable-function-entry.sh is needed by
ARCH_USING_PATCHABLE_FUNCTION_ENTRY.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=abba759796f9b73eb24df9b734dd063839fc62e0

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bruce Ashfield July 17, 2025, 3:46 a.m. UTC | #1
On Wed, Jul 16, 2025 at 11:00 PM Chen Qi via lists.openembedded.org
<Qi.Chen=windriver.com@lists.openembedded.org> wrote:

> From: Chen Qi <Qi.Chen@windriver.com>
>
> For now, using qemuppc64 as MACHINE and building things inside SDK,
> we'll get the following error:
>
>   ERROR: modpost: "_mcount" undefined
>
> This is because after [1], MPROFILE_KERNEL is using arch/powerpc/tools/
> contents to do the check. This in turn affects HAVE_OBJTOOL.
> """
> arch/powerpc/Kconfig:   select HAVE_OBJTOOL                     if
> ARCH_USING_PATCHABLE_FUNCTION_ENTRY || MPROFILE_KERNEL || PPC32
> """
>
> The current MPROFILE_KERNEL for powerpc:
> """
> config MPROFILE_KERNEL
>             depends on PPC64_ELF_ABI_V2 && FUNCTION_TRACER
>             def_bool
> $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC)
> -mlittle-endian) if CPU_LITTLE_ENDIAN
>             def_bool
> $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC)
> -mbig-endian) if CPU_BIG_ENDIAN
> """
>
> If MPROFILE_KERNEL is disabled, thus HAVE_OBJTOOL being disabled, then
> FTRACE_MCOUNT_USE_RECORDMCOUNT will be enabled, causing this error.
>
> Note that there are 6 scripts under arch/powerpc/tools directory and we
> need to copy them all. They are needed in the same way as MPROFILE_KERNEL
> needing gcc-check-mprofile-kernel.sh.
>

Then list them all.

No other architecture does a complete copy of tools/ and copying entire
directories
has been avoided unless absolutely necessary.

If there are future items added there that we don't need, we don't want
them copied.
If there are new items added in the future that we do need, we WANT the
failure to
notify us to inspect and add them into the list.

Bruce



>
> For example, gcc-check-fpatchable-function-entry.sh is needed by
> ARCH_USING_PATCHABLE_FUNCTION_ENTRY.
>
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=abba759796f9b73eb24df9b734dd063839fc62e0
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>  meta/recipes-kernel/linux/kernel-devsrc.bb | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb
> b/meta/recipes-kernel/linux/kernel-devsrc.bb
> index 3d2eb3929e..c4b5d0e5a6 100644
> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
> @@ -208,6 +208,10 @@ do_install() {
>          fi
>
>          if [ "${ARCH}" = "powerpc" ]; then
> +            # 4.18+ needs these files for MPROFILE_KERNEL, but don't
> error if they aren't present in the source
> +            # See
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=abba759796f9b73eb24df9b734dd063839fc62e0
> +            cp -a --parents arch/powerpc/tools $kerneldir/build/
> 2>/dev/null || :
> +
>              # 5.0 needs these files, but don't error if they aren't
> present in the source
>              cp -a --parents arch/${ARCH}/kernel/syscalls/syscall.tbl
> $kerneldir/build/ 2>/dev/null || :
>              cp -a --parents arch/${ARCH}/kernel/syscalls/syscalltbl.sh
> $kerneldir/build/ 2>/dev/null || :
> --
> 2.49.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#220513):
> https://lists.openembedded.org/g/openembedded-core/message/220513
> Mute This Topic: https://lists.openembedded.org/mt/114197717/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 3d2eb3929e..c4b5d0e5a6 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -208,6 +208,10 @@  do_install() {
         fi
 
         if [ "${ARCH}" = "powerpc" ]; then
+            # 4.18+ needs these files for MPROFILE_KERNEL, but don't error if they aren't present in the source
+            # See https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=abba759796f9b73eb24df9b734dd063839fc62e0
+            cp -a --parents arch/powerpc/tools $kerneldir/build/ 2>/dev/null || :
+
             # 5.0 needs these files, but don't error if they aren't present in the source
             cp -a --parents arch/${ARCH}/kernel/syscalls/syscall.tbl $kerneldir/build/ 2>/dev/null || :
             cp -a --parents arch/${ARCH}/kernel/syscalls/syscalltbl.sh $kerneldir/build/ 2>/dev/null || :