From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA2DC194A44 for ; Mon, 28 Jul 2025 01:14:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753665281; cv=none; b=P57bllMUwdIywvtbiFxxM4eHKH0o3qTEl74Wq+n242VKMA5pfEgghEhlvdFQ0rCUlGqDY6JCad9Gg70SQYq3BhvoBX/chR1h2Ps3nd4VE6UunG09cgRxfMwTGvESO5FBv3Lfk5jL0QBPcZm+OOrx85DKHNQN+VJBwmP6FwaQR44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753665281; c=relaxed/simple; bh=26y1SlZauETLDs+Gpq+VfkyRTGpXBbc/J0PNX8BJgog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QqWHmBZmqXz8Ei2yQs7cgOopw7o4NWqTzgSfQoPJI3YeLujzZRZQO39ItOVIoLBTrOQ+q+8cdDy/pg686XYrcVnPPNedOO+8FABV/513V8e9ox0zoRk1azIBRwk4mlkj5558FULspGxLt6YtiacId6JFJfiIjYjnCuUaUg/RenY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=CBCdlSUD; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="CBCdlSUD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=fwCYPRABlxr+nKCiZBd3v6P1fgWjhW+rEueDkgT/L2A=; b=CBCdlSUDtYM1x4haAR0se/m0Sf mtuOQx/OkXrVvYzO3P28X7N5xQDBe9/RxYrmV1twPoFFiQmxmw9JNe6ibK2HAscA+/22bi0PTFjp/ VyrHtedYQIMYaapgB9f+QwRd8ecxF90bc6h5rfWTTkyotKUlE0aAXkyEEN5ityN5Jufo6NMPabYys eqjon2ARM264abCKZiTyA7BSU+XzPJEzzNTq2XFNuNgEC6xoarPGfZeHL7NrGYZCgRVbfotw0RwgV PbVfG/jg9Bses+hVYF+1OklfAzD3+qtFgu5J6/JhipIr788/qy0H6BpFzSjvwbiGg1vdeD70bNp39 6KTC7RmA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ugCRo-0000000DPlO-2Rsv; Mon, 28 Jul 2025 01:14:36 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Chuck Lever Subject: [PATCH v2 29/33] bootlinux: Add an option to build with clang instead of gcc Date: Sun, 27 Jul 2025 18:14:29 -0700 Message-ID: <20250728011434.3197091-30-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250728011434.3197091-1-mcgrof@kernel.org> References: <20250728011434.3197091-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain From: Chuck Lever Currently, gcc does not implement a Rust front-end. As the kernel acquires Rust source code, the clang tool chain must be used to build it. To enable building test kernels with clang instead of gcc, add a kdevops Kconfig option to install dependences and set the build options to use clang. See: Documentation/kbuild/llvm.rst Signed-off-by: Chuck Lever --- .../roles/bootlinux/tasks/build/builder.yml | 36 +++++++++++++++++++ .../tasks/install-deps/redhat/main.yml | 16 +++++++++ workflows/linux/Kconfig | 20 +++++++++++ 3 files changed, 72 insertions(+) diff --git a/playbooks/roles/bootlinux/tasks/build/builder.yml b/playbooks/roles/bootlinux/tasks/build/builder.yml index c8363b8e..c4c4b950 100644 --- a/playbooks/roles/bootlinux/tasks/build/builder.yml +++ b/playbooks/roles/bootlinux/tasks/build/builder.yml @@ -110,12 +110,35 @@ community.general.make: chdir: "{{ target_linux_dir_path }}" target: "olddefconfig" + when: + - bootlinux_compiler_gcc|bool - name: Build {{ target_linux_tree }} community.general.make: chdir: "{{ target_linux_dir_path }}" jobs: "{{ ansible_processor_nproc }}" target: "all" + when: + - bootlinux_compiler_gcc|bool + +- name: Configure kernel {{ target_linux_tree }} + community.general.make: + chdir: "{{ target_linux_dir_path }}" + params: + LLVM: 1 + target: "olddefconfig" + when: + - bootlinux_compiler_clang|bool + +- name: Build {{ target_linux_tree }} + community.general.make: + chdir: "{{ target_linux_dir_path }}" + jobs: "{{ ansible_processor_nproc }}" + params: + LLVM: 1 + target: "all" + when: + - bootlinux_compiler_clang|bool - name: Remove the old artifacts directory on the control host delegate_to: localhost @@ -192,6 +215,19 @@ target: "binrpm-pkg" params: RPMOPTS: '--without devel' + when: + - bootlinux_compiler_gcc|bool + + - name: Make the binrpm-pkg target + community.general.make: + chdir: "{{ target_linux_dir_path }}" + jobs: "{{ ansible_processor_nproc }}" + target: "binrpm-pkg" + params: + RPMOPTS: '--without devel' + LLVM: 1 + when: + - bootlinux_compiler_clang|bool - name: Find the build artifacts ansible.builtin.find: diff --git a/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml index 0f966d67..dc4a5433 100644 --- a/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml @@ -68,6 +68,22 @@ - btrfs-progs when: ansible_distribution == 'Fedora' +- name: Install clang + become: true + ansible.builtin.dnf: + name: + - clang + - lld + - llvm + state: present + update_cache: true + retries: 3 + delay: 5 + register: clang_result + until: clang_result is succeeded + when: + - bootlinux_compiler_clang|bool + - name: Install rpmbuild become: true become_method: ansible.builtin.sudo diff --git a/workflows/linux/Kconfig b/workflows/linux/Kconfig index 31f57017..06742f3e 100644 --- a/workflows/linux/Kconfig +++ b/workflows/linux/Kconfig @@ -151,6 +151,26 @@ endmenu endif # BOOTLINUX_9P +choice + prompt "Compiler to use to build the kernel" + default BOOTLINUX_COMPILER_GCC + help + Choose which toolchain to use to build the kernel. + +config BOOTLINUX_COMPILER_GCC + bool "gcc" + output yaml + help + Use the gcc compiler toolchain to build the Linux kernel. + +config BOOTLINUX_COMPILER_CLANG + bool "clang" + output yaml + help + Use the clang compiler toolchain to build the Linux kernel. + +endchoice + choice prompt "Type of development version of Linux to use" default BOOTLINUX_LINUS if !BOOTLINUX_TREE_SET_BY_CLI && !BOOTLINUX_TREE_REF_SET_BY_CLI -- 2.47.2