github.com/oweisse/u-root@v0.0.0-20181109060735-d005ad25fef1/pkg/kexec/kexec_linux.go (about)

     1  // Copyright 2015-2017 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package kexec
     6  
     7  import (
     8  	"fmt"
     9  	"syscall"
    10  )
    11  
    12  // Reboot executes a kernel previously loaded with FileInit.
    13  func Reboot() error {
    14  	if err := syscall.Reboot(syscall.LINUX_REBOOT_CMD_KEXEC); err != nil {
    15  		return fmt.Errorf("sys_reboot(..., kexec) = %v", err)
    16  	}
    17  	return nil
    18  }