github.com/hugelgupf/u-root@v0.0.0-20191023214958-4807c632154c/pkg/boot/multiboot.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
     6  
     7  import (
     8  	"fmt"
     9  	"strings"
    10  
    11  	"github.com/u-root/u-root/pkg/ibft"
    12  	"github.com/u-root/u-root/pkg/multiboot"
    13  )
    14  
    15  // MultibootImage is a multiboot-formated OSImage, such as ESXi, Xen, Akaros,
    16  // tboot.
    17  type MultibootImage struct {
    18  	Path    string
    19  	Cmdline string
    20  	Modules []string
    21  	IBFT    *ibft.IBFT
    22  }
    23  
    24  var _ OSImage = &MultibootImage{}
    25  
    26  // Load implements OSImage.Load.
    27  func (mi *MultibootImage) Load(verbose bool) error {
    28  	return multiboot.Load(verbose, mi.Path, mi.Cmdline, mi.Modules, mi.IBFT)
    29  }
    30  
    31  // String implements fmt.Stringer.
    32  func (mi *MultibootImage) String() string {
    33  	return fmt.Sprintf("MultibootImage(\n  KernelPath: %s\n  Cmdline: %s\n  Modules: %s\n)",
    34  		mi.Path, mi.Cmdline, strings.Join(mi.Modules, ", "))
    35  }