forked from u-root/u-root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.go
36 lines (29 loc) · 913 Bytes
/
boot.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2018 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package boot is the high-level interface for booting another operating
// system from Linux using kexec.
package boot
import (
"fmt"
"github.com/u-root/u-root/pkg/boot/kexec"
)
// OSImage represents a bootable OS package.
type OSImage interface {
fmt.Stringer
// Label is a name or short description for this OSImage.
//
// Label is intended for boot menus.
Label() string
// Load loads the OS image into kernel memory, ready for execution.
//
// After Load is called, call boot.Execute() to stop Linux and boot the
// loaded OSImage.
Load(verbose bool) error
}
// Execute executes a previously loaded OSImage.
//
// This will only work if OSImage.Load was called on some OSImage.
func Execute() error {
return kexec.Reboot()
}