-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a SL Micro 6.0 GA kernel module development container
- Loading branch information
1 parent
1189112
commit 1edaba4
Showing
2 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/bci_build/package/slm60-kernel-module-devel/README.md.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# SUSE Linux Micro 6.0 GA Kernel Module Development Container | ||
{% include 'badges.j2' %} | ||
|
||
## Description | ||
|
||
Th Kernel Module Development Container Image includes all necessary tools to build kernel | ||
modules for SUSE Linux Micro 6.0. It is intended to be used for building out-of-tree kernel | ||
modules in restricted environments. | ||
|
||
|
||
## Usage | ||
|
||
The image can be used to launch a container and build a kernel | ||
module. The following example below shows how to do this for the DRBD kernel module: | ||
```ShellSession | ||
$ podman run --rm -it --name drbd-build {{ image.pretty_reference }} | ||
# zypper -n in coccinelle tar | ||
# curl -Lsf -o - https://pkg.linbit.com/downloads/drbd/9/drbd-9.2.11.tar.gz | tar xzf - | ||
# cd drbd-9.2.11/ | ||
# make -C drbd all KDIR=/usr/src/linux-obj/$(uname -m)/default | ||
``` | ||
|
||
The built kernel module is then available in | ||
`/drbd-9.2.11/drbd/build-current/drbd.ko`. It can be copied to the host system | ||
as follows: | ||
```ShellSession | ||
$ podman cp drbd-build:/drbd-9.2.11/drbd/build-current/drbd.ko . | ||
$ sudo modprobe drbd.ko | ||
``` | ||
|
||
Alternatively, the kernel module can be built as part of a container build using | ||
a `Dockerfile`: | ||
|
||
```Dockerfile | ||
FROM {{ image.pretty_reference }} | ||
ENV DRBD_VERSION=9.2.11 | ||
WORKDIR /src/ | ||
RUN zypper -n in coccinelle tar | ||
|
||
RUN set -euxo pipefail; \ | ||
curl -Lsf -o - https://pkg.linbit.com/downloads/drbd/9/drbd-${DRBD_VERSION}.tar.gz | tar xzf - ; \ | ||
cd drbd-${DRBD_VERSION}; \ | ||
make -C drbd all KDIR=/usr/src/linux-obj/$(uname -m)/default | ||
``` | ||
|
||
Build the container image, launch the container, and copy the kernel module to | ||
the local machine: | ||
```ShellSession | ||
$ buildah bud --layers -t drbd-ko . | ||
$ podman run --name drbd drbd-ko | ||
$ podman cp drbd:/src/drbd-9.2.11/drbd/build-current/drbd.ko . | ||
$ podman rm drbd | ||
``` | ||
|
||
{% include 'licensing_and_eula.j2' %} |