]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
kernel-arch: Move ARCH usage into target classes
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 1 Aug 2026 12:51:16 +0000 (13:51 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 3 Aug 2026 17:04:08 +0000 (18:04 +0100)
Since ARCH is just a function now we can move it into the target class usages
and drop it from the default environment. We still have to export in some
cases where the usage is unknown but this does significatly reduce the
scope and number of places exported to.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/devicetree.bbclass
meta/classes-recipe/kernel-arch.bbclass
meta/classes-recipe/kernel.bbclass
meta/classes-recipe/module-base.bbclass
meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
meta/recipes-kernel/perf/perf.bb

index ce9d008aac1d92c67605c67f1248cae99f44391e..4fe389bed83207a55bb7aa83a5c64caa2e6c5757 100644 (file)
@@ -29,7 +29,9 @@ LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171
 INHIBIT_DEFAULT_DEPS = "1"
 DEPENDS += "dtc-native"
 
-inherit deploy kernel-arch
+inherit deploy
+
+export ARCH = "${@oe.kernel.map_kernel_arch(d)}"
 
 COMPATIBLE_MACHINE ?= "^$"
 
index db708c35104f6285b784e57fd245e19521dc62fe..eb598d98b6ef8603d0c4fddcc9af522a8fa8312d 100644 (file)
@@ -4,11 +4,6 @@
 # SPDX-License-Identifier: MIT
 #
 
-# set the ARCH environment variable for kernel compilation (including
-# modules). return value must match one of the architecture directories
-# in the kernel source "arch" directory
-export ARCH = "${@oe.kernel.map_kernel_arch(d)}"
-
 # Set TARGET_??_KERNEL_ARCH in the machine .conf to set architecture
 # specific options necessary for building the kernel and modules.
 TARGET_CC_KERNEL_ARCH ?= ""
index aeaec8ccbd461d0590bd4e5d8a56f0d1fe9c0337..28460ce1cb9534da3b3934fac187741f22eca6f9 100644 (file)
@@ -6,6 +6,8 @@
 
 inherit linux-kernel-base kernel-module-split features_check
 
+ARCH = "${@oe.kernel.map_kernel_arch(d)}"
+
 COMPATIBLE_HOST = ".*-linux"
 
 # Linux has a minimum ISA requires on riscv, see arch/riscv/Makefile
@@ -245,6 +247,7 @@ UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
 # Some Linux kernel configurations need additional parameters on the command line
 KERNEL_EXTRA_ARGS ?= ""
 
+EXTRA_OEMAKE += ' ARCH="${@oe.kernel.map_kernel_arch(d)}"'
 EXTRA_OEMAKE += ' CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" STRIP="${KERNEL_STRIP}"'
 EXTRA_OEMAKE += ' HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"'
 EXTRA_OEMAKE += ' HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}"'
index 2a225881ba4f52f8f36086365584e0cb2209d975..d52de45f4a51adbf87e33c5f6cc297f1d84635b3 100644 (file)
@@ -10,6 +10,7 @@ inherit kernel-arch
 # in sstate, so we must force do_compile to run (once).
 do_configure[depends] += "make-mod-scripts:do_compile"
 
+export ARCH = "${@oe.kernel.map_kernel_arch(d)}"
 export OS = "${TARGET_OS}"
 export CROSS_COMPILE = "${TARGET_PREFIX}"
 
index ab984f4bcfead6c6963023d01e3deb79e84d8e0a..6e64918f5b5c1f063bf560b50c57950cbc3bdb28 100644 (file)
@@ -21,7 +21,8 @@ DEPENDS += "gmp-native"
 INHIBIT_DEFAULT_DEPS = "1"
 DEPENDS += "virtual/cross-cc virtual/cross-binutils"
 
-EXTRA_OEMAKE = " HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}""
+EXTRA_OEMAKE = ' ARCH="${@oe.kernel.map_kernel_arch(d)}"'
+EXTRA_OEMAKE += " HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}""
 EXTRA_OEMAKE += " HOSTCXX="${BUILD_CXX} ${BUILD_CXXFLAGS} ${BUILD_LDFLAGS}" CROSS_COMPILE=${TARGET_PREFIX}"
 
 KERNEL_LOCALVERSION = "${@oe.kernel.get_localversion_file("${STAGING_KERNEL_BUILDDIR}")}"
index e3e5d55e3965b8b7f6bfd875fb89674af08f622f..5fa98a0d94bc41b7a80021544e5e4c7a4d533c6a 100644 (file)
@@ -58,6 +58,8 @@ PROVIDES = "virtual/perf"
 
 inherit linux-kernel-base kernel-arch manpages pkgconfig
 
+ARCH = "${@oe.kernel.map_kernel_arch(d)}"
+
 # needed for building the tools/perf Python bindings
 inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)}
 inherit python3-dir