Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support compressed kernel modules #809

Merged
merged 2 commits into from
Jun 25, 2024
Merged
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
16 changes: 16 additions & 0 deletions isoutils/isoutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ func mkInitrdInitScript(templatePath string) error {
"/kernel/fs/overlayfs/overlay.ko",
}

//Compression extensions
compressionExtensions := []string{
".zst",
".gz",
".xz",
}

/* Find kernel, then break the name into kernelVersion */
kernelGlob, err := filepath.Glob(tmpPaths[clrRootfs] + "/lib/kernel/org.clearlinux.*")
if err != nil || len(kernelGlob) != 1 {
Expand All @@ -209,6 +216,15 @@ func mkInitrdInitScript(templatePath string) error {
for _, i := range modules {
rootfsModPath := tmpPaths[clrRootfs] + "/usr/lib/modules/" + kernelVersion + "." + kernelType + i

/* check for compression extensions on module filenames */
for _, ext := range compressionExtensions {
if _, err := os.Stat(rootfsModPath + ext); err == nil {
rootfsModPath = rootfsModPath + ext
i = i + ext
break
}
}

/* copy kernel module to initramfs */
initrdModPath := filepath.Dir(tmpPaths[clrInitrd] + "/usr/lib/modules/" + kernelVersion + "." + kernelType + i)

Expand Down
4 changes: 2 additions & 2 deletions tests/baseline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ targetMedia:
- name: ${baseimg}1
fstype: vfat
mountpoint: /boot
size: "50M"
size: "100M"
type: part
- name: ${baseimg}2
fstype: ext4
mountpoint: /
size: "2.0G"
size: "4.0G"
type: part

bundles: [os-core, os-core-update, NetworkManager, vim]
Expand Down
Loading