From 668bc1e3915e43e1c4bb89b39e17815a84bc5f91 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Wed, 15 Feb 2023 10:52:36 +0000 Subject: [PATCH] Store the default kernel modules --- config/config.go | 8 +++++--- kernel.go | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/config/config.go b/config/config.go index 420628b..ae4db86 100644 --- a/config/config.go +++ b/config/config.go @@ -250,9 +250,11 @@ type KernelInfo struct { ContainerName string // Runtime information - KernelPath string - InitrdPath string - RootFS string + KernelPath string + InitrdPath string + ModulesPath string + + RootFS string // Debug symbols VmlinuxPath string diff --git a/kernel.go b/kernel.go index 7b3ebd1..96b86bd 100644 --- a/kernel.go +++ b/kernel.go @@ -482,6 +482,13 @@ func copyKernels(name string) (err error) { return } + cmd = exec.Command("docker", "cp", containerID+":/lib/modules", target) + rawOutput, err = cmd.CombinedOutput() + if err != nil { + log.Println(string(rawOutput)) + return + } + return } @@ -658,9 +665,11 @@ func genDockerKernels(dii dockerImageInfo, newkcfg *config.KernelConfig, KernelRelease: k, ContainerName: name, - KernelPath: kernelsBase + genKernelPath(files, k), - InitrdPath: kernelsBase + genInitrdPath(files, k), - RootFS: rootfs, + KernelPath: kernelsBase + genKernelPath(files, k), + InitrdPath: kernelsBase + genInitrdPath(files, k), + ModulesPath: kernelsBase + "modules/" + k, + + RootFS: rootfs, } newkcfg.Kernels = append(newkcfg.Kernels, ki) }