github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/pkg/boot/boot.go (about)

     1  // Copyright 2018 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 boot is the high-level interface for booting another operating
     6  // system from Linux using kexec.
     7  package boot
     8  
     9  import (
    10  	"fmt"
    11  
    12  	"github.com/u-root/u-root/pkg/boot/kexec"
    13  )
    14  
    15  // OSImage represents a bootable OS package.
    16  type OSImage interface {
    17  	fmt.Stringer
    18  
    19  	// Label is a name or short description for this OSImage.
    20  	//
    21  	// Label is intended for boot menus.
    22  	Label() string
    23  
    24  	// Load loads the OS image into kernel memory, ready for execution.
    25  	//
    26  	// After Load is called, call boot.Execute() to stop Linux and boot the
    27  	// loaded OSImage.
    28  	Load(verbose bool) error
    29  }
    30  
    31  // Execute executes a previously loaded OSImage.
    32  //
    33  // This will only work if OSImage.Load was called on some OSImage.
    34  func Execute() error {
    35  	return kexec.Reboot()
    36  }