Skip to content

Commit e80f0da

Browse files
authored
Merge pull request #64 from linux-kdevops/cel/kernel-builder-fixes
Fixes for kernel-builder with Debian 11 I finally have a need to use Debian instead of a Red Hat-based OS on my test runners. This means that the bootlinux_builder implementation I did for RHEL/Fedora needs to be completed so that Debian works too. This series does that and throws in a few fixes for running NFS-related workflows on Debian 11.
2 parents be604b8 + bef4661 commit e80f0da

File tree

10 files changed

+154
-26
lines changed

10 files changed

+154
-26
lines changed

playbooks/roles/bootlinux/defaults/main.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,3 @@ bootlinux_fragment_x86: false
141141
bootlinux_fragment_xarray: false
142142
bootlinux_fragment_xarray_no_multi: false
143143

144-
145-
# Distro controls
146-
distro_debian_based: false
147-
distro_fedora: false
148-
distro_redhat_based: false
149-
distro_suse_based: false

playbooks/roles/bootlinux/tasks/build/9p.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
when:
1515
- target_linux_install_b4 is defined
1616
- target_linux_install_b4
17-
- not distro_debian_based|bool
17+
- ansible_facts['os_family']|lower != 'debian'
1818
run_once: true
1919
delegate_to: localhost
2020

playbooks/roles/bootlinux/tasks/build/builder.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@
176176
when:
177177
- ansible_os_family == "Debian"
178178
block:
179+
- name: Build the list of artifacts directories on the builder
180+
ansible.builtin.set_fact:
181+
artifact_paths:
182+
- "{{ target_linux_dir_path }}/.."
183+
179184
- name: Make the bindeb-pkg target
180185
community.general.make:
181186
chdir: "{{ target_linux_dir_path }}"

playbooks/roles/bootlinux/tasks/install-deps/debian/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@
4040
- libncurses-dev
4141
- b4
4242
- ccache
43+
- rsync
44+
- dwarves
45+
- lz4
4346
state: present

playbooks/roles/bootlinux/tasks/install-deps/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
- name: Debian-specific setup
33
ansible.builtin.import_tasks: debian/main.yml
44
when:
5-
- distro_debian_based|bool
5+
- ansible_os_family == "Debian"
66

77
- name: SuSE-specific setup
88
ansible.builtin.import_tasks: suse/main.yml
99
when:
10-
- distro_suse_based|bool
10+
- ansible_os_family == "Suse"
1111

1212
- name: Red Hat-specific setup
1313
ansible.builtin.import_tasks: redhat/main.yml
1414
when:
15-
- distro_redhat_based|bool
15+
- ansible_os_family == "RedHat"

playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ansible.builtin.include_role:
44
name: epel-release
55
when:
6-
- not distro_fedora|bool
6+
- ansible_distribution != "Fedora"
77

88
- name: Install packages we care about
99
become: true
@@ -67,7 +67,7 @@
6767
vars:
6868
packages:
6969
- btrfs-progs
70-
when: distro_fedora|bool
70+
when: ansible_distribution == 'Fedora'
7171

7272
- name: Install clang
7373
become: true

playbooks/roles/bootlinux/tasks/install/packages.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,45 @@
3939
loop: "{{ kernel_packages }}"
4040
loop_control:
4141
label: "Installing {{ item }}"
42+
changed_when: true
43+
44+
- name: Install the built kernel debs on the target nodes
45+
when:
46+
- ansible_os_family == "Debian"
47+
block:
48+
- name: Find the kernel build artifacts on the control host
49+
delegate_to: localhost
50+
ansible.builtin.find:
51+
paths: "{{ bootlinux_artifacts_dir }}"
52+
patterns: "*.deb"
53+
file_type: file
54+
recurse: true
55+
register: found_debs
56+
57+
- name: Upload the kernel build artifacts to the target nodes
58+
ansible.builtin.copy:
59+
src: "{{ item.path }}"
60+
dest: "/tmp"
61+
mode: "u=rw,g=r,o=r"
62+
loop: "{{ found_debs.files }}"
63+
loop_control:
64+
label: "Uploading {{ item.path | basename }} ..."
65+
66+
- name: Add the core kernel package
67+
ansible.builtin.set_fact:
68+
kernel_packages: "{{ kernel_packages + ['/tmp/' + item.path | basename] }}"
69+
when:
70+
- "'headers' not in item.path"
71+
loop: "{{ found_debs.files }}"
72+
loop_control:
73+
label: "Adding {{ item.path | basename }} ..."
74+
75+
- name: Install the selected kernel build artifacts on the target nodes
76+
become: true
77+
become_method: ansible.builtin.sudo
78+
ansible.builtin.command:
79+
cmd: "dpkg -i {{ item }}"
80+
loop: "{{ kernel_packages }}"
81+
loop_control:
82+
label: "Installing {{ item }}"
83+
changed_when: true

