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 541E072622 for ; Mon, 28 Jul 2025 00:18:05 +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=1753661889; cv=none; b=KkbyZTGUl7se/YnaZS0yfvopddT1O3urRCUPET//PhCvypM0iR58P7Vb4ENVfo0MX0tb3WVCN2XMV28GCbmfgvjoJRtxrlRbuKS0XS1sowvTfS+fIcMt5u/A8eU9M6oeiHjKX8nv5zml5vxCUCIXtuYCw5YHwy0Kczqx3B8MuyQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753661889; c=relaxed/simple; bh=26y1SlZauETLDs+Gpq+VfkyRTGpXBbc/J0PNX8BJgog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VmLm6GPIUr0cUXuDfyOsUeeM4hWDIWIqc5AMzlnVoV+eJFXX3I2wQn3kez2RJ2VTwHNtWW6dvjseqgRmim6D1xRqTMt8kefrCtGNpbDsm7DC3yGTXvzVuTmR/FL0QbXxHir9cYwtYUAOuyPML1LiOBhPxkB94AOEaRjPSY3byeY= 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=fFcclYpO; 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="fFcclYpO" 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=fFcclYpOL9xVJb6RNbI/jO2+7x CyrYhMhVxvXifRfy56F5CPQVb/Ria7BKc9jsGiuwHHzxj/C9EccMzlaqAAFIe3ysJwIgxQlhbrrKA bvDIWPMUnE/la4DToq4gcOx2tcVPwFoMjTH9o1DfoGHiL4JdjNJ3GY+p44sA/oaaK1yvXNEnS4Q6R HxbF2OVdWIvy/iusRzDCaVknhLWCo2flk9JPy2yBo3zUYfR47Afk6kMRH+Iyo9SSA0OLflTTC9r6o dfWtPt5Ozxcx3Ib/2X66aK71+YO/L0VnAVWtpkPYpi3Kg3XJxkTaQTkfT4o5O8W5Ioqdls4ZNALRx A3EvF7SA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ugBZ5-0000000DNYl-2M93; Mon, 28 Jul 2025 00:18:03 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Chuck Lever Subject: [PATCH 36/40] bootlinux: Add an option to build with clang instead of gcc Date: Sun, 27 Jul 2025 17:17:55 -0700 Message-ID: <20250728001800.3188617-37-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250728001800.3188617-1-mcgrof@kernel.org> References: <20250728001800.3188617-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