diff --git a/defconfigs/configs/linux_kdevops.config b/defconfigs/configs/linux_kdevops.config new file mode 100644 index 000000000..948935e67 --- /dev/null +++ b/defconfigs/configs/linux_kdevops.config @@ -0,0 +1,11 @@ +CONFIG_BOOTLINUX_USE_CONFIG_FRAGMENTS=y +CONFIG_BOOTLINUX_FRAGMENT_64BIT=y +CONFIG_BOOTLINUX_FRAGMENT_KVM_GUEST=y +CONFIG_BOOTLINUX_FRAGMENT_VIRTIO_FS=y +CONFIG_BOOTLINUX_FRAGMENT_SYSTEMD=y +CONFIG_BOOTLINUX_FRAGMENT_DISTRO=y +CONFIG_BOOTLINUX_FRAGMENT_STORAGE=y +CONFIG_BOOTLINUX_FRAGMENT_INITRAMFS=y +CONFIG_BOOTLINUX_FRAGMENT_LOCALAUTO=y +CONFIG_BOOTLINUX_FRAGMENT_MODULES=y +CONFIG_BOOTLINUX_FRAGMENT_MODULES_BLK=y diff --git a/defconfigs/configs/linux_minimal.config b/defconfigs/configs/linux_minimal.config new file mode 100644 index 000000000..4624f6e7c --- /dev/null +++ b/defconfigs/configs/linux_minimal.config @@ -0,0 +1,9 @@ +CONFIG_BOOTLINUX_USE_CONFIG_FRAGMENTS=y +CONFIG_BOOTLINUX_FRAGMENT_64BIT=y +CONFIG_BOOTLINUX_FRAGMENT_KVM_GUEST=y +CONFIG_BOOTLINUX_FRAGMENT_VIRTIO_FS=y +CONFIG_BOOTLINUX_FRAGMENT_SYSTEMD=y +CONFIG_BOOTLINUX_FRAGMENT_DISTRO=y +CONFIG_BOOTLINUX_FRAGMENT_STORAGE=y +CONFIG_BOOTLINUX_FRAGMENT_INITRAMFS=y +CONFIG_BOOTLINUX_FRAGMENT_LOCALAUTO=y diff --git a/playbooks/roles/bootlinux/defaults/main.yml b/playbooks/roles/bootlinux/defaults/main.yml index 84b61b8e7..1ae70b2c1 100644 --- a/playbooks/roles/bootlinux/defaults/main.yml +++ b/playbooks/roles/bootlinux/defaults/main.yml @@ -30,7 +30,38 @@ make: "make" # The commit is 34db57a47f875d11c4068567b9ec7ace174ec4cf # introduce fact "ansible_processor_nproc": number of usable vcpus #66569 # https://github.com/ansible/ansible/pull/66569 +# Build command without environment variables (added via environment dict) target_linux_make_cmd: "{{ make }} -j{{ ansible_processor_vcpus }}" + +# Make parameters dictionary for community.general.make module +bootlinux_make_params: >- + {{ + ({} | combine( + {'CC': 'ccache clang' if bootlinux_compiler_clang|default(false)|bool else 'ccache gcc'} if bootlinux_ccache|default(false)|bool else {} + ) | combine( + { + 'KBUILD_BUILD_TIMESTAMP': '', + 'KBUILD_BUILD_USER': 'kdevops', + 'KBUILD_BUILD_HOST': 'kdevops' + } if bootlinux_reproducible_builds|default(false)|bool else {} + )) + }} + +# Environment variables for remaining shell tasks (non-make) +bootlinux_build_environment: >- + {{ + ({} | combine( + {'CCACHE_CONFIGPATH': topdir_path + '/.ccache/ccache.conf'} if (bootlinux_ccache|default(false)|bool and bootlinux_ccache_kdevops_managed|default(false)|bool) else {} + ) | combine( + {'CC': 'ccache clang' if bootlinux_compiler_clang|default(false)|bool else 'ccache gcc'} if bootlinux_ccache|default(false)|bool else {} + ) | combine( + { + 'KBUILD_BUILD_TIMESTAMP': '', + 'KBUILD_BUILD_USER': 'kdevops', + 'KBUILD_BUILD_HOST': 'kdevops' + } if bootlinux_reproducible_builds|default(false)|bool else {} + )) + }} target_linux_make_install_cmd: "{{ target_linux_make_cmd }} modules_install install" uninstall_kernel_enable: false @@ -66,3 +97,47 @@ bootlinux_tree_custom_kernelrelease: false bootlinux_tree_custom_localversion: false bootlinux_is_dev_node: false bootlinux_debug_ref: "{{ lookup('env', 'DEBUG_REF') | default(false, true) | bool }}" + +# Kernel configuration fragments support +bootlinux_use_config_fragments: false + +# Upstream kernel fragments +bootlinux_fragment_tiny: false +bootlinux_fragment_nopm: false +bootlinux_fragment_debug: false +bootlinux_fragment_hardening: false +bootlinux_fragment_kvm_guest: true +bootlinux_fragment_xen: false +bootlinux_fragment_rust: false + +# kdevops fragments +bootlinux_fragment_64bit: true +bootlinux_fragment_systemd: true +bootlinux_fragment_distro: true +bootlinux_fragment_storage: true +bootlinux_fragment_virtio_fs: true +bootlinux_fragment_numa: false +bootlinux_fragment_modules: false +bootlinux_fragment_initramfs: true +bootlinux_fragment_ebpf: false +bootlinux_fragment_gdb: false +bootlinux_fragment_vm_debug: false +bootlinux_fragment_localversion: false +bootlinux_fragment_blktrace: false +bootlinux_fragment_ksm: false + +# ARM64 page size (mutually exclusive choice) +bootlinux_fragment_arm64_4k_pages: false +bootlinux_fragment_arm64_16k_pages: false +bootlinux_fragment_arm64_64k_pages: false + +# Additional kdevops fragments +bootlinux_fragment_buffer_head: false +bootlinux_fragment_ebpf_errorinj: false +bootlinux_fragment_localauto: true +bootlinux_fragment_moby: false +bootlinux_fragment_modules_blk: false +bootlinux_fragment_x86: false +bootlinux_fragment_xarray: false +bootlinux_fragment_xarray_no_multi: false + diff --git a/playbooks/roles/bootlinux/tasks/build/9p.yml b/playbooks/roles/bootlinux/tasks/build/9p.yml index acd69dc25..f390f028d 100644 --- a/playbooks/roles/bootlinux/tasks/build/9p.yml +++ b/playbooks/roles/bootlinux/tasks/build/9p.yml @@ -109,6 +109,15 @@ $ {{ ansible_callback_diy.result.output.cmd | join(' ') }} {{ ansible_callback_diy.result.output.stdout | default('') }} +- name: Clean kernel source before configuration (make mrproper) on the control node + community.general.make: + chdir: "{{ bootlinux_9p_host_path }}" + target: "mrproper" + when: bootlinux_clean_before_build|default(false)|bool + run_once: true + delegate_to: localhost + tags: ["build-linux"] + - name: Copy configuration for Linux {{ target_linux_tree }} on the control node ansible.builtin.template: src: "{{ linux_config }}" @@ -116,6 +125,16 @@ mode: "0644" run_once: true delegate_to: localhost + when: not bootlinux_use_config_fragments|default(false)|bool + +- name: Use configuration fragments for Linux {{ target_linux_tree }} on the control node + ansible.builtin.import_tasks: ../config-fragments.yml + run_once: true + delegate_to: localhost + vars: + target_linux_dir_path: "{{ bootlinux_9p_host_path }}" + when: + - bootlinux_use_config_fragments|default(false)|bool - name: Set kernel localversion if requested on the control node ansible.builtin.shell: "echo {{ active_linux_localversion | default(target_linux_localversion) }} > {{ bootlinux_9p_host_path }}/localversion" @@ -128,18 +147,20 @@ $ {{ ansible_callback_diy.result.output.cmd | join(' ') }} {{ ansible_callback_diy.result.output.stdout | default('') }} -- name: Configure Linux {{ target_linux_tree }} on the control node +- name: Configure kernel with oldconfig (9P build - monolithic config only) ansible.builtin.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 + environment: "{{ bootlinux_build_environment }}" args: chdir: "{{ bootlinux_9p_host_path }}" executable: /bin/bash run_once: true delegate_to: localhost + when: not bootlinux_use_config_fragments|default(false)|bool vars: ansible_callback_diy_runner_on_ok_msg: | $ {{ ansible_callback_diy.result.output.cmd | join(' ') }} @@ -156,10 +177,47 @@ $ {{ ansible_callback_diy.result.output.cmd | join(' ') }} {{ ansible_callback_diy.result.output.stdout | default('') }} +- name: Debug kernel build command configuration for 9P build + ansible.builtin.debug: + msg: | + === KERNEL BUILD COMMAND DEBUG (9P BUILD) === + build_jobs: {{ nproc_9p.stdout }} + bootlinux_make_params: {{ bootlinux_make_params }} + bootlinux_build_environment: {{ bootlinux_build_environment }} + bootlinux_ccache: {{ bootlinux_ccache|default(false) }} + bootlinux_compiler_clang: {{ bootlinux_compiler_clang|default(false) }} + bootlinux_reproducible_builds: {{ bootlinux_reproducible_builds|default(false) }} + bootlinux_ccache_kdevops_managed: {{ bootlinux_ccache_kdevops_managed|default(false) }} + run_once: true + delegate_to: localhost + vars: + ansible_callback_diy_runner_on_ok_msg: "{{ ansible_callback_diy.result.output.msg }}" + tags: ["build-linux"] + +- name: Test CC environment variable is working before build + ansible.builtin.shell: | + echo "CC environment test:" + echo "CC=${CC:-'not set'}" + echo "PATH=${PATH}" + which gcc || echo "gcc not found" + which ccache || echo "ccache not found" + env | grep -E '^(CC|CCACHE|PATH)' | sort + environment: "{{ bootlinux_build_environment }}" + register: cc_test_result + run_once: true + delegate_to: localhost + vars: + ansible_callback_diy_runner_on_ok_msg: | + CC Environment Test Results: + {{ ansible_callback_diy.result.output.stdout | default('') }} + tags: ["build-linux"] + - name: Get kernelversion community.general.make: chdir: "{{ bootlinux_9p_host_path }}" target: kernelversion + params: "{{ bootlinux_make_params }}" + environment: "{{ bootlinux_build_environment }}" register: target_linux_kernelversion tags: ["build-linux"] when: @@ -180,7 +238,8 @@ community.general.make: jobs: "{{ nproc_9p.stdout }}" chdir: "{{ bootlinux_9p_host_path }}" - params: KERNELRELEASE={{ target_user_kernelrelease }} + params: "{{ bootlinux_make_params | combine({'KERNELRELEASE': target_user_kernelrelease}) }}" + environment: "{{ bootlinux_build_environment }}" tags: ["build-linux"] when: - (active_linux_kernelrelease | default(target_linux_kernelrelease)) | length > 0 @@ -191,6 +250,8 @@ community.general.make: jobs: "{{ nproc_9p.stdout }}" chdir: "{{ bootlinux_9p_host_path }}" + params: "{{ bootlinux_make_params }}" + environment: "{{ bootlinux_build_environment }}" tags: ["build-linux"] when: - (active_linux_kernelrelease | default(target_linux_kernelrelease)) | length == 0 @@ -201,8 +262,8 @@ community.general.make: jobs: "{{ nproc_9p.stdout }}" chdir: "{{ bootlinux_9p_host_path }}" - params: - M: "tools/testing/cxl" + params: "{{ bootlinux_make_params | combine({'M': 'tools/testing/cxl'}) }}" + environment: "{{ bootlinux_build_environment }}" tags: ["build-linux", "cxl-build"] when: - bootlinux_cxl_test|bool diff --git a/playbooks/roles/bootlinux/tasks/build/builder.yml b/playbooks/roles/bootlinux/tasks/build/builder.yml index 9ab73bf79..f981ad975 100644 --- a/playbooks/roles/bootlinux/tasks/build/builder.yml +++ b/playbooks/roles/bootlinux/tasks/build/builder.yml @@ -112,6 +112,7 @@ target: "olddefconfig" when: - bootlinux_compiler_gcc|bool + - not bootlinux_use_config_fragments|default(false)|bool - name: Build {{ target_linux_tree }} community.general.make: @@ -129,6 +130,7 @@ target: "olddefconfig" when: - bootlinux_compiler_clang|bool + - not bootlinux_use_config_fragments|default(false)|bool - name: Build {{ target_linux_tree }} community.general.make: diff --git a/playbooks/roles/bootlinux/tasks/build/targets.yml b/playbooks/roles/bootlinux/tasks/build/targets.yml index 6bd861cbe..d77c8634b 100644 --- a/playbooks/roles/bootlinux/tasks/build/targets.yml +++ b/playbooks/roles/bootlinux/tasks/build/targets.yml @@ -75,6 +75,13 @@ owner: "{{ data_user }}" group: "{{ data_group }}" mode: "0644" + when: not bootlinux_use_config_fragments|default(false)|bool + +- name: Use configuration fragments for Linux {{ target_linux_tree }} on target nodes + ansible.builtin.import_tasks: ../config-fragments.yml + when: + - bootlinux_use_config_fragments|default(false)|bool + - target_arch_arm64|default(false)|bool - name: Set kernel localversion if requested on the target nodes ansible.builtin.shell: "echo {{ target_linux_localversion }} > {{ target_linux_dir_path }}/localversion" @@ -91,21 +98,24 @@ args: chdir: "{{ target_linux_dir_path }}" executable: /bin/bash + when: not bootlinux_use_config_fragments|default(false)|bool - name: Build {{ target_linux_tree }} on the target nodes - ansible.builtin.command: "{{ target_linux_make_cmd }}" + ansible.builtin.shell: "{{ target_linux_make_cmd }}" register: build changed_when: "build.rc == 0" args: chdir: "{{ target_linux_dir_path }}" + environment: "{{ bootlinux_build_environment }}" tags: ["build-linux"] - name: Build {{ target_linux_tree }} cxl_test on the target nodes - ansible.builtin.command: "{{ target_linux_make_cmd }} M=tools/testing/cxl" + ansible.builtin.shell: "{{ target_linux_make_cmd }} M=tools/testing/cxl" register: build_cxl_test changed_when: "build_cxl_test.rc == 0" args: chdir: "{{ target_linux_dir_path }}" + environment: "{{ bootlinux_build_environment }}" tags: ["build-linux", "cxl-build"] when: - bootlinux_cxl_test|bool diff --git a/playbooks/roles/bootlinux/tasks/ccache.yml b/playbooks/roles/bootlinux/tasks/ccache.yml new file mode 100644 index 000000000..38b2c034d --- /dev/null +++ b/playbooks/roles/bootlinux/tasks/ccache.yml @@ -0,0 +1,37 @@ +--- +# ccache configuration and setup + +- name: Create kdevops ccache directory structure + ansible.builtin.file: + path: "{{ item }}" + state: directory + mode: '0755' + loop: + - "{{ topdir_path }}/.ccache" + - "{{ bootlinux_ccache_dir }}" + when: + - bootlinux_ccache|default(false)|bool + - bootlinux_ccache_kdevops_managed|default(false)|bool + +- name: Generate kdevops-managed ccache configuration + ansible.builtin.template: + src: ccache.conf.j2 + dest: "{{ topdir_path }}/.ccache/ccache.conf" + mode: '0644' + when: + - bootlinux_ccache|default(false)|bool + - bootlinux_ccache_kdevops_managed|default(false)|bool + +- name: Display ccache configuration info + ansible.builtin.debug: + msg: | + ccache enabled: {{ bootlinux_ccache|default(false)|bool }} + ccache mode: {{ 'kdevops-managed' if bootlinux_ccache_kdevops_managed|default(false)|bool else 'system-wide' }} + {% if bootlinux_ccache_kdevops_managed|default(false)|bool %} + Config file: {{ topdir_path }}/.ccache/ccache.conf + Cache directory: {{ bootlinux_ccache_dir }} + Max size: {{ bootlinux_ccache_max_size }} GiB + {% endif %} + when: bootlinux_ccache|default(false)|bool + vars: + ansible_callback_diy_runner_on_ok_msg: "{{ ansible_callback_diy.result.output.msg }}" diff --git a/playbooks/roles/bootlinux/tasks/config-fragments.yml b/playbooks/roles/bootlinux/tasks/config-fragments.yml new file mode 100644 index 000000000..855022b60 --- /dev/null +++ b/playbooks/roles/bootlinux/tasks/config-fragments.yml @@ -0,0 +1,80 @@ +--- +# Kernel configuration using fragments with merge_config.sh + +- name: Initialize fragment list + ansible.builtin.set_fact: + fragment_list: [] + +# Build fragment list for upstream kernel fragments +- name: Add upstream fragments to list + ansible.builtin.set_fact: + fragment_list: "{{ fragment_list + [item.path] }}" + loop: + - { condition: "{{ bootlinux_fragment_tiny|default(false)|bool }}", path: "kernel/configs/tiny.config" } + - { condition: "{{ bootlinux_fragment_nopm|default(false)|bool }}", path: "kernel/configs/nopm.config" } + - { condition: "{{ bootlinux_fragment_debug|default(false)|bool }}", path: "kernel/configs/debug.config" } + - { condition: "{{ bootlinux_fragment_hardening|default(false)|bool }}", path: "kernel/configs/hardening.config" } + - { condition: "{{ bootlinux_fragment_kvm_guest|default(false)|bool }}", path: "kernel/configs/kvm_guest.config" } + - { condition: "{{ bootlinux_fragment_xen|default(false)|bool }}", path: "kernel/configs/xen.config" } + - { condition: "{{ bootlinux_fragment_rust|default(false)|bool }}", path: "kernel/configs/rust.config" } + when: item.condition + +# Build fragment list for kdevops template fragments +- name: Add kdevops template fragments to list + ansible.builtin.set_fact: + fragment_list: "{{ fragment_list + [role_path + '/templates/fragments/' + item.file] }}" + loop: + - { condition: "{{ bootlinux_fragment_64bit|default(false)|bool }}", file: "64bit.config" } + - { condition: "{{ bootlinux_fragment_systemd|default(false)|bool }}", file: "systemd.config" } + - { condition: "{{ bootlinux_fragment_distro|default(false)|bool }}", file: "distro.config" } + - { condition: "{{ bootlinux_fragment_storage|default(false)|bool }}", file: "storage.config" } + - { condition: "{{ bootlinux_fragment_virtio_fs|default(false)|bool }}", file: "virtio-fs.config" } + - { condition: "{{ bootlinux_fragment_numa|default(false)|bool }}", file: "numa.config" } + - { condition: "{{ bootlinux_fragment_modules|default(false)|bool }}", file: "modules.config" } + - { condition: "{{ bootlinux_fragment_initramfs|default(false)|bool }}", file: "initramfs.config" } + - { condition: "{{ bootlinux_fragment_ebpf|default(false)|bool }}", file: "ebpf.config" } + - { condition: "{{ bootlinux_fragment_gdb|default(false)|bool }}", file: "gdb.config" } + - { condition: "{{ bootlinux_fragment_vm_debug|default(false)|bool }}", file: "vm_debug.config" } + - { condition: "{{ bootlinux_fragment_localversion|default(false)|bool }}", file: "localversion.config" } + - { condition: "{{ bootlinux_fragment_blktrace|default(false)|bool }}", file: "blktrace.config" } + - { condition: "{{ bootlinux_fragment_ksm|default(false)|bool }}", file: "ksm.config" } + - { condition: "{{ bootlinux_fragment_arm64_4k_pages|default(false)|bool }}", file: "arm64_4k_pages.config" } + - { condition: "{{ bootlinux_fragment_arm64_16k_pages|default(false)|bool }}", file: "arm64_16k_pages.config" } + - { condition: "{{ bootlinux_fragment_arm64_64k_pages|default(false)|bool }}", file: "arm64_64k_pages.config" } + - { condition: "{{ bootlinux_fragment_buffer_head|default(false)|bool }}", file: "buffer_head.config" } + - { condition: "{{ bootlinux_fragment_ebpf_errorinj|default(false)|bool }}", file: "ebpf-errorinj.config" } + - { condition: "{{ bootlinux_fragment_localauto|default(false)|bool }}", file: "localauto.config" } + - { condition: "{{ bootlinux_fragment_moby|default(false)|bool }}", file: "moby.config" } + - { condition: "{{ bootlinux_fragment_modules_blk|default(false)|bool }}", file: "modules-blk.config" } + - { condition: "{{ bootlinux_fragment_x86|default(false)|bool }}", file: "x86.config" } + - { condition: "{{ bootlinux_fragment_xarray|default(false)|bool }}", file: "xarray.config" } + - { condition: "{{ bootlinux_fragment_xarray_no_multi|default(false)|bool }}", file: "xarray_no_multi.config" } + when: item.condition + +- name: Display selected configuration fragments + ansible.builtin.debug: + msg: | + Selected kernel configuration fragments ({{ fragment_list | length }} total): + {{ fragment_list | join(' ') }} + when: fragment_list | length > 0 + +- name: Display warning if no fragments selected + ansible.builtin.debug: + msg: "WARNING: No configuration fragments were selected!" + when: fragment_list | length == 0 + vars: + ansible_callback_diy_runner_on_ok_msg: "{{ ansible_callback_diy.result.output.msg }}" + +# Apply fragments using merge_config.sh +- name: Apply configuration fragments using merge_config.sh + ansible.builtin.shell: >- + {{ 'LLVM=1 ' if bootlinux_compiler_clang|default(false)|bool else '' }}./scripts/kconfig/merge_config.sh + -n .config + {{ fragment_list | join(' ') }} + args: + chdir: "{{ target_linux_dir_path }}" + when: fragment_list | length > 0 + vars: + ansible_callback_diy_runner_on_ok_msg: | + $ {{ ansible_callback_diy.result.output.cmd }} + {{ ansible_callback_diy.result.output.stdout | default('') }} diff --git a/playbooks/roles/bootlinux/tasks/config.yml b/playbooks/roles/bootlinux/tasks/config.yml index c1ecbaedd..66442ad20 100644 --- a/playbooks/roles/bootlinux/tasks/config.yml +++ b/playbooks/roles/bootlinux/tasks/config.yml @@ -31,6 +31,14 @@ when: - linux_next_configs.matched > 0 +- name: Clean kernel source before configuration (make mrproper) for non-9P builds + community.general.make: + chdir: "{{ target_linux_dir_path }}" + target: "mrproper" + when: + - bootlinux_clean_before_build|default(false)|bool + - not bootlinux_9p|bool + - name: Set the .config file for building the test kernel ansible.builtin.set_fact: linux_config: "{{ item | basename }}" diff --git a/playbooks/roles/bootlinux/tasks/install-deps/debian/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/debian/main.yml index 4edf8e1d8..e59110298 100644 --- a/playbooks/roles/bootlinux/tasks/install-deps/debian/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-deps/debian/main.yml @@ -39,4 +39,5 @@ - zstd - libncurses-dev - b4 + - ccache state: present diff --git a/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml index c7b18cd56..7f1955bf4 100644 --- a/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml @@ -52,6 +52,7 @@ - dwarves - userspace-rcu - zstd + - ccache - name: Install btrfs-progs become: true diff --git a/playbooks/roles/bootlinux/tasks/install-deps/suse/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/suse/main.yml index 7f0cf2490..5c9f0e3b4 100644 --- a/playbooks/roles/bootlinux/tasks/install-deps/suse/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-deps/suse/main.yml @@ -28,4 +28,5 @@ - portmap - hwinfo - open-iscsi + - ccache disable_recommends: false diff --git a/playbooks/roles/bootlinux/tasks/install-minimal-deps/debian/main.yml b/playbooks/roles/bootlinux/tasks/install-minimal-deps/debian/main.yml index fab4998ab..cc05a44a4 100644 --- a/playbooks/roles/bootlinux/tasks/install-minimal-deps/debian/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-minimal-deps/debian/main.yml @@ -24,4 +24,5 @@ - make - gcc - kmod + - ccache state: present diff --git a/playbooks/roles/bootlinux/tasks/install-minimal-deps/redhat/main.yml b/playbooks/roles/bootlinux/tasks/install-minimal-deps/redhat/main.yml index 50651ab15..950dbfe15 100644 --- a/playbooks/roles/bootlinux/tasks/install-minimal-deps/redhat/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-minimal-deps/redhat/main.yml @@ -10,6 +10,7 @@ - make - gcc - kmod + - ccache state: present when: - ansible_facts['distribution_major_version']|int < 8 @@ -22,6 +23,7 @@ - make - gcc - kmod + - ccache state: present when: - ansible_facts['distribution_major_version']|int >= 8 diff --git a/playbooks/roles/bootlinux/tasks/install-minimal-deps/suse/main.yml b/playbooks/roles/bootlinux/tasks/install-minimal-deps/suse/main.yml index a4cc27bb5..d8f75240c 100644 --- a/playbooks/roles/bootlinux/tasks/install-minimal-deps/suse/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-minimal-deps/suse/main.yml @@ -10,4 +10,5 @@ - make - gcc - kmod-compat + - ccache state: present diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/roles/bootlinux/tasks/main.yml index e0eb22345..eff6fb6bd 100644 --- a/playbooks/roles/bootlinux/tasks/main.yml +++ b/playbooks/roles/bootlinux/tasks/main.yml @@ -32,6 +32,15 @@ - bootlinux_9p|bool - not workflow_linux_packaged|bool +# Setup ccache configuration +- name: Setup ccache configuration + ansible.builtin.import_tasks: + file: ccache.yml + when: + - bootlinux_ccache|default(false)|bool + - not workflow_linux_packaged|bool + tags: ['ccache'] + # We do this regardless of what distro you use - name: Install b4 become: true @@ -193,6 +202,22 @@ when: - bootlinux_9p|bool +- name: Debug kernel build command configuration + ansible.builtin.debug: + msg: | + === KERNEL BUILD COMMAND DEBUG === + build_jobs: {{ ansible_processor_vcpus }} + bootlinux_make_params: {{ bootlinux_make_params }} + bootlinux_build_environment: {{ bootlinux_build_environment }} + bootlinux_compiler_clang: {{ bootlinux_compiler_clang|default(false) }} + bootlinux_reproducible_builds: {{ bootlinux_reproducible_builds|default(false) }} + when: + - not workflow_linux_packaged|bool + - not bootlinux_9p|bool + vars: + ansible_callback_diy_runner_on_ok_msg: "{{ ansible_callback_diy.result.output.msg }}" + tags: ["install-linux", "debug"] + - name: Build the Linux kernel on the controller host ansible.builtin.include_tasks: file: "{{ role_path }}/tasks/build/9p.yml" @@ -318,11 +343,12 @@ become: true become_flags: "su - -c" become_method: sudo - ansible.builtin.command: "{{ target_linux_make_install_cmd }}" + ansible.builtin.shell: "{{ target_linux_make_install_cmd }}" register: install_done changed_when: "install_done.rc == 0" args: chdir: "{{ target_linux_dir_path }}" + environment: "{{ bootlinux_build_environment }}" tags: ["install-linux"] when: - not workflow_linux_packaged|bool @@ -335,11 +361,12 @@ become: true become_flags: "su - -c" become_method: sudo - ansible.builtin.command: "{{ target_linux_make_install_cmd }} M=tools/testing/cxl INSTALL_MOD_DIR=updates" + ansible.builtin.shell: "{{ target_linux_make_install_cmd }} M=tools/testing/cxl INSTALL_MOD_DIR=updates" register: install_done changed_when: "install_done.rc == 0" args: chdir: "{{ target_linux_dir_path }}" + environment: "{{ bootlinux_build_environment }}" tags: ["install-linux", "cxl-install"] when: - kdevops_workflow_enable_cxl|bool diff --git a/playbooks/roles/bootlinux/templates/ccache.conf.j2 b/playbooks/roles/bootlinux/templates/ccache.conf.j2 new file mode 100644 index 000000000..8c0a7bf97 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/ccache.conf.j2 @@ -0,0 +1,27 @@ +# kdevops-managed ccache configuration +# Generated automatically - do not edit manually + +# Cache settings +cache_dir = {{ bootlinux_ccache_dir }} +max_size = {{ bootlinux_ccache_max_size }}.0 GiB + +# Performance settings +compression = {{ bootlinux_ccache_compression | lower }} +stats = true + +# Build reproducibility - ensure deterministic compilation +compiler_check = mtime +direct_mode = true +hash_dir = true + +# Debugging (disabled by default for performance) +debug = false + +# File handling +file_clone = false +hard_link = false +inode_cache = true + +# Security +umask = +read_only = false diff --git a/playbooks/roles/bootlinux/templates/fragments/64bit.config b/playbooks/roles/bootlinux/templates/fragments/64bit.config new file mode 100644 index 000000000..06a94e48b --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/64bit.config @@ -0,0 +1 @@ +CONFIG_64BIT=y diff --git a/playbooks/roles/bootlinux/templates/fragments/arm64_16k_pages.config b/playbooks/roles/bootlinux/templates/fragments/arm64_16k_pages.config new file mode 100644 index 000000000..a83e1a50a --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/arm64_16k_pages.config @@ -0,0 +1 @@ +CONFIG_ARM64_16K_PAGES=y diff --git a/playbooks/roles/bootlinux/templates/fragments/arm64_4k_pages.config b/playbooks/roles/bootlinux/templates/fragments/arm64_4k_pages.config new file mode 100644 index 000000000..5df91df1a --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/arm64_4k_pages.config @@ -0,0 +1 @@ +CONFIG_ARM64_4K_PAGES=y diff --git a/playbooks/roles/bootlinux/templates/fragments/arm64_64k_pages.config b/playbooks/roles/bootlinux/templates/fragments/arm64_64k_pages.config new file mode 100644 index 000000000..bda5426de --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/arm64_64k_pages.config @@ -0,0 +1 @@ +CONFIG_ARM64_64K_PAGES=y diff --git a/playbooks/roles/bootlinux/templates/fragments/blktrace.config b/playbooks/roles/bootlinux/templates/fragments/blktrace.config new file mode 100644 index 000000000..1d95879a0 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/blktrace.config @@ -0,0 +1,2 @@ +CONFIG_FTRACE=y +CONFIG_BLK_DEV_IO_TRACE=y diff --git a/playbooks/roles/bootlinux/templates/fragments/buffer_head.config b/playbooks/roles/bootlinux/templates/fragments/buffer_head.config new file mode 100644 index 000000000..a091f1ee4 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/buffer_head.config @@ -0,0 +1,7 @@ +# Disable buffer head support +CONFIG_EXFAT_FS=n +CONFIG_EXT4_FS=n +CONFIG_FAT_FS=n +CONFIG_NTFS_FS=n +CONFIG_MSDOS_FS=n +CONFIG_VFAT_FS=n diff --git a/playbooks/roles/bootlinux/templates/fragments/distro.config b/playbooks/roles/bootlinux/templates/fragments/distro.config new file mode 100644 index 000000000..4a0d3cf01 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/distro.config @@ -0,0 +1,84 @@ +CONFIG_ACPI=y +CONFIG_ADVISE_SYSCALLS=y +CONFIG_AIO=y +CONFIG_ALLOW_DEV_COREDUMP=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_BINFMT_ELF=y +CONFIG_BINFMT_MISC=y +CONFIG_BINFMT_SCRIPT=y +CONFIG_BUG=y +CONFIG_CHECKPOINT_RESTORE=y +CONFIG_CMA_SYSFS=y +CONFIG_CMA=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_COREDUMP=y # Required by CONFIG_ELF_CORE +CONFIG_CPU_ISOLATION=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_DEBUG_MISC=y +CONFIG_DEVMEM=y +CONFIG_DEVTMPFS=y +CONFIG_E1000E=y +CONFIG_E1000=y +CONFIG_ELF_CORE=y +CONFIG_ETHERNET=y +CONFIG_EXPERT=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_FAT_DEFAULT_UTF8=y +CONFIG_FAT_FS=y +CONFIG_FILE_LOCKING=y # Required for CONFIG_NFSD +CONFIG_FS_STACK=y +CONFIG_FUSE_DAX=y +CONFIG_FUSE_IO_URING=y +CONFIG_FUSE_PASSTHROUGH=y +CONFIG_FUTEX=y +CONFIG_FW_LOADER=y +CONFIG_GUP_TEST=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_HOTPLUG_CPU=y +CONFIG_HWMON=y +CONFIG_HW_RANDOM=y +CONFIG_INPUT=y +CONFIG_IOMMU_SUPPORT=y +CONFIG_KALLSYMS=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_MEMBARRIER=y +CONFIG_MEMCG=y +CONFIG_MIGRATION=y +CONFIG_MSDOS_FS=y +CONFIG_NET_9P_FD=y +CONFIG_NETFILTER=y +CONFIG_NET_VENDOR_INTEL=y +CONFIG_NFSD=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS=y +CONFIG_NTFS_FS=y +CONFIG_PACKET=y +CONFIG_POSIX_TIMERS=y +CONFIG_PRINTK_TIME=y +CONFIG_PRINTK=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_PROC_SYSCTL=y +CONFIG_QUOTA=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SHMEM=y +CONFIG_SIGNALFD=y +CONFIG_SMP=y +CONFIG_SYN_COOKIES=y +CONFIG_SYSFS_DEPRECATED=n +CONFIG_SYSFS_SYSCALL=y +CONFIG_SYSFS=y +CONFIG_SYSVIPC=y +CONFIG_TIMERFD=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TRANSPARENT_HUGEPAGE=y +CONFIG_TTY=y +CONFIG_UNIX98_PTYS=y +CONFIG_UNIX_DIAG=y +CONFIG_USB_SUPPORT=y +CONFIG_VFAT_FS=y +CONFIG_VIRTIO_INPUT=y +CONFIG_VT=y +CONFIG_XFS_SUPPORT_ASCII_CI=y +CONFIG_ZONE_DMA=y diff --git a/playbooks/roles/bootlinux/templates/fragments/ebpf-errorinj.config b/playbooks/roles/bootlinux/templates/fragments/ebpf-errorinj.config new file mode 100644 index 000000000..5e132d936 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/ebpf-errorinj.config @@ -0,0 +1,2 @@ +CONFIG_BPF_KPROBE_OVERRIDE=y +CONFIG_FUNCTION_ERROR_INJECTION=y diff --git a/playbooks/roles/bootlinux/templates/fragments/ebpf.config b/playbooks/roles/bootlinux/templates/fragments/ebpf.config new file mode 100644 index 000000000..2d393735e --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/ebpf.config @@ -0,0 +1,61 @@ +# eBPF +# DOCS: +# https://github.com/iovisor/bcc/blob/master/docs/kernel_config.md +# https://github.com/iovisor/bcc/blob/master/INSTALL.md#kernel-configuration +CONFIG_BPF=y +CONFIG_BPFILTER=y +CONFIG_BPFILTER_UMH=y +CONFIG_BPF_EVENTS=y +CONFIG_BPF_JIT=y +CONFIG_BPF_JIT_ALWAYS_ON=y +CONFIG_BPF_LIRC_MODE2=y +CONFIG_BPF_LSM=y +CONFIG_BPF_STREAM_PARSER=y +CONFIG_BPF_SYSCALL=y +CONFIG_CGROUP_BPF=y +CONFIG_DEBUG_INFO_BTF=y # macos sdk error +CONFIG_DEBUG_INFO_REDUCED=n +CONFIG_DUMMY=y +CONFIG_DYNAMIC_FTRACE=y +CONFIG_FTRACE=y # Required by CONFIG_BPF_EVENTS +CONFIG_FTRACE_SYSCALLS=y +CONFIG_FUNCTION_GRAPH_TRACER=y +CONFIG_FUNCTION_TRACER=y +CONFIG_IKHEADERS=y +CONFIG_IPV6_SEG6_LWTUNNEL=y +CONFIG_KPROBES=y +CONFIG_KPROBE_EVENTS=y # Required by CONFIG_BPF_EVENTS +CONFIG_LIRC=y +CONFIG_LWTUNNEL_BPF=y +CONFIG_MODULES=y # Required by CONFIG_BPF_JIT +CONFIG_NETFILTER_XTABLES=y +CONFIG_NETFILTER_XT_MATCH_BPF=y +CONFIG_NET_ACT_BPF=y +CONFIG_NET_ACT_GACT=y +CONFIG_NET_ACT_POLICE=y +CONFIG_NET_CLS_ACT=y +CONFIG_NET_CLS_BPF=y +CONFIG_NET_SCHED=y +CONFIG_NET_SCH_SFQ=y +CONFIG_PERF_EVENTS=y # Required by CONFIG_BPF_EVENTS +CONFIG_PROFILING=y +CONFIG_RC_CORE=y +CONFIG_SECURITY=y +CONFIG_STACK_TRACER=y +CONFIG_UPROBE_EVENTS=y # Required by CONFIG_BPF_EVENTS +CONFIG_VXLAN=y +CONFIG_NET=y # Required by CONFIG_BPFILTER and CONFIG_IPV6_SEG6_LWTUNNEL +CONFIG_INET=y # Required by CONFIG_BPFILTER and CONFIG_IPV6_SEG6_LWTUNNEL +CONFIG_RC_CORE=y # Required by CONFIG_BPF_LIRC_MODE2 +CONFIG_LIRC=y # Required by CONFIG_BPF_LIRC_MODE2 +CONFIG_INPUT=y # Required by CONFIG_BPF_LIRC_MODE2 +CONFIG_SECURITY=y # Required by BPF_LSM +CONFIG_SYSFS=y # Required by CONFIG_SECURITY and CONFIG_IKHEADERS +CONFIG_MULTIUSER=y # Required by CONFIG_SECURITY +CONFIG_CGROUPS=y # Required by CONFIG_CGROUP_BPF +CONFIG_DEBUG_INFO=y # Required by CONFIG_DEBUG_INFO_BTF +CONFIG_DEBUG_INFO_SPLIT=n # Required by CONFIG_DEBUG_INFO_BTF +CONFIG_DEBUG_INFO_REDUCED=n # Required by CONFIG_DEBUG_INFO_BTF +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y # Required by CONFIG_DEBUG_INFO_BTF (CONFIG_DEBUG_INFO_DWARF5) +CONFIG_NETDEVICES=y # Required by CONFIG_DUMMY +CONFIG_NET_CORE=y # Required by CONFIG_DUMMY diff --git a/playbooks/roles/bootlinux/templates/fragments/gdb.config b/playbooks/roles/bootlinux/templates/fragments/gdb.config new file mode 100644 index 000000000..e95cf9ce4 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/gdb.config @@ -0,0 +1,6 @@ +# Debugging kernel and modules via gdb +# DOCS: https://docs.kernel.org/process/debugging/gdb-kernel-debugging.html +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y +CONFIG_DEBUG_INFO_REDUCED=n +CONFIG_GDB_SCRIPTS=y diff --git a/playbooks/roles/bootlinux/templates/fragments/initramfs.config b/playbooks/roles/bootlinux/templates/fragments/initramfs.config new file mode 100644 index 000000000..f80daba7b --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/initramfs.config @@ -0,0 +1,22 @@ +# Initial RAM disk support +CONFIG_BLK_DEV_INITRD=y + +# Compression support for initramfs +CONFIG_RD_GZIP=y +CONFIG_RD_BZIP2=y +CONFIG_RD_LZMA=y +CONFIG_RD_XZ=y +CONFIG_RD_LZO=y +CONFIG_RD_LZ4=y +CONFIG_RD_ZSTD=y + +# Kernel compression algorithms needed for initramfs +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZSTD_DECOMPRESS=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_XZ_DEC=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_COMPRESS=y +CONFIG_LZ4_DECOMPRESS=y diff --git a/playbooks/roles/bootlinux/templates/fragments/kmemleak.config b/playbooks/roles/bootlinux/templates/fragments/kmemleak.config new file mode 100644 index 000000000..9e07bad2b --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/kmemleak.config @@ -0,0 +1,3 @@ +CONFIG_DEBUG_KMEMLEAK=y +CONFIG_SAMPLES=y +CONFIG_SAMPLE_KMEMLEAK=m diff --git a/playbooks/roles/bootlinux/templates/fragments/ksm.config b/playbooks/roles/bootlinux/templates/fragments/ksm.config new file mode 100644 index 000000000..757efcb90 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/ksm.config @@ -0,0 +1 @@ +CONFIG_KSM=y diff --git a/playbooks/roles/bootlinux/templates/fragments/localauto.config b/playbooks/roles/bootlinux/templates/fragments/localauto.config new file mode 100644 index 000000000..6276cf0a9 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/localauto.config @@ -0,0 +1,2 @@ +CONFIG_COMPILE_TEST=n +CONFIG_LOCALVERSION_AUTO=y diff --git a/playbooks/roles/bootlinux/templates/fragments/moby.config b/playbooks/roles/bootlinux/templates/fragments/moby.config new file mode 100644 index 000000000..38d45d4ae --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/moby.config @@ -0,0 +1,9 @@ +# Moby (docker open source) +# https://github.com/moby/moby/blob/master/contrib/check-config.sh +CONFIG_BRIDGE_NETFILTER=y +CONFIG_BRIDGE=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_IP_VS=y +CONFIG_NF_CONNTRACK=y +CONFIG_OVERLAY_FS=y +CONFIG_NF_TABLES=y diff --git a/playbooks/roles/bootlinux/templates/fragments/modules-blk.config b/playbooks/roles/bootlinux/templates/fragments/modules-blk.config new file mode 100644 index 000000000..3cb3e5c85 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/modules-blk.config @@ -0,0 +1,2 @@ +CONFIG_BLK_DEV_RAM=m +CONFIG_BLK_DEV_LOOP=m diff --git a/playbooks/roles/bootlinux/templates/fragments/modules-extended-modversions.config b/playbooks/roles/bootlinux/templates/fragments/modules-extended-modversions.config new file mode 100644 index 000000000..8e57d4909 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/modules-extended-modversions.config @@ -0,0 +1,2 @@ +CONFIG_MODVERSIONS=y +CONFIG_EXTENDED_MODVERSIONS=y diff --git a/playbooks/roles/bootlinux/templates/fragments/modules-modversions.config b/playbooks/roles/bootlinux/templates/fragments/modules-modversions.config new file mode 100644 index 000000000..6119c683c --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/modules-modversions.config @@ -0,0 +1 @@ +CONFIG_MODVERSIONS=y diff --git a/playbooks/roles/bootlinux/templates/fragments/modules-testing.config b/playbooks/roles/bootlinux/templates/fragments/modules-testing.config new file mode 100644 index 000000000..59a229dd4 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/modules-testing.config @@ -0,0 +1,3 @@ +CONFIG_TEST_KALLSYMS=m +CONFIG_TEST_KMOD=m +CONFIG_XFS_FS=m diff --git a/playbooks/roles/bootlinux/templates/fragments/modules.config b/playbooks/roles/bootlinux/templates/fragments/modules.config new file mode 100644 index 000000000..42abd6867 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/modules.config @@ -0,0 +1,15 @@ +CONFIG_MODULES=y +CONFIG_MODULE_DEBUG=y +CONFIG_MODULE_STATS=y +CONFIG_MODULE_DEBUG_AUTOLOAD_DUPS=n +CONFIG_MODULE_FORCE_LOAD=n +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=n +CONFIG_MODULE_UNLOAD_TAINT_TRACKING=y +CONFIG_MODVERSIONS=n +CONFIG_MODULE_SRCVERSION_ALL=n +CONFIG_MODULE_SIG=n +CONFIG_MODULE_COMPRESS=n +CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=n +CONFIG_MODPROBE_PATH=/sbin/modprobe +CONFIG_TRIM_UNUSED_KSYMS=n diff --git a/playbooks/roles/bootlinux/templates/fragments/numa.config b/playbooks/roles/bootlinux/templates/fragments/numa.config new file mode 100644 index 000000000..a7a4edf59 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/numa.config @@ -0,0 +1,2 @@ +CONFIG_SMP=y +CONFIG_NUMA=y diff --git a/playbooks/roles/bootlinux/templates/fragments/storage.config b/playbooks/roles/bootlinux/templates/fragments/storage.config new file mode 100644 index 000000000..da2b46aad --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/storage.config @@ -0,0 +1,11 @@ +CONFIG_BLK_DEV_NULL_BLK=y +CONFIG_BLK_DEV_NVME=y +CONFIG_COMPILE_TEST=y +CONFIG_CONFIGFS_FS=y +CONFIG_DEBUG_FS=y +CONFIG_DNOTIFY=y +CONFIG_EXFAT_FS=y +CONFIG_FUSE_FS=y +CONFIG_HUGETLBFS=y +CONFIG_IO_URING=y +CONFIG_NVME_VERBOSE_ERRORS=y diff --git a/playbooks/roles/bootlinux/templates/fragments/systemd.config b/playbooks/roles/bootlinux/templates/fragments/systemd.config new file mode 100644 index 000000000..be0094619 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/systemd.config @@ -0,0 +1,78 @@ +# systemd +# DOCS: https://github.com/systemd/systemd/blob/main/README +CONFIG_AUDIT=n +CONFIG_AUTOFS_FS=y +CONFIG_SCSI=y # Required by CONFIG_BLK_DEV_BSG +CONFIG_BLK_DEV_BSG=y +#CONFIG_BPF=y +#CONFIG_MODULES=y # Required by CONFIG_BPF_JIT +#CONFIG_BPF_JIT=y +#CONFIG_PERF_EVENTS=y # Required by CONFIG_BPF_EVENTS +#CONFIG_UPROBE_EVENTS=y # Required by CONFIG_BPF_EVENTS +#CONFIG_KPROBE_EVENTS=y # Required by CONFIG_BPF_EVENTS +#CONFIG_FTRACE=y # Required by CONFIG_BPF_EVENTS +#CONFIG_BPF_EVENTS=y +#CONFIG_BPF_LSM=y +#CONFIG_BPF_SYSCALL=y +CONFIG_BTRFS_FS=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_CGROUPS=y +#CONFIG_CGROUP_BPF=y +CONFIG_CGROUP_SCHED=y +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y # Required by CONFIG_DEBUG_INFO +CONFIG_DEBUG_INFO=y # Required for CONFIG_DEBUG_INFO_BTF +#CONFIG_DEBUG_INFO_BTF=y +CONFIG_DEVTMPFS=y +CONFIG_DMI=y # Required by CONFIG_DMIID +CONFIG_DMIID=y +CONFIG_SECONDARY_TRUSTED_KEYRING=y # Required by CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING +CONFIG_BLK_DEV_DM=y # Required by CONFIG_DM_VERITY +CONFIG_MD=y # Required by CONFIG_DM_VERITY +CONFIG_DM_VERITY=y # Required by CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG +CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y +CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING=y +CONFIG_EFI=y # Required for CONFIG_EFIVAR_FS +CONFIG_EFIVAR_FS=y +CONFIG_EFI_PARTITION=y +CONFIG_EPOLL=y +CONFIG_EXT4_FS=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_FHANDLE=y +CONFIG_9P_FS_POSIX_ACL=y +CONFIG_FS_POSIX_ACL=y +CONFIG_EXT4_FS_POSIX_ACL=y # Selects FS_POSIX_ACL +CONFIG_XFS_POSIX_ACL=y # Selects FS_POSIX_ACL +CONFIG_BTRFS_FS_POSIX_ACL=y # Selects FS_POSIX_ACL +CONFIG_FW_LOADER_USER_HELPER=n +CONFIG_HAVE_EBPF_JIT=y +CONFIG_INTEGRITY_SIGNATURE=y # Required for CONFIG_INTEGRITY_ASYMMETRIC_KEYS +CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y # Required for CONFIG_IMA_ARCH_POLICY +CONFIG_SECURITY=y # Required for CONFIG_INTEGRITY +CONFIG_INTEGRITY=y +CONFIG_IMA=y # Required by CONFIG_IMA_ARCH_POLICY +CONFIG_IMA_APPRAISE=y # Required by CONFIG_IMA_ARCH_POLICY +CONFIG_IMA_ARCH_POLICY=y +CONFIG_INOTIFY_USER=y +#CONFIG_INTEGRITY_MACHINE_KEYRING=y +CONFIG_IPV6=y +CONFIG_KCMP=y +CONFIG_NET=y +CONFIG_NET_NS=y +CONFIG_PROC_FS=y +CONFIG_PSI=y +CONFIG_RT_GROUP_SCHED=n +CONFIG_SECCOMP=y +CONFIG_SECCOMP_FILTER=y +CONFIG_SIGNALFD=y +CONFIG_SYSFS=y +CONFIG_SYSFS_DEPRECATED=n +CONFIG_TIMERFD=y +CONFIG_SHMEM=y # Required for CONFIG_TMPFS +CONFIG_TMPFS=y +CONFIG_TMPFS_XATTR=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_UNIX=y +CONFIG_MULTIUSER=y # Required for CONFIG_NAMESPACES +CONFIG_NAMESPACES=y # Required for CONFIG_USER_NS +CONFIG_USER_NS=y +CONFIG_XFS_FS=y diff --git a/playbooks/roles/bootlinux/templates/fragments/virtio-fs.config b/playbooks/roles/bootlinux/templates/fragments/virtio-fs.config new file mode 100644 index 000000000..df3910825 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/virtio-fs.config @@ -0,0 +1,15 @@ +#CONFIG_VIRTIO_MMIO=y +# virtio-fs +# DOCS: https://virtio-fs.gitlab.io/howto-qemu.html +CONFIG_DAX=y +#CONFIG_DAX_DRIVER=y # Deprecated by afd586f0d06c ("dax: remove CONFIG_DAX_DRIVER") +CONFIG_FS_DAX=y +CONFIG_FUSE_FS=y # Required for VIRTIO_FS +CONFIG_MEMORY_HOTPLUG=y # Required by CONFIG_ZONE_DEVICE +CONFIG_MEMORY_HOTREMOVE=y # Required by CONFIG_ZONE_DEVICE +CONFIG_SPARSEMEM_VMEMMAP=y # Required by CONFIG_ZONE_DEVICE +CONFIG_MIGRATION=y # Required for CONFIG_MEMORY_HOTREMOVE=y +CONFIG_MMU=y # Required by CONFIG_FS_DAX +CONFIG_VIRTIO=y +CONFIG_VIRTIO_FS=y +CONFIG_ZONE_DEVICE=y # Required by CONFIG_FS_DAX diff --git a/playbooks/roles/bootlinux/templates/fragments/vm_debug.config b/playbooks/roles/bootlinux/templates/fragments/vm_debug.config new file mode 100644 index 000000000..d19bdfddb --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/vm_debug.config @@ -0,0 +1 @@ +CONFIG_DEBUG_VM=y diff --git a/playbooks/roles/bootlinux/templates/fragments/xarray.config b/playbooks/roles/bootlinux/templates/fragments/xarray.config new file mode 100644 index 000000000..5474e5f9a --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/xarray.config @@ -0,0 +1,6 @@ +CONFIG_TEST_XARRAY=m +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_DEBUG_VM_PGFLAGS=y +CONFIG_DEBUG_VM=y +CONFIG_RUNTIME_TESTING_MENU=y # Required for CONFIG_TEST_XARRAY diff --git a/playbooks/roles/bootlinux/templates/fragments/xarray_no_multi.config b/playbooks/roles/bootlinux/templates/fragments/xarray_no_multi.config new file mode 100644 index 000000000..456dc6089 --- /dev/null +++ b/playbooks/roles/bootlinux/templates/fragments/xarray_no_multi.config @@ -0,0 +1,9 @@ +CONFIG_TEST_XARRAY=m +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_DEBUG_VM_PGFLAGS=y +CONFIG_DEBUG_VM=y +CONFIG_RUNTIME_TESTING_MENU=y # Required for CONFIG_TEST_XARRAY +CONFIG_XARRAY_MULTI=n +CONFIG_TRANSPARENT_HUGEPAGE=n +CONFIG_PREEMPT_RT=n diff --git a/workflows/linux/Kconfig b/workflows/linux/Kconfig index 1b0570426..c0534ae42 100644 --- a/workflows/linux/Kconfig +++ b/workflows/linux/Kconfig @@ -171,6 +171,123 @@ config BOOTLINUX_COMPILER_CLANG endchoice +config BOOTLINUX_REPRODUCIBLE_BUILDS + bool "Enable reproducible builds" + output yaml + default n + help + Enable reproducible builds by setting deterministic environment + variables during kernel compilation. This ensures identical + binaries are produced from the same source code. + + When enabled, sets: + - KBUILD_BUILD_TIMESTAMP='' (empty for deterministic timestamps) + - KBUILD_BUILD_USER='kdevops' + - KBUILD_BUILD_HOST='kdevops' + + Recommended for CI/CD environments and when build reproducibility + is required. Compatible with both GCC and Clang toolchains. + +config BOOTLINUX_CLEAN_BEFORE_BUILD + bool "Clean kernel source before building (make mrproper)" + output yaml + default n + help + If enabled, run 'make mrproper' before kernel configuration and + building. This ensures a completely clean build from pristine + source code by removing all configuration files, build artifacts, + and generated files. + + Enable this for: + - Deterministic, reproducible builds + - Debugging configuration issues + - Ensuring no stale artifacts interfere + + Disable this for: + - Faster incremental builds during development + - Preserving existing .config when not using fragments + + Note: This adds significant build time as all objects must be + rebuilt from scratch. + +menu "ccache configuration" + +config BOOTLINUX_CCACHE + bool "Enable ccache for faster kernel builds" + output yaml + default n + help + Enable ccache (compiler cache) to accelerate repeated kernel + builds by caching compilation results. Particularly effective + for incremental builds and CI/CD environments. + + When enabled with Clang (LLVM=1), uses CC="ccache clang". + When enabled with GCC, uses CC="ccache gcc". + + Requires ccache package to be installed on build nodes. + +choice + prompt "ccache configuration mode" + depends on BOOTLINUX_CCACHE + default BOOTLINUX_CCACHE_SYSTEM_WIDE + help + Choose how ccache configuration is managed. + +config BOOTLINUX_CCACHE_SYSTEM_WIDE + bool "Use system-wide ccache configuration" + output yaml + help + Use the system's existing ccache configuration + (~/.cache/ccache or system defaults). Allows manual + tuning via "ccache --set-config" commands. + +config BOOTLINUX_CCACHE_KDEVOPS_MANAGED + bool "kdevops-managed ccache configuration" + output yaml + help + kdevops generates and manages a project-specific ccache + configuration file using TOPDIR_PATH. This ensures + isolation from system-wide ccache settings and allows + project-specific tuning. + + Configuration location: $(TOPDIR_PATH)/.ccache/ccache.conf + +endchoice + +if BOOTLINUX_CCACHE_KDEVOPS_MANAGED + +config BOOTLINUX_CCACHE_MAX_SIZE + int "Maximum cache size (GiB)" + output yaml + default 10 + help + Maximum size for the ccache in GiB. Common values: + - 5 (default ccache setting) + - 10 (recommended for kernel development) + - 20 (large projects/multiple kernels) + - 50 (high-performance development environments) + +config BOOTLINUX_CCACHE_DIR + string "Cache directory" + output yaml + default "$(TOPDIR_PATH)/.ccache/cache" + help + Directory where ccache stores cached compilation results. + Using TOPDIR_PATH ensures project isolation. + +config BOOTLINUX_CCACHE_COMPRESSION + bool "Enable compression" + output yaml + default y + help + Enable compression of cached files to save disk space. + Slightly increases CPU usage but significantly reduces + storage requirements. + +endif # BOOTLINUX_CCACHE_KDEVOPS_MANAGED + +endmenu + 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 @@ -466,4 +583,6 @@ endif # BOOTLINUX_AB_DIFFERENT_REF endif # KDEVOPS_BASELINE_AND_DEV +source "workflows/linux/Kconfig.fragments" + endif # BOOTLINUX diff --git a/workflows/linux/Kconfig.fragments b/workflows/linux/Kconfig.fragments new file mode 100644 index 000000000..6d99885a6 --- /dev/null +++ b/workflows/linux/Kconfig.fragments @@ -0,0 +1,26 @@ +config BOOTLINUX_USE_CONFIG_FRAGMENTS + bool "Use kernel configuration fragments" + output yaml + help + Enable this to build the kernel using configuration fragments + instead of a monolithic configuration file. This allows you to + compose kernel configurations from smaller, focused fragments. + + When enabled, the kernel configuration will be built using + merge_config.sh with selected fragments from both upstream + kernel sources and kdevops templates. + +if BOOTLINUX_USE_CONFIG_FRAGMENTS + +source "workflows/linux/fragments/Kconfig.essential" +source "workflows/linux/fragments/Kconfig.security" +source "workflows/linux/fragments/Kconfig.arch" +source "workflows/linux/fragments/Kconfig.development" +source "workflows/linux/fragments/Kconfig.memory" +source "workflows/linux/fragments/Kconfig.modules" +source "workflows/linux/fragments/Kconfig.advanced" +source "workflows/linux/fragments/Kconfig.container" +source "workflows/linux/fragments/Kconfig.specialized" +source "workflows/linux/fragments/Kconfig.legacy" + +endif # BOOTLINUX_USE_CONFIG_FRAGMENTS diff --git a/workflows/linux/fragments/Kconfig.advanced b/workflows/linux/fragments/Kconfig.advanced new file mode 100644 index 000000000..05d5bc669 --- /dev/null +++ b/workflows/linux/fragments/Kconfig.advanced @@ -0,0 +1,27 @@ +menu "Advanced features" + +config BOOTLINUX_FRAGMENT_EBPF + bool "eBPF support (kdevops: ebpf.config)" + output yaml + help + Enable extended Berkeley Packet Filter support. + +config BOOTLINUX_FRAGMENT_EBPF_ERRORINJ + bool "eBPF error injection (kdevops: ebpf-errorinj.config)" + output yaml + help + Enable eBPF-based error injection capabilities for testing. + +config BOOTLINUX_FRAGMENT_XARRAY + bool "XArray data structure support (kdevops: xarray.config)" + output yaml + help + Enable XArray data structure support in the kernel. + +config BOOTLINUX_FRAGMENT_XARRAY_NO_MULTI + bool "XArray without multi-index (kdevops: xarray_no_multi.config)" + output yaml + help + Enable XArray support but disable multi-index functionality. + +endmenu diff --git a/workflows/linux/fragments/Kconfig.arch b/workflows/linux/fragments/Kconfig.arch new file mode 100644 index 000000000..1a3836669 --- /dev/null +++ b/workflows/linux/fragments/Kconfig.arch @@ -0,0 +1,30 @@ +menu "Architecture-specific configuration" + +choice + prompt "ARM64 page size configuration" + depends on TARGET_ARCH_ARM64 + default BOOTLINUX_FRAGMENT_ARM64_4K_PAGES + help + Choose the page size configuration for ARM64. + +config BOOTLINUX_FRAGMENT_ARM64_4K_PAGES + bool "4KB pages (kdevops: arm64_4k_pages.config)" + output yaml + help + Use 4KB page size (default for most systems). + +config BOOTLINUX_FRAGMENT_ARM64_16K_PAGES + bool "16KB pages (kdevops: arm64_16k_pages.config)" + output yaml + help + Use 16KB page size for better performance in some workloads. + +config BOOTLINUX_FRAGMENT_ARM64_64K_PAGES + bool "64KB pages (kdevops: arm64_64k_pages.config)" + output yaml + help + Use 64KB page size for high-performance computing workloads. + +endchoice + +endmenu diff --git a/workflows/linux/fragments/Kconfig.container b/workflows/linux/fragments/Kconfig.container new file mode 100644 index 000000000..c3f0460ef --- /dev/null +++ b/workflows/linux/fragments/Kconfig.container @@ -0,0 +1,15 @@ +menu "Container and virtualization" + +config BOOTLINUX_FRAGMENT_XEN + bool "Xen guest support (upstream: xen.config)" + output yaml + help + Use the upstream xen.config fragment to enable Xen hypervisor support. + +config BOOTLINUX_FRAGMENT_MOBY + bool "Container/Moby support (kdevops: moby.config)" + output yaml + help + Enable kernel features required for container runtimes like Moby/Docker. + +endmenu diff --git a/workflows/linux/fragments/Kconfig.development b/workflows/linux/fragments/Kconfig.development new file mode 100644 index 000000000..9f9968b84 --- /dev/null +++ b/workflows/linux/fragments/Kconfig.development @@ -0,0 +1,28 @@ +menu "Development and debugging" + +config BOOTLINUX_FRAGMENT_DEBUG + bool "Kernel debugging features (upstream: debug.config)" + output yaml + help + Use the upstream debug.config fragment to enable various kernel debugging + and diagnostic features. + +config BOOTLINUX_FRAGMENT_GDB + bool "Kernel GDB support (kdevops: gdb.config)" + output yaml + help + Enable kernel debugging via GDB. + +config BOOTLINUX_FRAGMENT_VM_DEBUG + bool "Virtual memory debugging (kdevops: vm_debug.config)" + output yaml + help + Enable virtual memory debugging features. + +config BOOTLINUX_FRAGMENT_BLKTRACE + bool "Block I/O tracing support (kdevops: blktrace.config)" + output yaml + help + Enable block layer tracing and debugging capabilities. + +endmenu diff --git a/workflows/linux/fragments/Kconfig.essential b/workflows/linux/fragments/Kconfig.essential new file mode 100644 index 000000000..78d080731 --- /dev/null +++ b/workflows/linux/fragments/Kconfig.essential @@ -0,0 +1,63 @@ +menu "Essential kernel configuration" + +config BOOTLINUX_FRAGMENT_64BIT + bool "64-bit architecture optimizations (kdevops: 64bit.config)" + default y + output yaml + help + Enable 64-bit specific optimizations and features. + +config BOOTLINUX_FRAGMENT_KVM_GUEST + bool "KVM guest optimizations (upstream: kvm_guest.config)" + default y + output yaml + help + Use the upstream kvm_guest.config fragment to enable optimizations for + running the kernel as a KVM guest. + +config BOOTLINUX_FRAGMENT_VIRTIO_FS + bool "VirtIO filesystem support (kdevops: virtio-fs.config)" + default y + output yaml + help + Enable VirtIO filesystem support for virtualized environments. + +config BOOTLINUX_FRAGMENT_SYSTEMD + bool "systemd support (kdevops: systemd.config)" + default y + output yaml + help + Enable kernel features required by systemd init system. + +config BOOTLINUX_FRAGMENT_DISTRO + bool "Distribution kernel features (kdevops: distro.config)" + default y + output yaml + help + Enable features commonly needed by Linux distributions. + +config BOOTLINUX_FRAGMENT_STORAGE + bool "Storage and filesystem features (kdevops: storage.config)" + default y + output yaml + help + Enable advanced storage and filesystem features. + +config BOOTLINUX_FRAGMENT_INITRAMFS + bool "Initial RAM disk support (kdevops: initramfs.config)" + default y + output yaml + help + Enable initramfs (initial RAM disk) support with compression + algorithms. This is essential for most Linux distributions + and is needed for generating initrd images during kernel + installation. + +config BOOTLINUX_FRAGMENT_LOCALAUTO + bool "Local version auto generation (kdevops: localauto.config)" + default y + output yaml + help + Automatically generate local version strings with git information. + +endmenu diff --git a/workflows/linux/fragments/Kconfig.legacy b/workflows/linux/fragments/Kconfig.legacy new file mode 100644 index 000000000..87f0f754b --- /dev/null +++ b/workflows/linux/fragments/Kconfig.legacy @@ -0,0 +1,9 @@ +menu "Legacy and compatibility" + +config BOOTLINUX_FRAGMENT_BUFFER_HEAD + bool "Buffer head support (kdevops: buffer_head.config)" + output yaml + help + Enable buffer head infrastructure for filesystem operations. + +endmenu diff --git a/workflows/linux/fragments/Kconfig.memory b/workflows/linux/fragments/Kconfig.memory new file mode 100644 index 000000000..d6fbcb910 --- /dev/null +++ b/workflows/linux/fragments/Kconfig.memory @@ -0,0 +1,15 @@ +menu "Memory management" + +config BOOTLINUX_FRAGMENT_NUMA + bool "NUMA support (kdevops: numa.config)" + output yaml + help + Enable Non-Uniform Memory Access support. + +config BOOTLINUX_FRAGMENT_KSM + bool "Kernel Samepage Merging (kdevops: ksm.config)" + output yaml + help + Enable KSM for memory deduplication in virtualized environments. + +endmenu diff --git a/workflows/linux/fragments/Kconfig.modules b/workflows/linux/fragments/Kconfig.modules new file mode 100644 index 000000000..e64673b13 --- /dev/null +++ b/workflows/linux/fragments/Kconfig.modules @@ -0,0 +1,46 @@ +menu "Module and extensibility" + +config BOOTLINUX_FRAGMENT_MODULES + bool "Enhanced module support (kdevops: modules.config)" + output yaml + help + Enable advanced kernel module features. + +config BOOTLINUX_FRAGMENT_MODULES_BLK + bool "Block layer module support (kdevops: modules-blk.config)" + depends on BOOTLINUX_FRAGMENT_MODULES + output yaml + help + Enhanced block layer module support and debugging. + +config BOOTLINUX_FRAGMENT_MODULES_MODVERSIONS + bool "Standard module versioning (kdevops: modules-modversions.config)" + depends on BOOTLINUX_FRAGMENT_MODULES + output yaml + help + Enable standard module versioning support for module compatibility checking. + +config BOOTLINUX_FRAGMENT_MODULES_EXTENDED_MODVERSIONS + bool "Extended module versioning (kdevops: modules-extended-modversions.config)" + depends on BOOTLINUX_FRAGMENT_MODULES + output yaml + help + Enable extended module versioning support for long symbol names. + Required for Rust support and advanced module versioning. + +config BOOTLINUX_FRAGMENT_MODULES_TESTING + bool "Module testing support (kdevops: modules-testing.config)" + depends on BOOTLINUX_FRAGMENT_MODULES + output yaml + help + Enable kernel module testing features including kallsyms and kmod tests. + +config BOOTLINUX_FRAGMENT_KMEMLEAK + bool "Kernel memory leak detection (kdevops: kmemleak.config)" + depends on BOOTLINUX_FRAGMENT_MODULES + output yaml + help + Enable kernel memory leak detection and sample module for debugging + memory leaks in kernel code. + +endmenu diff --git a/workflows/linux/fragments/Kconfig.security b/workflows/linux/fragments/Kconfig.security new file mode 100644 index 000000000..e79f35847 --- /dev/null +++ b/workflows/linux/fragments/Kconfig.security @@ -0,0 +1,10 @@ +menu "Security and hardening" + +config BOOTLINUX_FRAGMENT_HARDENING + bool "Security hardening options (upstream: hardening.config)" + output yaml + help + Use the upstream hardening.config fragment to enable kernel security + hardening features. + +endmenu diff --git a/workflows/linux/fragments/Kconfig.specialized b/workflows/linux/fragments/Kconfig.specialized new file mode 100644 index 000000000..444c05994 --- /dev/null +++ b/workflows/linux/fragments/Kconfig.specialized @@ -0,0 +1,23 @@ +menu "Specialized kernel variants" + +config BOOTLINUX_FRAGMENT_TINY + bool "Tiny kernel configuration (upstream: tiny.config)" + output yaml + help + Use the upstream tiny.config fragment from the kernel sources. + This enables CONFIG_EMBEDDED and other options for minimal kernels. + +config BOOTLINUX_FRAGMENT_NOPM + bool "Disable power management (upstream: nopm.config)" + output yaml + help + Use the upstream nopm.config fragment to disable power management features. + +config BOOTLINUX_FRAGMENT_RUST + bool "Rust language support (upstream: rust.config)" + output yaml + help + Use the upstream rust.config fragment to enable Rust programming language + support in the kernel. + +endmenu