Documentation
¶
Overview ¶
Package bios contains functions to support bios manipulation. Reviews for this package can be sent to tast-fw-library-reviewers@ (before tast-owners@ review).
Index ¶
- Constants
- func EnableAPSoftwareWriteProtect(ctx context.Context) error
- func NewImageToFile(ctx context.Context, section ImageSection, programmer FlashromProgrammer) (string, error)
- func ParseSections(fmap string) (map[ImageSection]SectionInfo, error)
- func WriteImageFromFile(ctx context.Context, path string, sec ImageSection, ...) error
- type FlashromProgrammer
- type Image
- type ImageSection
- type SectionInfo
Constants ¶
const ( // HostProgrammer is the flashrom programmer type used to operate with AP firmware chip. HostProgrammer FlashromProgrammer = "host" // ECProgrammer is the flashrom programmer type used to operate with EC chip. ECProgrammer FlashromProgrammer = "ec" // BOOTSTUBImageSection is the named section for the Coreboot image (more recent devices use COREBOOT). BOOTSTUBImageSection ImageSection = "BOOT_STUB" // COREBOOTImageSection is the named section for the Coreboot image. COREBOOTImageSection ImageSection = "COREBOOT" // GBBImageSection is the named section for GBB as output from dump_fmap. GBBImageSection ImageSection = "GBB" // ECRWImageSection is the named section for EC writable data as output from dump_fmap. ECRWImageSection ImageSection = "EC_RW" // ECRWBImageSection is the named section for a secondary EC writable data for EFS. ECRWBImageSection ImageSection = "EC_RW_B" // EmptyImageSection is the empty string which will result in the whole AP/EC fw backup. EmptyImageSection ImageSection = "" )
Variables ¶
This section is empty.
Functions ¶
func EnableAPSoftwareWriteProtect ¶
EnableAPSoftwareWriteProtect enables and specifies the RO region for the AP.
func NewImageToFile ¶
func NewImageToFile(ctx context.Context, section ImageSection, programmer FlashromProgrammer) (string, error)
NewImageToFile creates a file representing the desired section of currently loaded firmware image.
func ParseSections ¶
func ParseSections(fmap string) (map[ImageSection]SectionInfo, error)
ParseSections extracts section names and locations from dump_fmap output.
func WriteImageFromFile ¶
func WriteImageFromFile(ctx context.Context, path string, sec ImageSection, programmer FlashromProgrammer) error
WriteImageFromFile writes the provided path in the specified section of the firmware
Types ¶
type FlashromProgrammer ¶
type FlashromProgrammer string
FlashromProgrammer is the type of programmer being passed to flashrom command line.
type Image ¶
type Image struct { Data []byte Sections map[ImageSection]SectionInfo }
Image represents the content and sections of a firmware image.
func NewImage ¶
func NewImage(ctx context.Context, section ImageSection, programmer FlashromProgrammer) (*Image, error)
NewImage creates an Image object representing the currently loaded BIOS image. If you pass in a section, only that section will be read.
func NewImageFromData ¶
func NewImageFromData(data []byte, sections map[ImageSection]SectionInfo) *Image
NewImageFromData creates an Image object from an in memory image.
func (*Image) ClearAndSetGBBFlags ¶
ClearAndSetGBBFlags clears and sets the specified flags, leaving the rest unchanged, set has precedence over clear.
func (*Image) GetGBBFlags ¶
GetGBBFlags returns the list of cleared and list of set flags.
func (*Image) GetLayout ¶
GetLayout gets the section locations of all the ones we care about into a flashrom friendly format.
func (*Image) WriteFlashrom ¶
func (i *Image) WriteFlashrom(ctx context.Context, sec ImageSection, programmer FlashromProgrammer) error
WriteFlashrom writes the current data in the specified section into flashrom.
type ImageSection ¶
type ImageSection string
ImageSection is the name of sections supported by this package.
type SectionInfo ¶
SectionInfo represents the location and size of a firmware image section.