diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-06-16 01:31:07 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-19 13:18:56 +0100 |
commit | 0ef2e5081b9c7250d2755e038f911a99ebe43a65 (patch) | |
tree | 108a99949aa27eeb5d2ae7ab1025fa0e8dfc43cd /meta/classes-recipe | |
parent | 8502913bd3a653031943d8b1045153196ee30406 (diff) | |
download | poky-0ef2e5081b9c7250d2755e038f911a99ebe43a65.tar.gz |
kernel: Add kernel specific STRIP variable
strip can be coming from binutils or from llvm
in some cases llvm-strip can fail on kernel
Subprocess output:aarch64-yoe-linux-llvm-strip: error: Link field value 28 in section .rela.dyn is not a symbol table
This helps in selecting which strip is used when building kernel
(From OE-Core rev: 03973c8c1c93ddb1c8e05b773bfcc45aed73a99f)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe')
-rw-r--r-- | meta/classes-recipe/kernel-arch.bbclass | 3 | ||||
-rw-r--r-- | meta/classes-recipe/kernel-devicetree.bbclass | 2 | ||||
-rw-r--r-- | meta/classes-recipe/kernel-yocto.bbclass | 4 | ||||
-rw-r--r-- | meta/classes-recipe/kernel.bbclass | 6 | ||||
-rw-r--r-- | meta/classes-recipe/module.bbclass | 7 |
5 files changed, 19 insertions, 3 deletions
diff --git a/meta/classes-recipe/kernel-arch.bbclass b/meta/classes-recipe/kernel-arch.bbclass index 5877048916..6e19dbbba8 100644 --- a/meta/classes-recipe/kernel-arch.bbclass +++ b/meta/classes-recipe/kernel-arch.bbclass | |||
@@ -70,10 +70,13 @@ TARGET_AR_KERNEL_ARCH ?= "" | |||
70 | HOST_AR_KERNEL_ARCH ?= "${TARGET_AR_KERNEL_ARCH}" | 70 | HOST_AR_KERNEL_ARCH ?= "${TARGET_AR_KERNEL_ARCH}" |
71 | TARGET_OBJCOPY_KERNEL_ARCH ?= "" | 71 | TARGET_OBJCOPY_KERNEL_ARCH ?= "" |
72 | HOST_OBJCOPY_KERNEL_ARCH ?= "${TARGET_OBJCOPY_KERNEL_ARCH}" | 72 | HOST_OBJCOPY_KERNEL_ARCH ?= "${TARGET_OBJCOPY_KERNEL_ARCH}" |
73 | TARGET_STRIP_KERNEL_ARCH ?= "" | ||
74 | HOST_STRIP_KERNEL_ARCH ?= "${TARGET_STRIP_KERNEL_ARCH}" | ||
73 | 75 | ||
74 | KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH}" | 76 | KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH}" |
75 | KERNEL_LD = "${CCACHE}${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}" | 77 | KERNEL_LD = "${CCACHE}${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}" |
76 | KERNEL_AR = "${CCACHE}${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}" | 78 | KERNEL_AR = "${CCACHE}${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}" |
77 | KERNEL_OBJCOPY = "${CCACHE}${HOST_PREFIX}objcopy ${HOST_OBJCOPY_KERNEL_ARCH}" | 79 | KERNEL_OBJCOPY = "${CCACHE}${HOST_PREFIX}objcopy ${HOST_OBJCOPY_KERNEL_ARCH}" |
80 | KERNEL_STRIP = "${CCACHE}${HOST_PREFIX}strip ${HOST_STRIP_KERNEL_ARCH}" | ||
78 | TOOLCHAIN ?= "gcc" | 81 | TOOLCHAIN ?= "gcc" |
79 | 82 | ||
diff --git a/meta/classes-recipe/kernel-devicetree.bbclass b/meta/classes-recipe/kernel-devicetree.bbclass index b3bae32f9e..1b60c14740 100644 --- a/meta/classes-recipe/kernel-devicetree.bbclass +++ b/meta/classes-recipe/kernel-devicetree.bbclass | |||
@@ -73,7 +73,7 @@ do_compile:append() { | |||
73 | 73 | ||
74 | for dtbf in ${KERNEL_DEVICETREE}; do | 74 | for dtbf in ${KERNEL_DEVICETREE}; do |
75 | dtb=`normalize_dtb "$dtbf"` | 75 | dtb=`normalize_dtb "$dtbf"` |
76 | oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" ${KERNEL_EXTRA_ARGS} | 76 | oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" STRIP="${KERNEL_STRIP}" ${KERNEL_EXTRA_ARGS} |
77 | done | 77 | done |
78 | } | 78 | } |
79 | 79 | ||
diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass index 108b7e6752..4ac977b122 100644 --- a/meta/classes-recipe/kernel-yocto.bbclass +++ b/meta/classes-recipe/kernel-yocto.bbclass | |||
@@ -455,7 +455,7 @@ do_kernel_configme() { | |||
455 | bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)" | 455 | bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)" |
456 | fi | 456 | fi |
457 | 457 | ||
458 | CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1 | 458 | CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" STRIP="${KERNEL_STRIP}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1 |
459 | if [ $? -ne 0 -o ! -f ${B}/.config ]; then | 459 | if [ $? -ne 0 -o ! -f ${B}/.config ]; then |
460 | bberror "Could not generate a .config for ${KMACHINE}-${LINUX_KERNEL_TYPE}" | 460 | bberror "Could not generate a .config for ${KMACHINE}-${LINUX_KERNEL_TYPE}" |
461 | if [ ${KCONF_AUDIT_LEVEL} -gt 1 ]; then | 461 | if [ ${KCONF_AUDIT_LEVEL} -gt 1 ]; then |
@@ -490,6 +490,7 @@ python do_config_analysis() { | |||
490 | env['LD'] = d.getVar('KERNEL_LD') | 490 | env['LD'] = d.getVar('KERNEL_LD') |
491 | env['CC'] = d.getVar('KERNEL_CC') | 491 | env['CC'] = d.getVar('KERNEL_CC') |
492 | env['OBJCOPY'] = d.getVar('KERNEL_OBJCOPY') | 492 | env['OBJCOPY'] = d.getVar('KERNEL_OBJCOPY') |
493 | env['STRIP'] = d.getVar('KERNEL_STRIP') | ||
493 | env['ARCH'] = d.getVar('ARCH') | 494 | env['ARCH'] = d.getVar('ARCH') |
494 | env['srctree'] = s | 495 | env['srctree'] = s |
495 | 496 | ||
@@ -552,6 +553,7 @@ python do_kernel_configcheck() { | |||
552 | env['LD'] = d.getVar('KERNEL_LD') | 553 | env['LD'] = d.getVar('KERNEL_LD') |
553 | env['CC'] = d.getVar('KERNEL_CC') | 554 | env['CC'] = d.getVar('KERNEL_CC') |
554 | env['OBJCOPY'] = d.getVar('KERNEL_OBJCOPY') | 555 | env['OBJCOPY'] = d.getVar('KERNEL_OBJCOPY') |
556 | env['STRIP'] = d.getVar('KERNEL_STRIP') | ||
555 | env['ARCH'] = d.getVar('ARCH') | 557 | env['ARCH'] = d.getVar('ARCH') |
556 | env['srctree'] = s | 558 | env['srctree'] = s |
557 | 559 | ||
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass index 9c8036f4df..e82b696d1a 100644 --- a/meta/classes-recipe/kernel.bbclass +++ b/meta/classes-recipe/kernel.bbclass | |||
@@ -235,7 +235,7 @@ UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" | |||
235 | # Some Linux kernel configurations need additional parameters on the command line | 235 | # Some Linux kernel configurations need additional parameters on the command line |
236 | KERNEL_EXTRA_ARGS ?= "" | 236 | KERNEL_EXTRA_ARGS ?= "" |
237 | 237 | ||
238 | EXTRA_OEMAKE += ' CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}"' | 238 | EXTRA_OEMAKE += ' CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" STRIP="${KERNEL_STRIP}"' |
239 | EXTRA_OEMAKE += ' HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"' | 239 | EXTRA_OEMAKE += ' HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"' |
240 | EXTRA_OEMAKE += ' HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}"' | 240 | EXTRA_OEMAKE += ' HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}"' |
241 | 241 | ||
@@ -334,6 +334,10 @@ kernel_do_transform_bundled_initramfs() { | |||
334 | } | 334 | } |
335 | do_transform_bundled_initramfs[dirs] = "${B}" | 335 | do_transform_bundled_initramfs[dirs] = "${B}" |
336 | 336 | ||
337 | python do_package:prepend () { | ||
338 | os.environ['STRIP'] = d.getVar('KERNEL_STRIP') | ||
339 | } | ||
340 | |||
337 | python do_devshell:prepend () { | 341 | python do_devshell:prepend () { |
338 | os.environ["LDFLAGS"] = '' | 342 | os.environ["LDFLAGS"] = '' |
339 | } | 343 | } |
diff --git a/meta/classes-recipe/module.bbclass b/meta/classes-recipe/module.bbclass index b3b852be5f..f2f0b25a2d 100644 --- a/meta/classes-recipe/module.bbclass +++ b/meta/classes-recipe/module.bbclass | |||
@@ -20,6 +20,10 @@ python __anonymous () { | |||
20 | d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols)) | 20 | d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols)) |
21 | } | 21 | } |
22 | 22 | ||
23 | python do_package:prepend () { | ||
24 | os.environ['STRIP'] = d.getVar('KERNEL_STRIP') | ||
25 | } | ||
26 | |||
23 | python do_devshell:prepend () { | 27 | python do_devshell:prepend () { |
24 | os.environ['CFLAGS'] = '' | 28 | os.environ['CFLAGS'] = '' |
25 | os.environ['CPPFLAGS'] = '' | 29 | os.environ['CPPFLAGS'] = '' |
@@ -33,6 +37,7 @@ python do_devshell:prepend () { | |||
33 | os.environ['LD'] = d.getVar('KERNEL_LD') | 37 | os.environ['LD'] = d.getVar('KERNEL_LD') |
34 | os.environ['AR'] = d.getVar('KERNEL_AR') | 38 | os.environ['AR'] = d.getVar('KERNEL_AR') |
35 | os.environ['OBJCOPY'] = d.getVar('KERNEL_OBJCOPY') | 39 | os.environ['OBJCOPY'] = d.getVar('KERNEL_OBJCOPY') |
40 | os.environ['STRIP'] = d.getVar('KERNEL_STRIP') | ||
36 | os.environ['O'] = d.getVar('STAGING_KERNEL_BUILDDIR') | 41 | os.environ['O'] = d.getVar('STAGING_KERNEL_BUILDDIR') |
37 | kbuild_extra_symbols = d.getVar('KBUILD_EXTRA_SYMBOLS') | 42 | kbuild_extra_symbols = d.getVar('KBUILD_EXTRA_SYMBOLS') |
38 | if kbuild_extra_symbols: | 43 | if kbuild_extra_symbols: |
@@ -47,6 +52,7 @@ module_do_compile() { | |||
47 | KERNEL_VERSION=${KERNEL_VERSION} \ | 52 | KERNEL_VERSION=${KERNEL_VERSION} \ |
48 | CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ | 53 | CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ |
49 | AR="${KERNEL_AR}" OBJCOPY="${KERNEL_OBJCOPY}" \ | 54 | AR="${KERNEL_AR}" OBJCOPY="${KERNEL_OBJCOPY}" \ |
55 | STRIP="${KERNEL_STRIP}" \ | ||
50 | O=${STAGING_KERNEL_BUILDDIR} \ | 56 | O=${STAGING_KERNEL_BUILDDIR} \ |
51 | KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \ | 57 | KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \ |
52 | ${MAKE_TARGETS} | 58 | ${MAKE_TARGETS} |
@@ -57,6 +63,7 @@ module_do_install() { | |||
57 | oe_runmake DEPMOD=echo MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \ | 63 | oe_runmake DEPMOD=echo MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \ |
58 | INSTALL_FW_PATH="${D}${nonarch_base_libdir}/firmware" \ | 64 | INSTALL_FW_PATH="${D}${nonarch_base_libdir}/firmware" \ |
59 | CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" \ | 65 | CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" \ |
66 | STRIP="${KERNEL_STRIP}" \ | ||
60 | O=${STAGING_KERNEL_BUILDDIR} \ | 67 | O=${STAGING_KERNEL_BUILDDIR} \ |
61 | ${MODULES_INSTALL_TARGET} | 68 | ${MODULES_INSTALL_TARGET} |
62 | 69 | ||