From 3f5d0796f27257f8d20767bcef30db6a70756960 Mon Sep 17 00:00:00 2001 From: Mathieu Tarral Date: Thu, 18 Apr 2024 05:54:43 -0700 Subject: [PATCH] kernel: fix --- .../roles/kernel/tasks/install_kernel_CentOS.yml | 0 ...install_kernel.yml => install_kernel_Ubuntu.yml} | 13 +++---------- deploy/intellabs/kafl/roles/kernel/tasks/main.yml | 10 +++++----- deploy/intellabs/kafl/roles/kernel/vars/CentOS.yml | 2 ++ deploy/intellabs/kafl/roles/kernel/vars/Ubuntu.yml | 6 ++++++ deploy/intellabs/kafl/roles/qemu/vars/Ubuntu.yml | 1 - 6 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 deploy/intellabs/kafl/roles/kernel/tasks/install_kernel_CentOS.yml rename deploy/intellabs/kafl/roles/kernel/tasks/{install_kernel.yml => install_kernel_Ubuntu.yml} (87%) create mode 100644 deploy/intellabs/kafl/roles/kernel/vars/CentOS.yml create mode 100644 deploy/intellabs/kafl/roles/kernel/vars/Ubuntu.yml diff --git a/deploy/intellabs/kafl/roles/kernel/tasks/install_kernel_CentOS.yml b/deploy/intellabs/kafl/roles/kernel/tasks/install_kernel_CentOS.yml new file mode 100644 index 00000000..e69de29b diff --git a/deploy/intellabs/kafl/roles/kernel/tasks/install_kernel.yml b/deploy/intellabs/kafl/roles/kernel/tasks/install_kernel_Ubuntu.yml similarity index 87% rename from deploy/intellabs/kafl/roles/kernel/tasks/install_kernel.yml rename to deploy/intellabs/kafl/roles/kernel/tasks/install_kernel_Ubuntu.yml index 8ad8a46a..15b6bf4d 100644 --- a/deploy/intellabs/kafl/roles/kernel/tasks/install_kernel.yml +++ b/deploy/intellabs/kafl/roles/kernel/tasks/install_kernel_Ubuntu.yml @@ -1,22 +1,15 @@ -- name: Install dependencies - ansible.builtin.package: - name: - - linux-base - - kmod - become: true - - name: Create temporary directory for downloaded packages ansible.builtin.tempfile: state: directory register: down_dir check_mode: false -- name: Download deb packages +- name: Download pre-built packages ansible.builtin.get_url: url: "{{ item }}" - dest: "{{ down_dir.path }}/{{ index }}.deb" + dest: "{{ down_dir.path }}/{{ index }}" mode: 0644 - loop: "{{ kernel_deb_urls }}" + loop: "{{ kernel_urls }}" loop_control: index_var: index diff --git a/deploy/intellabs/kafl/roles/kernel/tasks/main.yml b/deploy/intellabs/kafl/roles/kernel/tasks/main.yml index 7e6c0ed6..a8b40642 100644 --- a/deploy/intellabs/kafl/roles/kernel/tasks/main.yml +++ b/deploy/intellabs/kafl/roles/kernel/tasks/main.yml @@ -1,11 +1,11 @@ +- include_vars: "{{ ansible_distribution }}.yml" + - name: Import pre_tasks ansible.builtin.import_tasks: pre_tasks.yml - name: Install required dependencies ansible.builtin.package: - name: - - build-essential - - dpkg + name: "{{ packages }}" become: true - name: Create temporary directory @@ -22,7 +22,7 @@ check_mode: false - name: Compile support_test.c - ansible.builtin.command: | + ansible.builtin.shell: | gcc "{{ temp_compile.path }}/support_test.c" -o "{{ temp_compile.path }}/support_test" register: compile_result changed_when: false @@ -46,5 +46,5 @@ # check if hardware_check in skip-tags -> to force CI run - name: Install kernel if needed - ansible.builtin.import_tasks: install_kernel.yml + ansible.builtin.include_tasks: install_kernel_{{ ansible_distribution }}.yml when: "'update_grub' in ansible_run_tags or 'hardware_check' in ansible_skip_tags or support_test.rc != 0" diff --git a/deploy/intellabs/kafl/roles/kernel/vars/CentOS.yml b/deploy/intellabs/kafl/roles/kernel/vars/CentOS.yml new file mode 100644 index 00000000..0c3c8f88 --- /dev/null +++ b/deploy/intellabs/kafl/roles/kernel/vars/CentOS.yml @@ -0,0 +1,2 @@ +packages: +kernel_urls: \ No newline at end of file diff --git a/deploy/intellabs/kafl/roles/kernel/vars/Ubuntu.yml b/deploy/intellabs/kafl/roles/kernel/vars/Ubuntu.yml new file mode 100644 index 00000000..bf69e82a --- /dev/null +++ b/deploy/intellabs/kafl/roles/kernel/vars/Ubuntu.yml @@ -0,0 +1,6 @@ +packages: + - dpkg + - linux-base + - kmod +kernel_urls: + - https://github.com/IntelLabs/kafl.linux/releases/download/kvm-nyx-v6.0/linux-image-6.0.0-nyx+_6.0.0-nyx+-1_amd64.deb \ No newline at end of file diff --git a/deploy/intellabs/kafl/roles/qemu/vars/Ubuntu.yml b/deploy/intellabs/kafl/roles/qemu/vars/Ubuntu.yml index 19929f89..a49df816 100644 --- a/deploy/intellabs/kafl/roles/qemu/vars/Ubuntu.yml +++ b/deploy/intellabs/kafl/roles/qemu/vars/Ubuntu.yml @@ -1,6 +1,5 @@ packages: - pkg-config - - build-essential - libglib2.0-dev - libpixman-1-dev - libgtk-3-dev \ No newline at end of file