@@ -119,16 +119,16 @@ Once the image is built, KMM proceeds with the `Module` reconciliation.
119119### Depending on in-tree kernel modules
120120
121121Some kernel modules depend on other kernel modules shipped with the node's distribution.
122- To avoid copying those dependencies into the kmod image, KMM mounts ` /usr/ lib/modules` into both the build and the
123- worker Pod's filesystems.
124- By creating a symlink from `/opt/usr/ lib/modules/[kernel-version]/[symlink-name]` to
125- ` /usr /lib/modules/[kernel-version]` , `depmod` can use the in-tree kmods on the building node's filesystem to resolve
122+ To avoid copying those dependencies into the kmod image, KMM mounts the host's ` / lib/modules` and `/usr/lib/modules`
123+ directories into both the build and worker Pod's filesystems at `/host/lib/modules` and `/host/usr/lib/modules` .
124+ By creating a symlink from `/opt/lib/modules/[kernel-version]/[symlink-name]` to
125+ ` /host /lib/modules/[kernel-version]` , `depmod` can use the in-tree kmods on the building node's filesystem to resolve
126126dependencies.
127127At runtime, the worker Pod extracts the entire image, including the `[symlink-name]` symbolic link.
128- That link points to `/usr /lib/modules/[kernel-version]` in the worker Pod, which is mounted from the node's filesystem.
128+ That link points to `/host /lib/modules/[kernel-version]` in the worker Pod, which is mounted from the node's filesystem.
129129` modprobe` can then follow that link and load the in-tree dependencies as needed.
130130
131- In the example below, we use `host` as the symbolic link name under `/opt/usr/ lib/modules/[kernel-version]` :
131+ In the example below, we use `host` as the symbolic link name under `/opt/lib/modules/[kernel-version]` :
132132
133133` ` ` dockerfile
134134FROM ubuntu as builder
@@ -146,8 +146,8 @@ RUN apt-get update && apt-get install -y kmod
146146COPY --from=builder /usr/src/kernel-module-management/ci/kmm-kmod/kmm_ci_a.ko /opt/lib/modules/${KERNEL_FULL_VERSION}/
147147COPY --from=builder /usr/src/kernel-module-management/ci/kmm-kmod/kmm_ci_b.ko /opt/lib/modules/${KERNEL_FULL_VERSION}/
148148
149- # Create the symbolic link
150- RUN ln -s /lib/modules/${KERNEL_FULL_VERSION} /opt/lib/modules/${KERNEL_FULL_VERSION}/host
149+ # Create the symbolic link to host modules (mounted at /host/lib/modules by KMM)
150+ RUN ln -s /host/ lib/modules/${KERNEL_FULL_VERSION} /opt/lib/modules/${KERNEL_FULL_VERSION}/host
151151
152152RUN depmod -b /opt ${KERNEL_FULL_VERSION}
153153` ` `
@@ -156,5 +156,5 @@ RUN depmod -b /opt ${KERNEL_FULL_VERSION}
156156 ` depmod` will generate dependency files based on the kernel modules present on the node that runs the kmod image
157157 build.
158158 On the node on which KMM loads the kernel modules, `modprobe` will expect the files to be present under
159- ` /usr /lib/modules/[kernel-version]` , and the same filesystem layout.
159+ ` /host /lib/modules/[kernel-version]` , and the same filesystem layout.
160160 It is highly recommended that the build and the target nodes share the same distribution and release.
0 commit comments