Do not support loading modules from "deviceinfo_modules_initfs" (MR 38)
This variable will dissappear from the deviceinfo at some point: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4169 so after it does, it would not make much sense to keep its use around
This commit is contained in:
committed by
Clayton Craft
parent
d77e1cd11d
commit
2b467eb77f
@@ -9,7 +9,6 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/archive"
|
||||
@@ -105,8 +104,8 @@ func main() {
|
||||
hookfiles.New("/etc/mkinitfs/files"),
|
||||
hookscripts.New("/usr/share/mkinitfs/hooks", "/hooks"),
|
||||
hookscripts.New("/etc/mkinitfs/hooks", "/hooks"),
|
||||
modules.New(strings.Fields(devinfo.ModulesInitfs), "/usr/share/mkinitfs/modules"),
|
||||
modules.New([]string{}, "/etc/mkinitfs/modules"),
|
||||
modules.New("/usr/share/mkinitfs/modules"),
|
||||
modules.New("/etc/mkinitfs/modules"),
|
||||
})
|
||||
if err := initramfsAr.AddItems(initfs); err != nil {
|
||||
log.Println(err)
|
||||
@@ -137,8 +136,8 @@ func main() {
|
||||
hookfiles.New("/etc/mkinitfs/files-extra"),
|
||||
hookscripts.New("/usr/share/mkinitfs/hooks-extra", "/hooks-extra"),
|
||||
hookscripts.New("/etc/mkinitfs/hooks-extra", "/hooks-extra"),
|
||||
modules.New([]string{}, "/usr/share/mkinitfs/modules-extra"),
|
||||
modules.New([]string{}, "/etc/mkinitfs/modules-extra"),
|
||||
modules.New("/usr/share/mkinitfs/modules-extra"),
|
||||
modules.New("/etc/mkinitfs/modules-extra"),
|
||||
osksdl.New(devinfo.MesaDriver),
|
||||
})
|
||||
if err := initramfsExtraAr.AddItemsExclude(initfsExtra, initfs); err != nil {
|
||||
|
||||
@@ -45,7 +45,6 @@ are *required* by mkinitfs:
|
||||
- deviceinfo_initfs_compression
|
||||
- deviceinfo_initfs_extra_compression
|
||||
- deviceinfo_mesa_driver
|
||||
- deviceinfo_modules_initfs
|
||||
- deviceinfo_uboot_boardname
|
||||
|
||||
It is a design goal to keep the number of required variables from deviceinfo to
|
||||
|
||||
@@ -17,14 +17,11 @@ import (
|
||||
|
||||
type Modules struct {
|
||||
modulesListPath string
|
||||
modulesList []string
|
||||
}
|
||||
|
||||
// New returns a new Modules that will use the given moduleto provide a list
|
||||
// of script files.
|
||||
func New(modulesList []string, modulesListPath string) *Modules {
|
||||
// New returns a new Modules that will read in lists of kernel modules in the given path.
|
||||
func New(modulesListPath string) *Modules {
|
||||
return &Modules{
|
||||
modulesList: modulesList,
|
||||
modulesListPath: modulesListPath,
|
||||
}
|
||||
}
|
||||
@@ -52,20 +49,6 @@ func (m *Modules) List() (*filelist.FileList, error) {
|
||||
files.Add(file, file)
|
||||
}
|
||||
|
||||
// slurp up given list of modules
|
||||
if len(m.modulesList) > 0 {
|
||||
log.Printf("-- Including kernel modules from deviceinfo")
|
||||
for _, module := range m.modulesList {
|
||||
if modFilelist, err := getModule(module, modDir); err != nil {
|
||||
return nil, fmt.Errorf("unable to get modules from deviceinfo: %w", err)
|
||||
} else {
|
||||
for _, file := range modFilelist {
|
||||
files.Add(file, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// slurp up modules from lists in modulesListPath
|
||||
log.Printf("- Searching for kernel modules from %s", m.modulesListPath)
|
||||
fileInfo, err := os.ReadDir(m.modulesListPath)
|
||||
|
||||
@@ -19,7 +19,6 @@ type DeviceInfo struct {
|
||||
InitfsCompression string
|
||||
InitfsExtraCompression string
|
||||
MesaDriver string
|
||||
ModulesInitfs string
|
||||
UbootBoardname string
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// Test ReadDeviceinfo and the logic of reading from multiple files
|
||||
func TestReadDeviceinfo(t *testing.T) {
|
||||
modules_expected := "panfrost foo bar bazz"
|
||||
compression_expected := "gz -9"
|
||||
mesa_expected := "msm"
|
||||
|
||||
var devinfo DeviceInfo
|
||||
@@ -28,8 +28,8 @@ func TestReadDeviceinfo(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("received an unexpected err: %s", err)
|
||||
}
|
||||
if devinfo.ModulesInitfs != modules_expected {
|
||||
t.Errorf("expected %q, got: %q", modules_expected, devinfo.ModulesInitfs)
|
||||
if devinfo.InitfsCompression != compression_expected {
|
||||
t.Errorf("expected %q, got: %q", compression_expected, devinfo.InitfsCompression)
|
||||
}
|
||||
if devinfo.MesaDriver != mesa_expected {
|
||||
t.Errorf("expected %q, got: %q", mesa_expected, devinfo.MesaDriver)
|
||||
@@ -44,9 +44,9 @@ func TestNameToField(t *testing.T) {
|
||||
}{
|
||||
{"deviceinfo_dtb", "Dtb"},
|
||||
{"dtb", "Dtb"},
|
||||
{"deviceinfo_modules_initfs", "ModulesInitfs"},
|
||||
{"deviceinfo_initfs_compression", "InitfsCompression"},
|
||||
{"modules_initfs", "ModulesInitfs"},
|
||||
{"deviceinfo_modules_initfs___", "ModulesInitfs"},
|
||||
{"deviceinfo_initfs_compression___", "InitfsCompression"},
|
||||
{"deviceinfo_initfs_extra_compression", "InitfsExtraCompression"},
|
||||
}
|
||||
|
||||
@@ -67,12 +67,11 @@ func TestUnmarshal(t *testing.T) {
|
||||
in string
|
||||
expected string
|
||||
}{
|
||||
{"ModulesInitfs", "deviceinfo_modules_initfs=\"panfrost foo bar bazz\"\n", "panfrost foo bar bazz"},
|
||||
{"ModulesInitfs", "deviceinfo_modules_initfs=\"panfrost foo bar bazz\"", "panfrost foo bar bazz"},
|
||||
{"InitfsCompression", "deviceinfo_initfs_compression=\"gzip:-9\"\n", "gzip:-9"},
|
||||
// line with multiple '='
|
||||
{"InitfsCompression", "deviceinfo_initfs_compression=zstd:--foo=1 -T0 --bar=bazz", "zstd:--foo=1 -T0 --bar=bazz"},
|
||||
// empty option
|
||||
{"ModulesInitfs", "deviceinfo_modules_initfs=\"\"\n", ""},
|
||||
{"InitfsCompression", "deviceinfo_initfs_compression=\"\"\n", ""},
|
||||
// line with comment at the end
|
||||
{"MesaDriver", "deviceinfo_mesa_driver=\"panfrost\" # this is a nice driver", "panfrost"},
|
||||
{"", "# this is a comment!\n", ""},
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
deviceinfo_modules_initfs="panfrost foo bar bazz"
|
||||
deviceinfo_initfs_compression="gz -9"
|
||||
deviceinfo_mesa_driver="panfrost"
|
||||
|
||||
Reference in New Issue
Block a user