push dkl init boot logic here
This commit is contained in:
22
boot-v2.go
22
boot-v2.go
@ -13,6 +13,9 @@ import (
|
||||
func bootV2() {
|
||||
log.Print("-- boot v2 --")
|
||||
|
||||
kernelVersion := unameRelease()
|
||||
log.Print("Linux version ", kernelVersion)
|
||||
|
||||
cfg := &config.Config{}
|
||||
|
||||
{
|
||||
@ -35,19 +38,18 @@ func bootV2() {
|
||||
auths = cfg.Auths
|
||||
|
||||
// mount kernel modules
|
||||
if cfg.Modules != "" {
|
||||
log.Print("mount modules from ", cfg.Modules)
|
||||
if cfg.Modules == "" {
|
||||
log.Print("NOT mounting modules (nothing specified)")
|
||||
} else {
|
||||
mountSquahfs(cfg.Modules, "/modules")
|
||||
|
||||
err := os.MkdirAll("/modules", 0755)
|
||||
if err != nil {
|
||||
fatal("failed to create /modules: ", err)
|
||||
modulesSourcePath := "/modules/lib/modules/" + kernelVersion
|
||||
if _, err := os.Stat(modulesSourcePath); err != nil {
|
||||
fatal("invalid modules dir: ", err)
|
||||
}
|
||||
|
||||
run("mount", cfg.Modules, "/modules")
|
||||
loopOffset++
|
||||
|
||||
err = os.Symlink("/modules/lib/modules", "/lib/modules")
|
||||
if err != nil {
|
||||
os.MkdirAll("/lib/modules", 0755)
|
||||
if err := os.Symlink(modulesSourcePath, "/lib/modules/"+kernelVersion); err != nil {
|
||||
fatal("failed to symlink modules: ", err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user