Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dd5cdeace5 | ||
|
1a99953aa2 | ||
|
e2f4e6254f |
@@ -95,13 +95,16 @@ func (b *BootDeploy) Run() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getKernelPath(outDir string, zboot bool) ([]string, error) {
|
func getKernelPath(outDir string, zboot bool) ([]string, error) {
|
||||||
kernFile := "vmlinuz*"
|
var kernels []string
|
||||||
|
|
||||||
if zboot {
|
if zboot {
|
||||||
kernFile = "linux.efi"
|
kernels, _ = filepath.Glob(filepath.Join(outDir, "linux.efi"))
|
||||||
|
if len(kernels) > 0 {
|
||||||
|
return kernels, nil
|
||||||
|
}
|
||||||
|
// else fallback to vmlinuz* below
|
||||||
}
|
}
|
||||||
|
|
||||||
var kernels []string
|
kernFile := "vmlinuz*"
|
||||||
kernels, _ = filepath.Glob(filepath.Join(outDir, kernFile))
|
kernels, _ = filepath.Glob(filepath.Join(outDir, kernFile))
|
||||||
if len(kernels) == 0 {
|
if len(kernels) == 0 {
|
||||||
return nil, errors.New("Unable to find any kernels at " + filepath.Join(outDir, kernFile))
|
return nil, errors.New("Unable to find any kernels at " + filepath.Join(outDir, kernFile))
|
||||||
|
@@ -118,7 +118,9 @@ func getModulesInDir(modPath string) (files []string, err error) {
|
|||||||
// Unable to walk path
|
// Unable to walk path
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if filepath.Ext(path) != ".ko" && filepath.Ext(path) != ".xz" {
|
// this assumes module names are in the format <name>.ko[.format],
|
||||||
|
// where ".format" (e.g. ".gz") is optional.
|
||||||
|
if !strings.Contains(".ko", path) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
files = append(files, path)
|
files = append(files, path)
|
||||||
|
@@ -41,10 +41,22 @@ func getFile(file string, required bool) (files []string, err error) {
|
|||||||
|
|
||||||
fileInfo, err := os.Stat(file)
|
fileInfo, err := os.Stat(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if required {
|
// Check if there is a Zstd-compressed version of the file
|
||||||
return files, fmt.Errorf("getFile: failed to stat file %q: %w", file, err)
|
fileZstd := file + ".zst" // .zst is the extension used by linux-firmware
|
||||||
|
fileInfoZstd, errZstd := os.Stat(fileZstd)
|
||||||
|
|
||||||
|
if errZstd == nil {
|
||||||
|
file = fileZstd
|
||||||
|
fileInfo = fileInfoZstd
|
||||||
|
// Unset nil so we don't retain the error from the os.Stat call for the uncompressed version.
|
||||||
|
err = nil
|
||||||
|
} else {
|
||||||
|
if required {
|
||||||
|
return files, fmt.Errorf("getFile: failed to stat file %q: %w (also tried %q: %w)", file, err, fileZstd, errZstd)
|
||||||
|
}
|
||||||
|
|
||||||
|
return files, nil
|
||||||
}
|
}
|
||||||
return files, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if fileInfo.IsDir() {
|
if fileInfo.IsDir() {
|
||||||
|
Reference in New Issue
Block a user