Skip to content

Commit c64006d

Browse files
committed
workflows: bootlinux: add kernel configuration fragments support
Add comprehensive kernel configuration fragment system that enables building kernels using merge_config.sh with focused configuration fragments instead of monolithic config files. Key features: - Modular Kconfig organization split into logical categories - Support for both x86_64 and ARM64 architectures - Architecture-specific fragment visibility (ARM64 page sizes) - Module dependency management for advanced features - New fragments for extended modversions, kmemleak, and module testing Fragment categories: - Essential: Core system requirements (64bit, systemd, distro, storage) - Security: Hardening and security features - Architecture: Platform-specific optimizations - Development: Debugging and diagnostic tools - Memory: NUMA and memory management features - Modules: Kernel module system configuration - Advanced: eBPF, XArray, and specialized features - Container: Virtualization and container support - Specialized: Minimal kernels, power management, Rust support - Legacy: Compatibility and legacy feature support Technical implementation: - Uses merge_config.sh for robust fragment composition - Complete integration with kdevops build workflow - Supports both 9P and target build modes - Pre-built configurations for common setups - Template-based fragment management Configuration fragments origin: https://github.com/dkruces/linux-config-fragments Generated-by: Claude AI Signed-off-by: Daniel Gomez <[email protected]>
1 parent 0c19f30 commit c64006d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+807
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CONFIG_BOOTLINUX_USE_CONFIG_FRAGMENTS=y
2+
CONFIG_BOOTLINUX_FRAGMENT_64BIT=y
3+
CONFIG_BOOTLINUX_FRAGMENT_KVM_GUEST=y
4+
CONFIG_BOOTLINUX_FRAGMENT_VIRTIO_FS=y
5+
CONFIG_BOOTLINUX_FRAGMENT_SYSTEMD=y
6+
CONFIG_BOOTLINUX_FRAGMENT_DISTRO=y
7+
CONFIG_BOOTLINUX_FRAGMENT_STORAGE=y
8+
CONFIG_BOOTLINUX_FRAGMENT_INITRAMFS=y
9+
CONFIG_BOOTLINUX_FRAGMENT_LOCALAUTO=y
10+
CONFIG_BOOTLINUX_FRAGMENT_MODULES=y
11+
CONFIG_BOOTLINUX_FRAGMENT_MODULES_BLK=y
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CONFIG_BOOTLINUX_USE_CONFIG_FRAGMENTS=y
2+
CONFIG_BOOTLINUX_FRAGMENT_64BIT=y
3+
CONFIG_BOOTLINUX_FRAGMENT_KVM_GUEST=y
4+
CONFIG_BOOTLINUX_FRAGMENT_VIRTIO_FS=y
5+
CONFIG_BOOTLINUX_FRAGMENT_SYSTEMD=y
6+
CONFIG_BOOTLINUX_FRAGMENT_DISTRO=y
7+
CONFIG_BOOTLINUX_FRAGMENT_STORAGE=y
8+
CONFIG_BOOTLINUX_FRAGMENT_INITRAMFS=y
9+
CONFIG_BOOTLINUX_FRAGMENT_LOCALAUTO=y

playbooks/roles/bootlinux/defaults/main.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,46 @@ bootlinux_tree_custom_localversion: false
9898
bootlinux_is_dev_node: false
9999
bootlinux_debug_ref: "{{ lookup('env', 'DEBUG_REF') | default(false, true) | bool }}"
100100

101+
# Kernel configuration fragments support
102+
bootlinux_use_config_fragments: false
103+
104+
# Upstream kernel fragments
105+
bootlinux_fragment_tiny: false
106+
bootlinux_fragment_nopm: false
107+
bootlinux_fragment_debug: false
108+
bootlinux_fragment_hardening: false
109+
bootlinux_fragment_kvm_guest: true
110+
bootlinux_fragment_xen: false
111+
bootlinux_fragment_rust: false
112+
113+
# kdevops fragments
114+
bootlinux_fragment_64bit: true
115+
bootlinux_fragment_systemd: true
116+
bootlinux_fragment_distro: true
117+
bootlinux_fragment_storage: true
118+
bootlinux_fragment_virtio_fs: true
119+
bootlinux_fragment_numa: false
120+
bootlinux_fragment_modules: false
121+
bootlinux_fragment_initramfs: true
122+
bootlinux_fragment_ebpf: false
123+
bootlinux_fragment_gdb: false
124+
bootlinux_fragment_vm_debug: false
125+
bootlinux_fragment_localversion: false
126+
bootlinux_fragment_blktrace: false
127+
bootlinux_fragment_ksm: false
128+
129+
# ARM64 page size (mutually exclusive choice)
130+
bootlinux_fragment_arm64_4k_pages: false
131+
bootlinux_fragment_arm64_16k_pages: false
132+
bootlinux_fragment_arm64_64k_pages: false
133+
134+
# Additional kdevops fragments
135+
bootlinux_fragment_buffer_head: false
136+
bootlinux_fragment_ebpf_errorinj: false
137+
bootlinux_fragment_localauto: true
138+
bootlinux_fragment_moby: false
139+
bootlinux_fragment_modules_blk: false
140+
bootlinux_fragment_x86: false
141+
bootlinux_fragment_xarray: false
142+
bootlinux_fragment_xarray_no_multi: false
143+

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@
116116
mode: "0644"
117117
run_once: true
118118
delegate_to: localhost
119+
when: not bootlinux_use_config_fragments|default(false)|bool
120+
121+
- name: Use configuration fragments for Linux {{ target_linux_tree }} on the control node
122+
ansible.builtin.import_tasks: ../config-fragments.yml
123+
run_once: true
124+
delegate_to: localhost
125+
vars:
126+
target_linux_dir_path: "{{ bootlinux_9p_host_path }}"
127+
when:
128+
- bootlinux_use_config_fragments|default(false)|bool
119129

