reboot: use cmdline from boot/cmdline.txt

For bootonly updates, switching to the inactive root partition is incorrect.
This commit is contained in:
Michael Stapelberg 2018-07-15 10:40:19 +02:00
parent 9770d4408f
commit fc8dd9e2f2

View File

@ -33,14 +33,13 @@ func kexecReboot() error {
return err
}
defer kernel.Close()
cmdline, err := ioutil.ReadFile("/proc/cmdline")
cmdline, err := ioutil.ReadFile(filepath.Join(tmpdir, "cmdline.txt"))
if err != nil {
return err
}
rep := rootRe.ReplaceAllLiteral(cmdline, []byte("root="+rootdev.MustFind()+inactiveRootPartition))
// NUL-terminate cmdline
cmdlinebuf := make([]byte, len(rep)+1)
copy(cmdlinebuf, rep)
cmdlinebuf := make([]byte, len(cmdline)+1)
copy(cmdlinebuf, cmdline)
_, _, errno := unix.Syscall6(
unix.SYS_KEXEC_FILE_LOAD,
uintptr(kernel.Fd()), // kernel_fd