Skip to contentSkip to conversation

kernel-devsrc: copy arch/powerpc/tools contents

PATCH Superseded [email protected] 2 participants 2 messages Jul 17, 2025

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kernel-devsrc: copy arch/powerpc/tools contents

From: Chen Qi <[email protected]>

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

---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-kernel/linux/kernel-devsrc.bb +4 -0
index 3d2eb3929e..c4b5d0e5a6 100644
@@ -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 || :
Signature · 1 line
2.49.0
#1 lore raw
Quoted 26 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

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
"""

Quoted 7 lines

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

Quoted 49 lines

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

---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-kernel/linux/kernel-devsrc.bb +1 -0
index 3d2eb3929e..c4b5d0e5a6 100644
@@ -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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II