120130
- name: Set kernel localversion if requested on the control node
121131
ansible.builtin.shell: "echo {{ active_linux_localversion | default(target_linux_localversion) }} > {{ bootlinux_9p_host_path }}/localversion"
@@ -128,7 +138,7 @@
128138
$ {{ ansible_callback_diy.result.output.cmd | join(' ') }}
129139
{{ ansible_callback_diy.result.output.stdout | default('') }}
130140
131-
- name: Configure Linux {{ target_linux_tree }} on the control node
141+
- name: Configure kernel with oldconfig (9P build - monolithic config only)
132142
ansible.builtin.shell: |
133143
set -o pipefail
134144
yes "" | make oldconfig
@@ -141,6 +151,7 @@
141151
executable: /bin/bash
142152
run_once: true
143153
delegate_to: localhost
154+
when: not bootlinux_use_config_fragments|default(false)|bool
144155
vars:
145156
ansible_callback_diy_runner_on_ok_msg: |
146157
$ {{ ansible_callback_diy.result.output.cmd | join(' ') }}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
target: "olddefconfig"
113113
when:
114114
- bootlinux_compiler_gcc|bool
115+
- not bootlinux_use_config_fragments|default(false)|bool
115116

116117
- name: Build {{ target_linux_tree }}
117118
community.general.make:
@@ -129,6 +130,7 @@
129130
target: "olddefconfig"
130131
when:
131132
- bootlinux_compiler_clang|bool
133+
- not bootlinux_use_config_fragments|default(false)|bool
132134

133135
- name: Build {{ target_linux_tree }}
134136
community.general.make:

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@
7575
owner: "{{ data_user }}"
7676
group: "{{ data_group }}"
7777
mode: "0644"
78+
when: not bootlinux_use_config_fragments|default(false)|bool
79+
80+
- name: Use configuration fragments for Linux {{ target_linux_tree }} on target nodes
81+
ansible.builtin.import_tasks: ../config-fragments.yml
82+
when:
83+
- bootlinux_use_config_fragments|default(false)|bool
84+
- target_arch_arm64|default(false)|bool
7885

7986
- name: Set kernel localversion if requested on the target nodes
8087
ansible.builtin.shell: "echo {{ target_linux_localversion }} > {{ target_linux_dir_path }}/localversion"
@@ -91,6 +98,7 @@
9198
args:
9299
chdir: "{{ target_linux_dir_path }}"
93100
executable: /bin/bash
101+
when: not bootlinux_use_config_fragments|default(false)|bool
94102

