From patchwork Tue Nov 4 17:16:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: El Mehdi YOUNES X-Patchwork-Id: 73609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45285CCFA16 for ; Tue, 4 Nov 2025 17:16:03 +0000 (UTC) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.1232.1762276557051813149 for ; Tue, 04 Nov 2025 09:15:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@smile.fr header.s=google header.b=TG3frer1; spf=pass (domain: smile.fr, ip: 209.85.167.42, mailfrom: elmehdi.younes@smile.fr) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-59390875930so6962594e87.1 for ; Tue, 04 Nov 2025 09:15:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile.fr; s=google; t=1762276555; x=1762881355; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wGYCvnfqL3/5mz6X8yBtl7bQgQBCg98RdvWgfl2eTa8=; b=TG3frer1wMFwqKUozS/7pyPp2Kb+8PPjOvHAn8tsm37bb8IKvXoLSMyeGVt15+ceCZ uKDMD0I7paiUfpLLQpeoyLkw3KE2+ucbAvlZzYw+9DGx3HrWfiGP+3vcEpkYd8EM3dI3 CpIhG3mtvIFj7Hjpz5Lw2+6S379lmYDNbkSDQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762276555; x=1762881355; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wGYCvnfqL3/5mz6X8yBtl7bQgQBCg98RdvWgfl2eTa8=; b=SB+zTlPP8M8PYddk5t/ulfRMqGts2kpHPC9I5K+ybpD4YyXY+cvFlL0vbFX6hff9HO 9/oolB/2ChjU99Z48jgm1IFpJ1jDLqludWFdxC7gghTWhKypXP/zw65XFH9gTIPWGoZn /KDRr9esVlUMu4rSxBNdwl+I2osDE62JwSaCH4EZ8jp7VfvGXprDc2p9LQmlLOfmW0bN T9TAuiYRPLK5Zh7GgzH+hIMx1dBoQ9mVZ+n4IPeCaSBXQ/Poo6oQ03CnbvTTlRHwTiwf 8UDdiFkw8+6eYAerxQgs0C3TEes4SOpSECzzOfye2iNu2X8tf4UjIz42xlxUl9+ddPRX q2JQ== X-Gm-Message-State: AOJu0YzmWq+r8smnxswY3xSljUGGApZ9By4BpfP3NqIYPdcXp3Wcx3iD r7z10lfZwM9qVS9dDtYWB6tEUZRXM33CE5OfdOORNvlkWR0Pb8reuxJYJ+6QE9PiUB7RQHu46m1 2OgTl4sw= X-Gm-Gg: ASbGncvZD+PHhuoaPqLJ3mMeniCNBX4FfGMGVNrTOfuYRkwsUlLbS7VyE9PKSz4w9BA ewaU9XFqpNlM5I3ovxysi952Pvfqs/ySMVT2FMAct7HtB8czrB+nj4CLvdEyJ45Cq2PwiqDG39H AEQWfUy9uGM8zo6NyObzNlDJLI7VVfMLOYhLCqv9Hr1WHt0KUWdEud7oNifefr6V75cwHGNkEFN MnhjS1tCaKz6ZkeLq9UF2+1+FRlZDjGe00550fjQy8CWGwmGOvzRnEehgdyK6h8ngwhTxVJMdGK 4EdmM4rvli41D8GfFPqjRgZAAJg4eK+WYQpeMKxDZpd+SfaMHMus2z5g+2NThGP3JygF0Y1xJeT BTuiqzoaGVB8so0Xo7vDHwBlPcL4uCVHG+HqnNUAsMoHHyu4ebN5OQv51Ydk42RMLsWt+zzR/SS EyaJ6rypn2jTLnNFekghF3/jKEEwW2o6Sl3unZYYnDvxQ3M5r4JMiNvTWrnKplxecSvoB5ug== X-Google-Smtp-Source: AGHT+IHxeh69d/c4q7PrO2cZ74M6d4288iH4edSvfnZHMiJlhyltZ9BbKAal9GI+jaYd3GxcpDgvgA== X-Received: by 2002:a05:6512:2389:b0:594:2827:1932 with SMTP id 2adb3069b0e04-59428271972mr3298633e87.32.1762276554729; Tue, 04 Nov 2025 09:15:54 -0800 (PST) Received: from FRSMI25-BOLET.. (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5943437efd1sm914407e87.4.2025.11.04.09.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Nov 2025 09:15:53 -0800 (PST) From: El Mehdi YOUNES To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr, El Mehdi YOUNES Subject: [RFC PATCH 1/4] kernel-yocto.bbclass: Add integrated support for Rust-for-Linux Date: Tue, 4 Nov 2025 18:16:08 +0100 Message-ID: <20251104171611.2227798-2-elmehdi.younes@smile.fr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251104171611.2227798-1-elmehdi.younes@smile.fr> References: <20251104171611.2227798-1-elmehdi.younes@smile.fr> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 04 Nov 2025 17:16:03 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/225737 This change introduces a comprehensive solution to build Rust-enabled kernels cleanly, controlled by a new DISTRO_FEATURE named 'rust-kernel'. When this feature is enabled, the class performs the following actions: 1. Appends the necessary native toolchain dependencies (rust-native, bindgen-native, etc.) to the kernel recipe's DEPENDS. 2. Implements a solution for reproducible builds to fix the [buildpaths] QA failures. To solve this, the rustc flag --remap-path-prefix is used. This flag instructs the compiler to replace build-specific path prefixes with generic ones in all output, including debug metadata. The official documentation for this flag is here: https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html To apply this flag cleanly, the rust-common class is inherited to use its RUST_DEBUG_REMAP variable. This commit extends RUST_DEBUG_REMAP with the specific paths for the kernel source (${S}), the build directory (${B}), and the native sysroot (${STAGING_DIR_NATIVE}). The resulting flags are then passed to the kernel's Makefile via the KRUSTFLAGS variable. Signed-off-by: El Mehdi YOUNES --- meta/classes-recipe/kernel-yocto.bbclass | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass index e53bf15194..e722a7a81d 100644 --- a/meta/classes-recipe/kernel-yocto.bbclass +++ b/meta/classes-recipe/kernel-yocto.bbclass @@ -463,6 +463,7 @@ do_kernel_configme[depends] += "virtual/cross-binutils:do_populate_sysroot" do_kernel_configme[depends] += "virtual/cross-cc:do_populate_sysroot" do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot" do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot" +do_kernel_configme[depends] += "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' rust-native:do_populate_sysroot clang-native:do_populate_sysroot bindgen-cli-native:do_populate_sysroot', '', d)}" do_kernel_configme[dirs] += "${S} ${B}" do_kernel_configme() { do_kernel_metadata config @@ -491,6 +492,16 @@ do_kernel_configme() { bberror "${configs}" bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)" fi + # Run the kernel's 'make rustavailable' check. + # This is a critical step for getting a clear error message. + # Without this check, if the Rust toolchain is incomplete + # (e.g., missing sources), Kbuild just silently disables + # CONFIG_RUST=y. The build would then succeed *without* Rust + # support, which is very difficult to debug. + # This command forces an explicit failure if the toolchain is not ready. + if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then + oe_runmake -C ${S} O=${B} rustavailable + fi 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 if [ $? -ne 0 -o ! -f ${B}/.config ]; then @@ -776,3 +787,11 @@ python () { addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile addtask validate_branches before do_patch after do_kernel_checkout addtask kernel_configcheck after do_configure before do_compile + +INHERIT:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' rust-common', '', d)}" +KERNEL_EXTRA_DEPENDS_RUST = "rust-native cargo-native clang-native llvm-native bindgen-cli-native" +DEPENDS:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' ${KERNEL_EXTRA_DEPENDS_RUST}', '', d)}" +RUST_KERNEL_OEMAKE_VARS = "KRUSTFLAGS=\"${RUST_DEBUG_REMAP}\"" +EXTRA_OEMAKE:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' ${RUST_KERNEL_OEMAKE_VARS}', '', d)}" +RUST_DEBUG_REMAP:append = "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' --remap-path-prefix=${S}=${TARGET_DBGSRC_DIR}/kernel --remap-path-prefix=${STAGING_DIR_NATIVE}=${TARGET_DBGSRC_DIR}/rustc --remap-path-prefix=${B}=${TARGET_DBGSRC_DIR}/build', '', d)}" + From patchwork Tue Nov 4 17:16:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: El Mehdi YOUNES X-Patchwork-Id: 73608 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C265CCFA04 for ; Tue, 4 Nov 2025 17:16:03 +0000 (UTC) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.1226.1762276558360808563 for ; Tue, 04 Nov 2025 09:15:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@smile.fr header.s=google header.b=K2mV+uVa; spf=pass (domain: smile.fr, ip: 209.85.167.41, mailfrom: elmehdi.younes@smile.fr) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-59310014b8eso5627000e87.3 for ; Tue, 04 Nov 2025 09:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile.fr; s=google; t=1762276556; x=1762881356; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=es/QSD8s3G7OHbdYf8KfSIjM/G23suOPEdBsro6e8Wo=; b=K2mV+uVa2H0BQCd9E18Sls3WONnL33ucmJg6rhgTvX86wCfetPWYmvRskDPmRavAtQ i9grvR1+5QLVR4yD6ugSivCo/a8YG/JcpgTtRFsGO+eBpr9DuBvGkWoJYmH4Rhnv6q8I NT5kuMqd1dGRwk3miOclPRyA3reSVlwdui34E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762276556; x=1762881356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=es/QSD8s3G7OHbdYf8KfSIjM/G23suOPEdBsro6e8Wo=; b=PoiuneKpVIuFrVrvyD4RbBcXIvcGqVzbEV7uj3gce6eA2Ar062f5LdWmxw6X+6wNfZ dSRQdwaO/3mu8jpwf6Ba0Bi3alVs5pGSBhH9CIyGBpTUwEIdyipnZojyGbxlGbsUzXPw 3NqZVIuhbZZH8sw6V7SNTlLd1OcrMQ4MsEcKrPOjgn8BiryBdzueek7dMWJv4/ONO1HG tiVWkhK7a8Fno5p/hDJOND+qiwIwARA5oOMsnVHfKFDOa0o1cN81cG/arVnS/Wq/nRtH NPcOZl8qdb3Id0BT0RHI+IwpTBJ681ypJF5LH69F8cQ1seWwowRcl2BhHasr/18dh5jK iLgg== X-Gm-Message-State: AOJu0YxZy8XwwAEDqzWbf3SJwPaMbdjSMi7w8zMONQmSjcnOQr/Bzxik UvOAaPUNqkMY/Eri/tcUARhBy0d6BMo6PXYC4CIEX3xC34jnbNErrSlS9rtBbcXTywDFQ83h5Vg 6VacN664= X-Gm-Gg: ASbGncsZnBUslbfYJI+Whw3AzDVgPRG7DPKh39whS1eH5Zo6dIejJJ5YHd1CpufFGMa /NLQe6bkExboU4RHyVmdG1aydxOjZByP7cWSgCk29DfP17/OcxMl5RVuWJHaG52I5TbC5LDiFQw hKdChPURz/fk7hrhhZZsK5VZMM/7mzG1GNGccG2uMV2g6oPEvP94XbJvGqC8m3GVe2JM1/0sIB8 BorSL1vvJoYSPVN38/DHOHTn6Ahm64O0YX+6P91ci43vDVAH5ogdfzE7tSHUzL/0d3cMcE2zw5q 5MQJ3ZYgxMq83EG6rociRVyBM3pYLgWzgSI/ExF7E0LHI7pgrropeiLYir7267eRACD+8c1SnU5 yNlHVF1D1dn6VrlLmuzYVS+Lm9tdFH7VyjpJkf8RoZjfrZoKA1xTOANtULI1bp+iY0vlgg+Yrej yBTNlc6e2ZDvfHH5RpFB+fux8de8NokLc9QYLQ8DG0A5C47x4zr5WTYHprKXWdiCXg+tgFyA== X-Google-Smtp-Source: AGHT+IERbiDCYTPkpQ8UbMsLr3lN47EEz46FIo2j+5XXwEUZCtG3NnzpaWOsWGjf2kEhvyJOYAhL6w== X-Received: by 2002:a05:6512:3e1a:b0:594:2710:d719 with SMTP id 2adb3069b0e04-5942710d75amr3484424e87.41.1762276556071; Tue, 04 Nov 2025 09:15:56 -0800 (PST) Received: from FRSMI25-BOLET.. (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5943437efd1sm914407e87.4.2025.11.04.09.15.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Nov 2025 09:15:55 -0800 (PST) From: El Mehdi YOUNES To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr, El Mehdi YOUNES Subject: [RFC PATCH 2/4] linux-yocto.inc: Conditionally add rust.scc kernel feature Date: Tue, 4 Nov 2025 18:16:09 +0100 Message-ID: <20251104171611.2227798-3-elmehdi.younes@smile.fr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251104171611.2227798-1-elmehdi.younes@smile.fr> References: <20251104171611.2227798-1-elmehdi.younes@smile.fr> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 04 Nov 2025 17:16:03 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/225738 This adds the mechanism to enable the Rust for Linux kernel feature via a DISTRO_FEATURE. When 'rust-kernel' is present in DISTRO_FEATURES, the 'rust.scc' kernel feature is appended to the KERNEL_FEATURES list. Signed-off-by: El Mehdi YOUNES --- meta/recipes-kernel/linux/linux-yocto.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc index 4d0a726bb6..40e5bf214b 100644 --- a/meta/recipes-kernel/linux/linux-yocto.inc +++ b/meta/recipes-kernel/linux/linux-yocto.inc @@ -95,3 +95,7 @@ do_devshell:prepend() { d.setVarFlag("PKG_CONFIG_SYSROOT_DIR", "unexport", "1") d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_DIR PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR") } + +KERNEL_FEATURES:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' rust.scc', '', d)}" +# TODO: Kernel rust code compilation breaks under ccache, disable it for now +CCACHE_DISABLE = "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', '1', '', d)}" From patchwork Tue Nov 4 17:16:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: El Mehdi YOUNES X-Patchwork-Id: 73606 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31161CCF9E3 for ; Tue, 4 Nov 2025 17:16:03 +0000 (UTC) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.1227.1762276559648402681 for ; Tue, 04 Nov 2025 09:16:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@smile.fr header.s=google header.b=U+XGwewk; spf=pass (domain: smile.fr, ip: 209.85.167.47, mailfrom: elmehdi.younes@smile.fr) Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-59435d82c1fso872424e87.2 for ; Tue, 04 Nov 2025 09:15:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile.fr; s=google; t=1762276557; x=1762881357; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bpNk9RbexuHpGVayc9U01Igp96Entj+/CrEHSg3yAcA=; b=U+XGwewkrNTpx3IvdytVi0206yi1oIdrGO7f+k4ZKtGJ272Jpbdk4ggkd3/jWrrFGC krr+oDQAgLYI41xeAqeG4tXzSDGlAr8to8CX3z7fLozZTRIkRVUwtlROsWPEmtx+SjOI p6bpIUBD3FKdz6X9dF66udV/03q07SSVm6Th4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762276557; x=1762881357; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bpNk9RbexuHpGVayc9U01Igp96Entj+/CrEHSg3yAcA=; b=PnzTyI2EaIBMAQbM1yVx6wP3qiRV1E9FDzFRW8DcIvVmWwo/x57aFmdFKRsn7avmKy 9bcLbYNmYSCxnNfGPoOkK+GduEaL+2Xpr3nREN3P7G2E/h94guASTiMUD2nHVTKHjepE XpCOp5x7UhXQYDCREYxOw37JzoQXvLOTPp0cs6nD2vOl0/HqEQvKRqJhKkRxRbc87O8c xvUZwq8hMUp7Wi2RE0x9hEiSRsOry5IZDAks63eilJ6of0TlsCmPuk+HhOJL0mLdqmkw 7RvGIOByFR//khJYeXvFQHVXz6vAfqjVZWQLfmLfBsM0zm6WSkEw0hbXbjKJEUvHKjkU 9IaQ== X-Gm-Message-State: AOJu0Yzuc9CjMXwveryKXrK8gigZrRgx1O2csf8pjn+iaQR+b5qi5fnp dMRDg8fU3Aln29QxYAtEbLuxtr+Fpk0JD5Lkfc9jB6M0RZcAR12fsBAuHU+WMOvE8ipXf4z2qWP dIHMuFCw= X-Gm-Gg: ASbGncsPPdUK4Qp8k7rirHBipmxHmEpuJJkq5pdIB13qUyuD1DsZSL74Fgj0LiWxwMH kXnaoW01gvkyWyAQc1ntOWckRyiGk4oc04b712axL4t1xoHh2zC3e+bEm2mfoOjLQHC2YfkQPK1 Eojqe3DF1hQD35CxzeIztcBqhLDw8tiwlSsYMW/fU59+kNMmtITOgOkFfGZ2oOrO2lc1/Q5OdOH hs7Ch+4kYxm1Y0/d58zzcq1RwNkED5hWSQ+nm7CsYZvqMIqOgKflKfzl/fJwoEBZzpTDg5Ih7md NzUTKlCs3drVX004puKwp6x9PnTC7vtkhs6CP5W1Al1F8x0Vhb2LvUmObKmbl/7IkWEMtQMSlE9 sTkIRab/LrAQlfrlzaLnxJbz+PN8uAH/HhYHvD9JtT5xhdhoc0S7P16L1LaVcM51COdMvZmFB/J Icj3k2EeXrLu95zH3KSKBnKis8Dcfv0X5Yjs+2vpC/5qfFoAfH8szpaiNfPDOzMhQbd5ulEw== X-Google-Smtp-Source: AGHT+IERsulMTSAhRjCyopODi3yH/7pEWBCClHL3T2YY/7iH+/Ol7thxbhsIT735ihhsvvLz0+uSpg== X-Received: by 2002:a05:6512:68f:b0:594:2f72:2f6b with SMTP id 2adb3069b0e04-5942f7233famr2237598e87.10.1762276557393; Tue, 04 Nov 2025 09:15:57 -0800 (PST) Received: from FRSMI25-BOLET.. (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5943437efd1sm914407e87.4.2025.11.04.09.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Nov 2025 09:15:57 -0800 (PST) From: El Mehdi YOUNES To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr, El Mehdi YOUNES Subject: [RFC PATCH 3/4] rust-native: Conditionally install sources for kernel builds Date: Tue, 4 Nov 2025 18:16:10 +0100 Message-ID: <20251104171611.2227798-4-elmehdi.younes@smile.fr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251104171611.2227798-1-elmehdi.younes@smile.fr> References: <20251104171611.2227798-1-elmehdi.younes@smile.fr> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 04 Nov 2025 17:16:03 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/225739 The Linux kernel build, when Rust is enabled, requires the Rust standard library sources (core, alloc, etc.) to be present in the rust-native toolchain. Without these sources, the 'make rustavailable' check fails, and Rust support cannot be enabled. This patch adds the logic to install these sources. The action is gated by the 'rust-kernel' DISTRO_FEATURES flag. NOTE: For this conditional logic, the native build environment must be made aware of the 'rust-kernel' feature. Therefore, 'DISTRO_FEATURES_FILTER_NATIVE' (defined in meta/conf/bitbake.conf) must be modified (e.g., in local.conf) to include 'rust-kernel'. Signed-off-by: El Mehdi YOUNES --- meta/recipes-devtools/rust/rust_1.90.0.bb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/meta/recipes-devtools/rust/rust_1.90.0.bb b/meta/recipes-devtools/rust/rust_1.90.0.bb index 0319d73b93..e3d68e6d93 100644 --- a/meta/recipes-devtools/rust/rust_1.90.0.bb +++ b/meta/recipes-devtools/rust/rust_1.90.0.bb @@ -425,3 +425,11 @@ RUSTLIB_DEP:class-nativesdk = "" INSANE_SKIP:${PN} = "staticdev" BBCLASSEXTEND = "native nativesdk" + +do_install:append:class-native() { + if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then + install -d ${D}${libdir}/rustlib/src/rust + cp -r ${S}/library/ ${D}${libdir}/rustlib/src/rust/ + fi +} +FILES:${PN}:append:class-native = " ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' ${libdir}/rustlib/src/rust', '', d)}" From patchwork Tue Nov 4 17:16:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: El Mehdi YOUNES X-Patchwork-Id: 73607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CBF3CCFA07 for ; Tue, 4 Nov 2025 17:16:03 +0000 (UTC) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.1230.1762276560969860103 for ; Tue, 04 Nov 2025 09:16:01 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@smile.fr header.s=google header.b=uIn/Yw5m; spf=pass (domain: smile.fr, ip: 209.85.167.50, mailfrom: elmehdi.younes@smile.fr) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-594259bc5f1so2413543e87.2 for ; Tue, 04 Nov 2025 09:16:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile.fr; s=google; t=1762276559; x=1762881359; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gS9cD8GBDsYyZvtRv7+aVvW+0U8dFSuywLsNQEP5FZ4=; b=uIn/Yw5mBEoAuCF+o7F5oeBxjdkSaAGg31RoNjftsKEklkjIsWZrXO0EyvbanKjv0j /uqVsmS7ltUk+FiFqG5DB7BHb5yt8G2mhmlZbPx28iXWEWpgJbeCloOmzb+tDRjJNhVZ TaFJuATAGGiWB+Kad1B7mLlZs79+RrYb8bUsM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762276559; x=1762881359; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gS9cD8GBDsYyZvtRv7+aVvW+0U8dFSuywLsNQEP5FZ4=; b=AW/0rWHi6ndDm4k28ZiuhWoM7NwvVyibvno7o8N3QqFaZ5QuAsK+dGMVH96tkPzdCP ZYp+d21OoDBDr6m1tvp/3K6NDSXrH7ShE5nIp/1FhINhdEeiM1iDmim3KlXQ2UjktgXf jXLGt6x7b1NfjSMypWIPesDRFY2YgbfUv9GUk0LvSeC6uUL+MXl9yHHbUSdny9tqqtpb pzKptp8HIJkPyltgC7n8jE0AgduzxJGBICeyVrR7Egd7ZjMGPHbr9rwGumQdFmwxqd4m dZXK+lGjDqcJUhkZ+99IkTDjGw28s1PI1yonK13/uImdsFop/d6fHaiJAo+cvl5mgMG2 oq2g== X-Gm-Message-State: AOJu0YxEoOr8ZtV50DZz5YvEeQeX7rqWylDj2uOO5RTOBnt4N+L8Hetn j9K1P3k+4FNr9B+1QldRMyULhz+tgHR7ZkQa7W0gwQk8q+QPPPDpOhc09NhqFsfgnQRw+wQfWmy PoL7lsJc= X-Gm-Gg: ASbGnctW7jBPVe8/MFR5fymOMVexepCsk5ai7xjYzD/EkMbMvMgXxWuCDMWbXSbHa1Z EI9Hn0fZ9dpvbTtTdQyYfnM4wblCG7Ps1DrLpKlaWteJtZA9fTNCmKWnnKnIB5ZmKZb4CHms57V Xd2/egCH7RUjqnR8rmDWI3Db0oYMIxkVb4mepV8JJLWgxAMFplS7o1HD08w7gzBLiS9sdTVM2zS oL+fISAJDd4VeNSe4NfbPnIP0rC1CnFVcwH28oIMnCV0KOCfGnbPnpwAmIMNrxI9pnFS/zM7VFq qzLBFDExu2+KW/p2WueQX7nrCP8gLHiRCLBkveK6VkIKNgVrJYdhZVOaCtT//HzPqpq8zEwGsDb SOwgnLOrlUQCv64m/2RIJqCQ42OZRQsbOTKCKfLzcG6Dy7LoTJXnzSp9AbQq371bUX1f1i7z1aG xKAUQAA3y4DkzrYwhbnnJV1KGYYuzyeaWf++7IMGRT7w1s+sb2cWIvAA6NuGtawr7usx5EFg== X-Google-Smtp-Source: AGHT+IFdvyF7jwICkXjVztTDdMonkZzEGTlNOqyJnX2XigoEimklL16SghpVxFdzlxrFKquUrPHFsQ== X-Received: by 2002:a05:6512:110e:b0:594:2837:90f0 with SMTP id 2adb3069b0e04-59428379127mr2387495e87.27.1762276558702; Tue, 04 Nov 2025 09:15:58 -0800 (PST) Received: from FRSMI25-BOLET.. (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5943437efd1sm914407e87.4.2025.11.04.09.15.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Nov 2025 09:15:58 -0800 (PST) From: El Mehdi YOUNES To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr, El Mehdi YOUNES Subject: [RFC PATCH 4/4] linux-yocto-dev: Add temporary Rust kernel feature Date: Tue, 4 Nov 2025 18:16:11 +0100 Message-ID: <20251104171611.2227798-5-elmehdi.younes@smile.fr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251104171611.2227798-1-elmehdi.younes@smile.fr> References: <20251104171611.2227798-1-elmehdi.younes@smile.fr> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 04 Nov 2025 17:16:03 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/225740 This commit introduces the 'rust.scc' and 'rust.cfg' files, adding them to the 'SRC_URI' of the 'linux-yocto-dev'. Ideally, these kernel feature files belong in the separate 'yocto-kernel-cache' repository. However, for the purpose of this RFC series,they are being added directly to 'meta/recipes-kernel/linux/files/' to allow the entire feature set to be tested and reviewed in a single repository. Once this approach is discussed and approved, these files will be removed and submitted as a separate patch to the 'yocto-kernel-cache' project. Signed-off-by: El Mehdi YOUNES --- meta/recipes-kernel/linux/files/rust.cfg | 6 ++++++ meta/recipes-kernel/linux/files/rust.scc | 2 ++ meta/recipes-kernel/linux/linux-yocto-dev.bb | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 meta/recipes-kernel/linux/files/rust.cfg create mode 100644 meta/recipes-kernel/linux/files/rust.scc diff --git a/meta/recipes-kernel/linux/files/rust.cfg b/meta/recipes-kernel/linux/files/rust.cfg new file mode 100644 index 0000000000..dc31c9efbc --- /dev/null +++ b/meta/recipes-kernel/linux/files/rust.cfg @@ -0,0 +1,6 @@ +CONFIG_RUST=y +# --- RFC TEST ONLY - REMOVE FOR FINAL PATCH --- +# Enabled samples to validate the Rust build. +# Users should enable these via their own config fragments. +CONFIG_SAMPLES_RUST=y +CONFIG_SAMPLE_RUST_MINIMAL=m diff --git a/meta/recipes-kernel/linux/files/rust.scc b/meta/recipes-kernel/linux/files/rust.scc new file mode 100644 index 0000000000..8b81971be2 --- /dev/null +++ b/meta/recipes-kernel/linux/files/rust.scc @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: MIT +kconf non-hardware rust.cfg diff --git a/meta/recipes-kernel/linux/linux-yocto-dev.bb b/meta/recipes-kernel/linux/linux-yocto-dev.bb index fb4e0864d2..a1c9940219 100644 --- a/meta/recipes-kernel/linux/linux-yocto-dev.bb +++ b/meta/recipes-kernel/linux/linux-yocto-dev.bb @@ -59,3 +59,5 @@ KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " fe KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/gpio/mockup.scc features/gpio/sim.scc", "", d)}" KERNEL_VERSION_SANITY_SKIP = "1" + +SRC_URI += "file://rust.scc"