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 465B23398B for ; Mon, 28 Jul 2025 00:18:03 +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=1753661888; cv=none; b=R+wp3G5OUheUpg0pNjbnoeLBKN9exz/W3vwh+U3x98FIdUJhm+vzW08ctCAB5ziO68Ucs/JcF8PS00DDxJMGGiErWP4kvlhHNmwLsGuBys7nkW03vboZ2ddY6zm4TSZeWx6rOGpeNGFwaoQ8BGEdOz9Dd4fDe1UVaxHlMNPYRJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753661888; c=relaxed/simple; bh=Z+HdX4qe0/YxmxDTa0Hzdcm/QqQhwgd6FpK9sSRz80s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pm35BcomDamD2O9XXtIVr0D7Hv1T+do8GpNQYVt3IT15+SDuqThaljt3yU42AGsQL71qWFKiijvk3umw5q+4SUW0nDKifpXzAd6wfI7qmbxrzuZqpYou7egYFc0FQn1tYELGjqmuLAB+7oc/jYQYzyucmK+dJQlppHnvfnX4EZE= 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=gDS75Por; 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="gDS75Por" 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=c6CubB7vYe+IqYX72CgHIWtxiqjHI2C1NChu8OMbM+M=; b=gDS75PoresLHDieT2q1Si2lc90 RwTMb2FWdDZbiRLAT2ZzYuqZdBH83wxkWxaXVK1DxYrooZ1kPuHm3MLx7dLjGLB0eK60z320K9CsP iEOmzFcSyrFxpwuv2NqsKJNcRGexIuhJsvXugrZW309SrLhFmMUYxe5jTEsPs53zRQoNJasznXzGx fdwsAFMDNoZioXWXfeC6t6TSH/hVaQonPZC6Dzu347LTdneR/F7PjfVxDKBd2wd7Aei9/SZEMtAm4 fNsp+XRFezNjx5P1bNSi/s2OluhxfPD2OulDffMwQwVC2Qk+dTaex583V6XrNjr31WC03YQOXsQca jre+IEbA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ugBZ4-0000000DNWe-2hJV; Mon, 28 Jul 2025 00:18:02 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Chuck Lever Subject: [PATCH 22/40] bootlinux: Move 9p build tasks to a subrole Date: Sun, 27 Jul 2025 17:17:41 -0700 Message-ID: <20250728001800.3188617-23-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 Most everything that is marked with "when: bootlinux_9p|bool" is moved to a separate .yml file and then dynamically included when bootlinux_9p is true. This makes it easy to identify 9p-specific tasks and ensures they are completely disabled and skipped when other build modes are in use. Signed-off-by: Chuck Lever --- playbooks/roles/bootlinux/defaults/main.yml | 6 - playbooks/roles/bootlinux/tasks/build/9p.yml | 205 +++++++++++++++++ playbooks/roles/bootlinux/tasks/main.yml | 228 +------------------ 3 files changed, 209 insertions(+), 230 deletions(-) create mode 100644 playbooks/roles/bootlinux/tasks/build/9p.yml diff --git a/playbooks/roles/bootlinux/defaults/main.yml b/playbooks/roles/bootlinux/defaults/main.yml index 614f7cd8..4a1ad72e 100644 --- a/playbooks/roles/bootlinux/defaults/main.yml +++ b/playbooks/roles/bootlinux/defaults/main.yml @@ -41,12 +41,6 @@ uninstall_kernel_enable: False bootlinux_b4_am_this_host: False bootlinux_9p: False -bootlinux_9p_host_path: "/dev/null" -bootlinux_9p_msize: 0 -bootlinux_9p_fsdev: "ignore" -bootlinux_9p_mount_tag: "ignore" -bootlinux_9p_security_model: "none" -bootlinux_9p_driver: "virtio-9p-pci" kdevops_workflow_enable_cxl: False diff --git a/playbooks/roles/bootlinux/tasks/build/9p.yml b/playbooks/roles/bootlinux/tasks/build/9p.yml new file mode 100644 index 00000000..bc2a66b6 --- /dev/null +++ b/playbooks/roles/bootlinux/tasks/build/9p.yml @@ -0,0 +1,205 @@ +--- +- name: Install dependencies to build the Linux kernel + delegate_to: localhost + run_once: true + ansible.builtin.import_tasks: + file: install-deps/main.yml + +- name: Install b4 on host + become: yes + become_method: sudo + pip: + name: + - b4 + when: + - target_linux_install_b4 is defined + - target_linux_install_b4 + - ansible_facts['os_family']|lower != 'debian' + run_once: true + delegate_to: localhost + +- name: Add safe exception for a clone + command: "git config --global --add safe.directory {{ target_linux_git }}" + tags: [ 'clone'] + when: + - target_linux_git is string and target_linux_git.startswith('/') + run_once: true + delegate_to: localhost + +- name: Check if target directory exists when using 9p and Linux CLI was set + stat: + path: "{{ bootlinux_9p_host_path }}" + register: target_directory_stat + run_once: true + delegate_to: localhost + when: + - bootlinux_tree_set_by_cli|bool + +- name: Fail if target directory does not exist when using 9p and Linux CLI was set + fail: + msg: "The target directory {{ bootlinux_9p_host_path }} does not exist." + run_once: true + delegate_to: localhost + when: + - bootlinux_tree_set_by_cli|bool + - not target_directory_stat.stat.exists + +- name: git clone {{ target_linux_tree }} on the control node + git: + repo: "{{ target_linux_git }}" + dest: "{{ bootlinux_9p_host_path }}" + update: yes + depth: "{{ target_linux_shallow_depth }}" + version: "{{ target_linux_ref }}" + retries: 3 + delay: 5 + register: result + until: not result.failed + tags: [ 'clone'] + when: + - not bootlinux_tree_set_by_cli|bool + run_once: true + delegate_to: localhost + +- name: Copy kernel delta if requested on the control node + template: + src: "{{ target_linux_extra_patch }}" + dest: "{{ bootlinux_9p_host_path }}/{{ target_linux_extra_patch }}" + mode: 0644 + when: + - target_linux_extra_patch is defined + run_once: true + delegate_to: localhost + +- name: Apply kernel delta if requested on the control node + command: "git am {{ target_linux_extra_patch }}" + args: + chdir: "{{ bootlinux_9p_host_path }}" + when: + - target_linux_extra_patch is defined + run_once: true + delegate_to: localhost + +- name: Variable values + debug: + msg: "{{ target_linux_apply_patch_message_id }}" + when: + - target_linux_apply_patch_message_id is defined + +- name: Apply message patch set if requested on the control node + shell: b4 am -o - {{target_linux_apply_patch_message_id}} | git am + args: + chdir: "{{ bootlinux_9p_host_path }}" + when: + - target_linux_apply_patch_message_id is defined + - target_linux_apply_patch_message_id | length > 0 + - bootlinux_b4_am_this_host|bool + run_once: true + delegate_to: localhost + +- name: Copy configuration for Linux {{ target_linux_tree }} on the control node + template: + src: "{{ linux_config }}" + dest: "{{ bootlinux_9p_host_path }}/.config" + mode: 0644 + run_once: true + delegate_to: localhost + +- name: Set kernel localversion if requested on the control node + shell: "echo {{ target_linux_localversion }} > {{ bootlinux_9p_host_path }}/localversion" + when: + - target_linux_localversion is defined and target_linux_localversion != "" + run_once: true + delegate_to: localhost + +- name: Configure Linux {{ target_linux_tree }} on the control node + shell: | + set -o pipefail + yes "" | make oldconfig + register: configure_done + changed_when: configure_done.rc == 0 or configure_done.rc == 141 + failed_when: configure_done.rc != 0 and configure_done.rc != 141 + args: + chdir: "{{ bootlinux_9p_host_path }}" + executable: /bin/bash + run_once: true + delegate_to: localhost + +- name: Get nproc on the control node + command: "{{ num_jobs }}" + tags: [ 'build-linux', 'cxl-build' ] + register: nproc_9p + run_once: true + delegate_to: localhost + +- name: Get kernelversion + make: + chdir: "{{ bootlinux_9p_host_path }}" + target: kernelversion + register: target_linux_kernelversion + tags: [ 'build-linux' ] + when: + - target_linux_kernelrelease | length > 0 + run_once: true + delegate_to: localhost + +- name: Generate user kernelrelease {{ target_linux_kernelversion.stdout }}-{{ target_linux_kernelrelease }} + set_fact: + target_user_kernelrelease: "{{ target_linux_kernelversion.stdout }}-{{ target_linux_kernelrelease }}" + tags: [ 'build-linux' ] + when: + - target_linux_kernelrelease | length > 0 + run_once: true + delegate_to: localhost + +- name: Build {{ target_linux_tree }} {{ target_user_kernelrelease }} on the control node using {{ nproc_9p.stdout }} threads + make: + jobs: "{{ nproc_9p.stdout }}" + chdir: "{{ bootlinux_9p_host_path }}" + params: + KERNELRELEASE={{ target_user_kernelrelease }} + tags: [ 'build-linux' ] + when: + - target_linux_kernelrelease | length > 0 + run_once: true + delegate_to: localhost + +- name: Build {{ target_linux_tree }} {{ target_user_kernelrelease }} on the control node using {{ nproc_9p.stdout }} threads + make: + jobs: "{{ nproc_9p.stdout }}" + chdir: "{{ bootlinux_9p_host_path }}" + tags: [ 'build-linux' ] + when: + - target_linux_kernelrelease | length == 0 + run_once: true + delegate_to: localhost + +- name: Build {{ target_linux_tree }} cxl_test on the control node using {{ nproc_9p.stdout }} threads + make: + jobs: "{{ nproc_9p.stdout }}" + chdir: "{{ bootlinux_9p_host_path }}" + params: + M: "tools/testing/cxl" + tags: [ 'build-linux', 'cxl-build' ] + when: + - bootlinux_cxl_test|bool + run_once: true + delegate_to: localhost + +- name: See if snake-oil cert file is present on host + stat: + path: "{{ bootlinux_9p_host_path }}/certs/signing_key.pem" + register: snaik_oil_file_9p + tags: [ 'build-linux' ] + run_once: true + delegate_to: localhost + +- name: Ensure we allow world to read the snake oil in case of NFS or 9p read only usage + file: + path: "{{ bootlinux_9p_host_path }}/certs/signing_key.pem" + mode: "0755" + tags: [ 'build-linux' ] + when: + - snaik_oil_file_9p.stat.exists + run_once: true + delegate_to: localhost diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/roles/bootlinux/tasks/main.yml index 6a0563b1..2e5d950e 100644 --- a/playbooks/roles/bootlinux/tasks/main.yml +++ b/playbooks/roles/bootlinux/tasks/main.yml @@ -19,14 +19,6 @@ ansible.builtin.import_tasks: file: install-deps/main.yml -- name: Install dependencies to build the Linux kernel - delegate_to: localhost - run_once: true - ansible.builtin.import_tasks: - file: install-deps/main.yml - when: - - bootlinux_9p|bool - # We do this regardless of what distro you use - name: Install b4 become: yes @@ -39,20 +31,6 @@ - target_linux_install_b4 - ansible_facts['os_family']|lower != 'debian' -- name: Install b4 on host - become: yes - become_method: sudo - pip: - name: - - b4 - when: - - target_linux_install_b4 is defined - - target_linux_install_b4 - - bootlinux_9p|bool - - ansible_facts['os_family']|lower != 'debian' - run_once: true - delegate_to: localhost - - name: Set bootlinux_b4_am_this_host as a fact for dev hosts only set_fact: bootlinux_b4_am_this_host: "{{ ansible_hostname | regex_search('^.*-dev$') is not none }}" @@ -68,9 +46,7 @@ - include_role: name: create_data_partition -# Distro agnostic stuff to build and boot Linux goes below - -- name: Mount bootlinux 9p and add to fstab if it does not exist +- name: Mount bootlinux 9p on each target node become: yes become_flags: 'su - -c' become_method: sudo @@ -84,34 +60,11 @@ when: - bootlinux_9p|bool -- name: Add safe exception for a clone - command: "git config --global --add safe.directory {{ target_linux_git }}" - tags: [ 'clone'] - when: - - bootlinux_9p|bool - - target_linux_git is string and target_linux_git.startswith('/') - run_once: true - delegate_to: localhost - -- name: Check if target directory exists when using 9p and Linux CLI was set - stat: - path: "{{ bootlinux_9p_host_path }}" - register: target_directory_stat - run_once: true - delegate_to: localhost - when: - - bootlinux_9p|bool - - bootlinux_tree_set_by_cli|bool - -- name: Fail if target directory does not exist when using 9p and Linux CLI was set - fail: - msg: "The target directory {{ bootlinux_9p_host_path }} does not exist." - run_once: true - delegate_to: localhost +- name: Build the Linux kernel on the controller host + ansible.builtin.include_tasks: + file: "{{ role_path }}/tasks/build/9p.yml" when: - bootlinux_9p|bool - - bootlinux_tree_set_by_cli|bool - - not target_directory_stat.stat.exists - name: git clone {{ target_linux_tree }} on the target nodes git: @@ -128,24 +81,6 @@ when: - not bootlinux_9p|bool -- name: git clone {{ target_linux_tree }} on the control node - git: - repo: "{{ target_linux_git }}" - dest: "{{ bootlinux_9p_host_path }}" - update: yes - depth: "{{ target_linux_shallow_depth }}" - version: "{{ target_linux_ref }}" - retries: 3 - delay: 5 - register: result - until: not result.failed - tags: [ 'clone'] - when: - - bootlinux_9p|bool - - not bootlinux_tree_set_by_cli|bool - run_once: true - delegate_to: localhost - - name: Copy kernel delta if requested on the target nodes template: src: "{{ target_linux_extra_patch }}" @@ -157,17 +92,6 @@ - not bootlinux_9p|bool - target_linux_extra_patch is defined -- name: Copy kernel delta if requested on the control node - template: - src: "{{ target_linux_extra_patch }}" - dest: "{{ bootlinux_9p_host_path }}/{{ target_linux_extra_patch }}" - mode: 0644 - when: - - bootlinux_9p|bool - - target_linux_extra_patch is defined - run_once: true - delegate_to: localhost - - name: Apply kernel delta if requested on the target nodes command: "git am {{ target_linux_extra_patch }}" args: @@ -176,16 +100,6 @@ - not bootlinux_9p|bool - target_linux_extra_patch is defined -- name: Apply kernel delta if requested on the control node - command: "git am {{ target_linux_extra_patch }}" - args: - chdir: "{{ bootlinux_9p_host_path }}" - when: - - bootlinux_9p|bool - - target_linux_extra_patch is defined - run_once: true - delegate_to: localhost - - name: Set git user name and email if needed shell: | if ! $(git config --get user.email) ; then @@ -215,18 +129,6 @@ - target_linux_apply_patch_message_id | length > 0 - bootlinux_b4_am_this_host|bool -- name: Apply message patch set if requested on the control node - shell: b4 am -o - {{target_linux_apply_patch_message_id}} | git am - args: - chdir: "{{ bootlinux_9p_host_path }}" - when: - - bootlinux_9p|bool - - target_linux_apply_patch_message_id is defined - - target_linux_apply_patch_message_id | length > 0 - - bootlinux_b4_am_this_host|bool - run_once: true - delegate_to: localhost - - name: Copy configuration for Linux {{ target_linux_tree }} to the target nodes template: src: "{{ linux_config }}" @@ -237,30 +139,12 @@ when: - not bootlinux_9p|bool -- name: Copy configuration for Linux {{ target_linux_tree }} on the control node - template: - src: "{{ linux_config }}" - dest: "{{ bootlinux_9p_host_path }}/.config" - mode: 0644 - when: - - bootlinux_9p|bool - run_once: true - delegate_to: localhost - - name: Set kernel localversion if requested on the target nodes shell: "echo {{ target_linux_localversion }} > {{ target_linux_dir_path }}/localversion" when: - not bootlinux_9p|bool - target_linux_localversion is defined and target_linux_localversion != "" -- name: Set kernel localversion if requested on the control node - shell: "echo {{ target_linux_localversion }} > {{ bootlinux_9p_host_path }}/localversion" - when: - - bootlinux_9p|bool - - target_linux_localversion is defined and target_linux_localversion != "" - run_once: true - delegate_to: localhost - - name: Configure Linux {{ target_linux_tree }} on the target nodes shell: | set -o pipefail @@ -274,21 +158,6 @@ when: - not bootlinux_9p|bool -- name: Configure Linux {{ target_linux_tree }} on the control node - shell: | - set -o pipefail - yes "" | make oldconfig - register: configure_done - changed_when: configure_done.rc == 0 or configure_done.rc == 141 - failed_when: configure_done.rc != 0 and configure_done.rc != 141 - args: - chdir: "{{ bootlinux_9p_host_path }}" - executable: /bin/bash - when: - - bootlinux_9p|bool - run_once: true - delegate_to: localhost - - name: Build {{ target_linux_tree }} on the target nodes command: "{{ target_linux_make_cmd }}" register: build @@ -327,95 +196,6 @@ - not bootlinux_9p|bool - snaik_oil_file.stat.exists -- name: Get nproc on the control node - command: "{{ num_jobs }}" - tags: [ 'build-linux', 'cxl-build' ] - register: nproc_9p - when: - - bootlinux_9p|bool - run_once: true - delegate_to: localhost - -- name: Get kernelversion - make: - chdir: "{{ bootlinux_9p_host_path }}" - target: kernelversion - register: target_linux_kernelversion - tags: [ 'build-linux' ] - when: - - bootlinux_9p|bool - - target_linux_kernelrelease | length > 0 - run_once: true - delegate_to: localhost - -- name: Generate user kernelrelease {{ target_linux_kernelversion.stdout }}-{{ target_linux_kernelrelease }} - set_fact: - target_user_kernelrelease: "{{ target_linux_kernelversion.stdout }}-{{ target_linux_kernelrelease }}" - tags: [ 'build-linux' ] - when: - - bootlinux_9p|bool - - target_linux_kernelrelease | length > 0 - run_once: true - delegate_to: localhost - -- name: Build {{ target_linux_tree }} {{ target_user_kernelrelease }} on the control node using {{ nproc_9p.stdout }} threads - make: - jobs: "{{ nproc_9p.stdout }}" - chdir: "{{ bootlinux_9p_host_path }}" - params: - KERNELRELEASE={{ target_user_kernelrelease }} - tags: [ 'build-linux' ] - when: - - bootlinux_9p|bool - - target_linux_kernelrelease | length > 0 - run_once: true - delegate_to: localhost - -- name: Build {{ target_linux_tree }} {{ target_user_kernelrelease }} on the control node using {{ nproc_9p.stdout }} threads - make: - jobs: "{{ nproc_9p.stdout }}" - chdir: "{{ bootlinux_9p_host_path }}" - tags: [ 'build-linux' ] - when: - - bootlinux_9p|bool - - target_linux_kernelrelease | length == 0 - run_once: true - delegate_to: localhost - -- name: Build {{ target_linux_tree }} cxl_test on the control node using {{ nproc_9p.stdout }} threads - make: - jobs: "{{ nproc_9p.stdout }}" - chdir: "{{ bootlinux_9p_host_path }}" - params: - M: "tools/testing/cxl" - tags: [ 'build-linux', 'cxl-build' ] - when: - - bootlinux_9p|bool - - bootlinux_cxl_test|bool - run_once: true - delegate_to: localhost - -- name: See if snake-oil cert file is present on host - stat: - path: "{{ bootlinux_9p_host_path }}/certs/signing_key.pem" - register: snaik_oil_file_9p - tags: [ 'build-linux' ] - when: - - bootlinux_9p|bool - run_once: true - delegate_to: localhost - -- name: Ensure we allow world to read the snake oil in case of NFS or 9p read only usage - file: - path: "{{ bootlinux_9p_host_path }}/certs/signing_key.pem" - mode: "0755" - tags: [ 'build-linux' ] - when: - - bootlinux_9p|bool - - snaik_oil_file_9p.stat.exists - run_once: true - delegate_to: localhost - - name: Run uname before command: "uname -r" register: uname_cmd_before -- 2.47.2