95103
- name: Build {{ target_linux_tree }} on the target nodes
96104
ansible.builtin.shell: "{{ target_linux_make_cmd }}"
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
# Kernel configuration using fragments with merge_config.sh
3+
4+
- name: Initialize fragment list
5+
ansible.builtin.set_fact:
6+
fragment_list: []
7+
8+
# Build fragment list for upstream kernel fragments
9+
- name: Add upstream fragments to list
10+
ansible.builtin.set_fact:
11+
fragment_list: "{{ fragment_list + [item.path] }}"
12+
loop:
13+
- { condition: "{{ bootlinux_fragment_tiny|default(false)|bool }}", path: "kernel/configs/tiny.config" }
14+
- { condition: "{{ bootlinux_fragment_nopm|default(false)|bool }}", path: "kernel/configs/nopm.config" }
15+
- { condition: "{{ bootlinux_fragment_debug|default(false)|bool }}", path: "kernel/configs/debug.config" }
16+
- { condition: "{{ bootlinux_fragment_hardening|default(false)|bool }}", path: "kernel/configs/hardening.config" }
17+
- { condition: "{{ bootlinux_fragment_kvm_guest|default(false)|bool }}", path: "kernel/configs/kvm_guest.config" }
18+
- { condition: "{{ bootlinux_fragment_xen|default(false)|bool }}", path: "kernel/configs/xen.config" }
19+
- { condition: "{{ bootlinux_fragment_rust|default(false)|bool }}", path: "kernel/configs/rust.config" }
20+
when: item.condition
21+
22+
# Build fragment list for kdevops template fragments
23+
- name: Add kdevops template fragments to list
24+
ansible.builtin.set_fact:
25+
fragment_list: "{{ fragment_list + [role_path + '/templates/fragments/' + item.file] }}"
26+
loop:
27+
- { condition: "{{ bootlinux_fragment_64bit|default(false)|bool }}", file: "64bit.config" }
28+
- { condition: "{{ bootlinux_fragment_systemd|default(false)|bool }}", file: "systemd.config" }
29+
- { condition: "{{ bootlinux_fragment_distro|default(false)|bool }}", file: "distro.config" }
30+
- { condition: "{{ bootlinux_fragment_storage|default(false)|bool }}", file: "storage.config" }
31+
- { condition: "{{ bootlinux_fragment_virtio_fs|default(false)|bool }}", file: "virtio-fs.config" }
32+
- { condition: "{{ bootlinux_fragment_numa|default(false)|bool }}", file: "numa.config" }
33+
- { condition: "{{ bootlinux_fragment_modules|default(false)|bool }}", file: "modules.config" }
34+
- { condition: "{{ bootlinux_fragment_initramfs|default(false)|bool }}", file: "initramfs.config" }
35+
- { condition: "{{ bootlinux_fragment_ebpf|default(false)|bool }}", file: "ebpf.config" }
36+
- { condition: "{{ bootlinux_fragment_gdb|default(false)|bool }}", file: "gdb.config" }
37+
- { condition: "{{ bootlinux_fragment_vm_debug|default(false)|bool }}", file: "vm_debug.config" }
38+
- { condition: "{{ bootlinux_fragment_localversion|default(false)|bool }}", file: "localversion.config" }
39+
- { condition: "{{ bootlinux_fragment_blktrace|default(false)|bool }}", file: "blktrace.config" }
40+
- { condition: "{{ bootlinux_fragment_ksm|default(false)|bool }}", file: "ksm.config" }
41+
- { condition: "{{ bootlinux_fragment_arm64_4k_pages|default(false)|bool }}", file: "arm64_4k_pages.config" }
42+
- { condition: "{{ bootlinux_fragment_arm64_16k_pages|default(false)|bool }}", file: "arm64_16k_pages.config" }
43+
- { condition: "{{ bootlinux_fragment_arm64_64k_pages|default(false)|bool }}", file: "arm64_64k_pages.config" }
44+
- { condition: "{{ bootlinux_fragment_buffer_head|default(false)|bool }}", file: "buffer_head.config" }
45+
- { condition: "{{ bootlinux_fragment_ebpf_errorinj|default(false)|bool }}", file: "ebpf-errorinj.config" }
46+
- { condition: "{{ bootlinux_fragment_localauto|default(false)|bool }}", file: "localauto.config" }
47+
- { condition: "{{ bootlinux_fragment_moby|default(false)|bool }}", file: "moby.config" }
48+
- { condition: "{{ bootlinux_fragment_modules_blk|default(false)|bool }}", file: "modules-blk.config" }
49+
- { condition: "{{ bootlinux_fragment_x86|default(false)|bool }}", file: "x86.config" }
50+
- { condition: "{{ bootlinux_fragment_xarray|default(false)|bool }}", file: "xarray.config" }
51+
- { condition: "{{ bootlinux_fragment_xarray_no_multi|default(false)|bool }}", file: "xarray_no_multi.config" }
52+
when: item.condition
53+
54+
- name: Display selected configuration fragments
55+
ansible.builtin.debug:
56+
msg: |
57+
Selected kernel configuration fragments ({{ fragment_list | length }} total):
58+
{{ fragment_list | join(' ') }}
59+
when: fragment_list | length > 0
60+
61+
- name: Display warning if no fragments selected
62+
ansible.builtin.debug:
63+
msg: "WARNING: No configuration fragments were selected!"
64+
when: fragment_list | length == 0
65+
vars:
66+
ansible_callback_diy_runner_on_ok_msg: "{{ ansible_callback_diy.result.output.msg }}"
67+
68+
# Apply fragments using merge_config.sh
69+
- name: Apply configuration fragments using merge_config.sh
70+
ansible.builtin.shell: >-
71+
{{ 'LLVM=1 ' if bootlinux_compiler_clang|default(false)|bool else '' }}./scripts/kconfig/merge_config.sh
72+
-n .config
73+
{{ fragment_list | join(' ') }}
74+
args:
75+
chdir: "{{ target_linux_dir_path }}"
76+
when: fragment_list | length > 0
77+
vars:
78+
ansible_callback_diy_runner_on_ok_msg: |
79+
$ {{ ansible_callback_diy.result.output.cmd }}
80+
{{ ansible_callback_diy.result.output.stdout | default('') }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_64BIT=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_ARM64_16K_PAGES=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_ARM64_4K_PAGES=y

0 commit comments

Comments
 (0)