|
| 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('') }} |
0 commit comments