playbooks/roles/bootlinux/tasks/update-grub/install.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,66 @@
212212
when:
213213
- kernel_release_file.stat.exists
214214

215+
# GRUB detection logic for packaged kernels on Debian
216+
- name: Construct the command line to determine the default boot entry (package)
217+
tags:
218+
- saved
219+
ansible.builtin.set_fact:
220+
determine_default_kernel_id: >-
221+
awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg |
222+
awk '{print NR-1" ... "$0}' |
223+
grep {{ kernelrelease }} |
224+
head -1 |
225+
awk '{print $1}'
226+
when:
227+
- kernel_release_file.stat.exists
228+
- kernelrelease is defined
229+
- kernelrelease != "unknown"
230+
- ansible_facts['os_family']|lower == 'debian'
231+
232+
- name: Determine the target kernel's GRUB boot entry number (package) # noqa: command-instead-of-shell
233+
tags:
234+
- saved
235+
become: true
236+
become_flags: "su - -c"
237+
become_method: ansible.builtin.sudo
238+
ansible.builtin.shell:
239+
cmd: "{{ determine_default_kernel_id }}"
240+
register: grub_boot_number_cmd
241+
changed_when: false
242+
when:
243+
- kernel_release_file.stat.exists
244+
- kernelrelease is defined
245+
- kernelrelease != "unknown"
246+
- determine_default_kernel_id is defined
247+
248+
- name: Set the target kernel to be booted by default (package)
249+
become: true
250+
become_flags: "su - -c"
251+
become_method: ansible.builtin.sudo
252+
ansible.builtin.command:
253+
cmd: "/usr/sbin/grub-set-default \"{{ grub_boot_number_cmd.stdout_lines.0 }}\""
254+
changed_when: true
255+
tags: ["saved"]
256+
when:
257+
- grub_boot_number_cmd is defined
258+
- grub_boot_number_cmd.rc is defined
259+
- grub_boot_number_cmd.rc == 0
260+
- grub_boot_number_cmd.stdout is defined
261+
- grub_boot_number_cmd.stdout != ""
262+
263+
- name: Itemize kernel and GRUB entry selected (package)
264+
ansible.builtin.debug:
265+
msg: >-
266+
{{ target_kernel }} determined to be {{ grub_boot_number_cmd.stdout_lines.0 }}
267+
on the GRUB2 flat menu.
268+
Ran: grub-set-default {{ grub_boot_number_cmd.stdout_lines.0 }}
269+
vars:
270+
target_kernel: "{{ kernelrelease }}"
271+
tags: ["saved"]
272+
when:
273+
- grub_boot_number_cmd is defined
274+
- grub_boot_number_cmd.rc is defined
275+
- grub_boot_number_cmd.rc == 0
276+
- grub_boot_number_cmd.stdout is defined
277+
- grub_boot_number_cmd.stdout != ""

playbooks/roles/pynfs/tasks/install-deps/debian/main.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Install pynfs build dependencies
33
become: true
4-
become_method: sudo
4+
become_method: ansible.builtin.sudo
55
ansible.builtin.apt:
66
name:
77
- gcc
@@ -13,7 +13,18 @@
1313
- swig
1414
- python3-gssapi
1515
- python3-ply
16-
- python3-standard-xdrlib
1716
state: present
1817
update_cache: true
1918
tags: ["pynfs", "deps"]
19+
20+
# xdrlib was removed from Python 3.13; Debian packages it as python3-mda-xdrlib
21+
- name: Install xdrlib from Debian package on Debian 13+
22+
become: true
23+
become_method: ansible.builtin.sudo
24+
ansible.builtin.apt:
25+
name:
26+
- python3-mda-xdrlib
27+
state: present
28+
tags: ["pynfs", "deps"]
29+
when:
30+
- ansible_distribution_major_version | int >= 13

workflows/linux/Makefile

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ endif
6969
BOOTLINUX_ARGS += bootlinux_cxl_test=$(CONFIG_ENABLE_CXL_TEST)
7070
WORKFLOW_ARGS += $(BOOTLINUX_ARGS)
7171

