Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ playbooks/roles/linux-mirror/linux-mirror-systemd/mirrors.yaml
# yet.
workflows/selftests/results/

workflows/linux/artifacts/

workflows/linux/refs/default/Kconfig.linus
workflows/linux/refs/default/Kconfig.next
workflows/linux/refs/default/Kconfig.stable
Expand Down
4 changes: 4 additions & 0 deletions playbooks/build_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- hosts: all
roles:
- role: build_linux
4 changes: 4 additions & 0 deletions playbooks/install_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- hosts: all
roles:
- role: install_linux
74 changes: 74 additions & 0 deletions playbooks/roles/build_linux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
build_linux
===========

The build_linux role downloads and builds the Linux kernel. It also
lets you apply custom patches, remove kernels, etc.; anything you
have to do with regards to generic kernel development.

By default, it tracks one of the latest stable kernels that are
still supported using the linux stable git tree.

Requirements
------------

A separate block device is required on which to create the file
system where the test kernel is built.

Role Variables
--------------

* infer_uid_and_group: defaults to False, if set to True, then we will ignore
the passed on data_user and data_group and instead try to infer this by
inspecting the `whoami` and getent on the logged in target system we are
provisioning. So if user sam is running able on a host, targetting a system
called foofighter and logging into that system using username pincho,
then the data_user will be set overwritten and set to pincho. We will then
also lookup for pincho's default group id and use that for data_group.
This is useful if you are targetting a slew of systems and don't really
want to deal with the complexities of the username and group, and the
default target username you use to ssh into a system suffices to use as
a base. This is set to False to remain compatible with old users of
this role.
* data_path: where to place the git trees we clone under
* data_user: the user to assign permissions to
* data_group: the group to assign permissions to

* data_device: the target device to use for the data partition
* data_fstype: the filesystem to store the data parition under
* data_label: the label to use
* data_fs_opts: the filesystem options to use, you want to ensure to add the
label

* target_linux_admin_name: your developer name
* target_linux_admin_email: your email
* target_linux_git: the git tree to clone, by default this is the linux-stable
tree
* target_linux_tree: the name of the tree
* target_linux_dir_path: where to place the tree on the target system

* target_linux_ref : the actual tag as used on linux, so v4.19.62
* target_linux_extra_patch: if defined an extra patch to apply with git
am prior to compilation
* target_linux_config: the configuration file to use

Dependencies
------------

None.

Example Playbook
----------------

Below is an example playbook, say a build_linux.yml file:

```
---
- hosts: all
roles:
- role: build_linux
```

License
-------

copyleft-next-0.3.1
38 changes: 38 additions & 0 deletions playbooks/roles/build_linux/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-License-Identifier copyleft-next-0.3.1
---
kdevops_bootlinux: false
infer_uid_and_group: false

data_path: "/data"
data_user: "kdevops"
data_group: "kdevops"
data_device: "/dev/disk/by-id/nvme-QEMU_NVMe_Ctrl_kdevops0"
data_fstype: "xfs"
data_label: "data"
data_fs_opts: "-L {{ disk_setup_label }}"

target_linux_admin_name: "Hacker Amanda"
target_linux_admin_email: "devnull@kernel.org"
target_linux_git: "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
target_linux_shallow_depth: 0
target_linux_tree: "linux-stable"
target_linux_dir_path: "{{ data_path }}/{{ target_linux_tree }}"
kdevops_baseline_and_dev: false

target_linux_ref: "v4.19.133"
target_linux_delta_file:
target_linux_config: "config-{{ target_linux_ref }}"
make: "make"
target_linux_make_cmd: "{{ make }} -j{{ ansible_processor_nproc }}"
target_linux_make_install_cmd: "{{ target_linux_make_cmd }} modules_install install"

build_artifacts_dir: "{{ topdir_path }}/workflows/linux/artifacts/"

uninstall_kernel_enable: false

bootlinux_b4_am_this_host: false

kdevops_workflow_enable_cxl: false
bootlinux_cxl_test: false

bootlinux_tree_set_by_cli: false
46 changes: 46 additions & 0 deletions playbooks/roles/build_linux/tasks/install-deps/debian/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
# Install dependencies for building linux on Debian

- name: Update apt cache
become: true
become_method: ansible.builtin.sudo
ansible.builtin.apt:
update_cache: true
tags:
- linux

# apt-get build-dep does not capture all requirements
- name: Install Linux kernel build dependencies
become: true
become_method: ansible.builtin.sudo
ansible.builtin.apt:
name:
- bison
- flex
- git
- gcc
- make
- gawk
- bc
- dump
- indent
- sed
- libssl-dev
- libelf-dev
- liburcu-dev
- xfsprogs
- e2fsprogs
- btrfs-progs
- ntfs-3g
- mdadm
- rpcbind
- portmap
- hwinfo
- open-iscsi
- python3-pip
- zstd
- libncurses-dev
- b4
state: present
tags:
- linux
102 changes: 102 additions & 0 deletions playbooks/roles/build_linux/tasks/install-deps/redhat/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
- name: Enable installation of packages from EPEL
ansible.builtin.include_role:
name: epel-release
when:
- ansible_distribution != "Fedora"

- name: Install packages for building the Linux kernel
become: true
become_method: ansible.builtin.sudo
ansible.builtin.dnf:
name: "{{ packages }}"
state: present
update_cache: true
retries: 3
delay: 5
register: result
until: result is succeeded
vars:
packages:
- bison
- flex
- git-core
- e2fsprogs
- xfsprogs
- xfsdump
- lvm2
- gcc
- make
- gawk
- bc
- dump
- libtool
- psmisc
- sed
- vim
- fio
- libaio-devel
- diffutils
- net-tools
- ncurses-devel
- xfsprogs
- e2fsprogs
- elfutils-libelf-devel
- ntfs-3g
- mdadm
- rpcbind
- portmap
- hwinfo
- iscsi-initiator-utils
- openssl
- openssl-devel
- dwarves
- userspace-rcu
- zstd

- name: Install btrfs-progs
become: true
become_method: ansible.builtin.sudo
ansible.builtin.dnf:
name:
- btrfs-progs
state: present
update_cache: true
retries: 3
delay: 5
register: btrfs_result
until: btrfs_result is succeeded
when:
- ansible_distribution == "Fedora"

- name: Install rpmbuild
become: true
become_method: ansible.builtin.sudo
ansible.builtin.dnf:
name:
- rpmbuild
state: present
update_cache: true
retries: 3
delay: 5
register: rpmbuild_result
until: rpmbuild_result is succeeded
when:
- ansible_distribution != "Fedora"

- name: Install rpmbuild
become: true
become_method: ansible.builtin.sudo
ansible.builtin.dnf:
name:
- perl-core
- rpm-build
- rsync
state: present
update_cache: true
retries: 3
delay: 5
register: rpmbuild_result
until: rpmbuild_result is succeeded
when:
- ansible_distribution == "Fedora"
31 changes: 31 additions & 0 deletions playbooks/roles/build_linux/tasks/install-deps/suse/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: Install Linux kernel build dependencies for SUSE
become: true
become_method: ansible.builtin.sudo
community.general.zypper:
name:
- bison
- flex
- git-core
- gcc
- make
- gawk
- bc
- dump
- sed
- libopenssl-devel
- libelf-devel
- liburcu8
- diffutils
- net-tools
- ncurses-devel
- xfsprogs
- e2fsprogs
- btrfsprogs
- ntfs-3g
- mdadm
- rpcbind
- portmap
- hwinfo
- open-iscsi
disable_recommends: false
Loading