72+
# Default host limit for bootlinux operations
73+
BOOTLINUX_LIMIT := baseline:dev
74+
75+
# When NFS server is enabled, include it in kernel updates so that workflows
76+
# like fstests, gitr, nfstest, and pynfs can test the kernel's NFS server
77+
# implementation (knfsd).
78+
ifeq (y,$(CONFIG_KDEVOPS_SETUP_NFSD))
79+
BOOTLINUX_LIMIT := baseline:dev:nfsd
80+
endif
81+
7282
PHONY += linux-help-menu
7383
linux-help-menu:
7484
@echo "Linux git kernel development options"
@@ -102,14 +112,14 @@ linux: linux-baseline linux-dev
102112
else
103113
linux: $(KDEVOPS_NODES)
104114
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
105-
--limit 'baseline:dev' \
115+
--limit '$(BOOTLINUX_LIMIT)' \
106116
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
107117
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)
108118
endif
109119
else
110120
linux: $(KDEVOPS_NODES)
111121
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
112-
--limit 'baseline:dev' \
122+
--limit '$(BOOTLINUX_LIMIT)' \
113123
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
114124
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)
115125
endif
@@ -143,47 +153,47 @@ endif
143153
PHONY += linux-mount
144154
linux-mount:
145155
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
146-
--limit 'baseline:dev' \
156+
--limit '$(BOOTLINUX_LIMIT)' \
147157
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
148158
--tags vars,9p_mount \
149159
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)
150160

151161
PHONY += linux-deploy
152162
linux-deploy:
153163
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
154-
--limit 'baseline:dev' \
164+
--limit '$(BOOTLINUX_LIMIT)' \
155165
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
156166
--tags vars,build-linux,install-linux,manual-update-grub,saved,vars,reboot \
157167
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)
158168

159169
PHONY += linux-build
160170
linux-build:
161171
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
162-
--limit 'baseline:dev' \
172+
--limit '$(BOOTLINUX_LIMIT)' \
163173
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
164174
--tags vars,build-linux,saved,vars \
165175
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)
166176

167177
PHONY += linux-install
168178
linux-install:
169179
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
170-
--limit 'baseline:dev' \
180+
--limit '$(BOOTLINUX_LIMIT)' \
171181
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
172182
--tags vars,build-linux,install-linux \
173183
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)
174184

175185
PHONY += linux-uninstall
176186
linux-uninstall:
177187
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
178-
--limit 'baseline:dev' \
188+
--limit '$(BOOTLINUX_LIMIT)' \
179189
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
180190
--tags uninstall-linux,vars \
181191
--extra-vars '{ "uninstall_kernel_enable": "True", $(LINUX_DYNAMIC_RUNTIME_VARS) }' \
182192
$(LIMIT_HOSTS)
183193

184194
linux-clone-clients: $(KDEVOPS_NODES)
185195
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
186-
--limit 'baseline:dev' \
196+
--limit '$(BOOTLINUX_LIMIT)' \
187197
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
188198
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) \
189199
--tags vars,clone
@@ -202,28 +212,28 @@ linux-clone: $(KDEVOPS_NODES) $(LINUX_CLONE_DEFAULT_TYPE)
202212
PHONY += linux-grub-setup
203213
linux-grub-setup:
204214
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
205-
--limit 'baseline:dev' \
215+
--limit '$(BOOTLINUX_LIMIT)' \
206216
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
207217
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) --tags manual-update-grub,saved,vars
208218

209219
PHONY += linux-reboot
210220
linux-reboot:
211221
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
212-
--limit 'baseline:dev' \
222+
--limit '$(BOOTLINUX_LIMIT)' \
213223
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
214224
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) --tags vars,reboot
215225

216226
PHONY += uname
217227
uname:
218-
$(Q)ansible 'baseline:dev' -b -m command -a "uname -r" -o \
228+
$(Q)ansible '$(BOOTLINUX_LIMIT)' -b -m command -a "uname -r" -o \
219229
| awk -F '|' '{gsub(/^ +| +$$/, "", $$2); printf "%-30s %s\n", $$1, $$4}' \
220230
| sed -e 's|(stdout)||'
221231

222232
ifeq (y,$(CONFIG_KDEVOPS_WORKFLOW_ENABLE_CXL))
223233
PHONY += linux-cxl
224234
linux-cxl: $(KDEVOPS_NODES)
225235
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
226-
--limit 'baseline:dev' \
236+
--limit '$(BOOTLINUX_LIMIT)' \
227237
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
228238
--tags 'vars,cxl-build,cxl-install' \
229239
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)

0 commit comments

Comments
 (0)