Documentation
¶
Index ¶
- Constants
- Variables
- func Read(r io.Reader, f interface{}) error
- func ReadAttributes(r io.Reader, f *File) error
- func ReadData(r io.ReadSeeker, f *File) error
- func ReadLE(r io.Reader, f interface{}) error
- func ReadName(r io.Reader, f *File, size uint32) error
- func RegisterFileReader(f *SegReader) error
- func Write(w io.Writer, f interface{}) error
- func WriteLE(r io.Writer, f interface{}) error
- type Architecture
- type BootBlockRecord
- type CMOSLayoutRecord
- type Compression
- type EmptyRecord
- type FSPRecord
- type File
- type FileAttr
- type FileAttrAlign
- type FileAttrCompression
- type FileAttrHash
- type FileAttrPos
- type FileAttrStageHeader
- type FileHeader
- type FileType
- type Image
- type LegacyStageRecord
- type MasterHeader
- type MasterRecord
- type MicrocodeRecord
- type OptionRom
- type PayloadHeader
- type PayloadRecord
- type Props
- type RawRecord
- type ReadWriter
- func NewBootBlock(f *File) (ReadWriter, error)
- func NewCMOSLayout(f *File) (ReadWriter, error)
- func NewEmptyRecord(f *File) (ReadWriter, error)
- func NewFSP(f *File) (ReadWriter, error)
- func NewLegacyStageRecord(f *File) (ReadWriter, error)
- func NewMaster(f *File) (ReadWriter, error)
- func NewMicrocode(f *File) (ReadWriter, error)
- func NewPayloadRecord(f *File) (ReadWriter, error)
- func NewRaw(f *File) (ReadWriter, error)
- func NewSPD(f *File) (ReadWriter, error)
- func NewStageRecord(f *File) (ReadWriter, error)
- type SPDRecord
- type SegReader
- type SegmentType
- type StageHeader
- type StageRecord
- type Tag
Constants ¶
const ( // FOV TypeDeleted2 FileType = 0xffffffff TypeDeleted = 0 TypeBootBlock = 0x1 TypeMaster = 0x2 TypeLegacyStage = 0x10 TypeStage = 0x11 TypeSELF = 0x20 TypeFIT = 0x21 TypeOptionRom = 0x30 TypeBootSplash = 0x40 TypeRaw = 0x50 TypeVSA = 0x51 // very, very obsolete Geode thing TypeMBI = 0x52 TypeMicroCode = 0x53 TypeFSP = 0x60 TypeMRC = 0x61 TypeMMA = 0x62 TypeEFI = 0x63 TypeStruct = 0x70 TypeCMOS = 0xaa TypeSPD = 0xab TypeMRCCache = 0xac TypeCMOSLayout = 0x1aa )
const ( HeaderMagic = 0x4F524243 HeaderV1 = 0x31313131 HeaderV2 = 0x31313132 HeaderVersion = HeaderV2 Alignment = 64 )
const ( Unused Tag = 0 Unused2 = 0xffffffff Compressed = 0x42435a4c Hash = 0x68736148 PSCB = 0x42435350 ALCB = 0x42434c41 SHCB = 0x53746748 )
const ( SegCode SegmentType = 0x434F4445 SegData = 0x44415441 SegBSS = 0x42535320 SegParams = 0x50415241 SegEntry = 0x454E5452 )
const FileMagic = "LARCHIVE"
const FileSize = 24
const MasterHeaderLen = 32
this is the master cbfs header - it must be located somewhere available to bootblock (to load romstage). The last 4 bytes in the image contain its relative offset from the end of the image (as a 32-bit signed integer).
Variables ¶
var ( Master = []byte{}/* 696 elements not displayed */ ListOutput = `` /* 784-byte string literal not displayed */ )
var Debug = func(format string, v ...interface{}) {}
var Endian = binary.BigEndian
var SegReaders = make(map[FileType]*SegReader)
Functions ¶
func ReadName ¶
ReadNameAndAttributes reads the variable CBFS file attribute after the fixed CBFS header That is the filename, CBFS Attribute, Hashes, ...
func RegisterFileReader ¶
Types ¶
type BootBlockRecord ¶
type BootBlockRecord struct {
File
}
func (*BootBlockRecord) GetFile ¶
func (r *BootBlockRecord) GetFile() *File
func (*BootBlockRecord) Read ¶
func (r *BootBlockRecord) Read(in io.ReadSeeker) error
func (*BootBlockRecord) String ¶
func (r *BootBlockRecord) String() string
type CMOSLayoutRecord ¶
type CMOSLayoutRecord struct {
File
}
func (*CMOSLayoutRecord) GetFile ¶
func (r *CMOSLayoutRecord) GetFile() *File
func (*CMOSLayoutRecord) Read ¶
func (r *CMOSLayoutRecord) Read(in io.ReadSeeker) error
func (*CMOSLayoutRecord) String ¶
func (r *CMOSLayoutRecord) String() string
type Compression ¶
type Compression uint32
const ( None Compression = iota LZMA LZ4 )
func (Compression) String ¶
func (c Compression) String() string
type EmptyRecord ¶
type EmptyRecord struct {
File
}
func (*EmptyRecord) GetFile ¶
func (r *EmptyRecord) GetFile() *File
func (*EmptyRecord) Read ¶
func (r *EmptyRecord) Read(in io.ReadSeeker) error
func (*EmptyRecord) String ¶
func (r *EmptyRecord) String() string
type FSPRecord ¶
type FSPRecord struct {
File
}
type File ¶
type File struct { FileHeader RecordStart uint32 Name string Attr []byte FData []byte }
func (*File) MarshalJSON ¶
type FileAttr ¶
The common fields of extended cbfs file attributes. Attributes are expected to start with tag/len, then append their specific fields.
type FileAttrAlign ¶
type FileAttrCompression ¶
type FileAttrCompression struct { Tag Tag Size uint32 Compression Compression DecompressedSize uint32 }
type FileAttrHash ¶
type FileAttrPos ¶
type FileAttrStageHeader ¶
type FileAttrStageHeader struct { Tag Tag Size uint32 LoadAddress uint64 EntryOffset uint32 MemSize uint32 }
func (*FileAttrStageHeader) String ¶
func (h *FileAttrStageHeader) String() string
type FileHeader ¶
type FileHeader struct { Magic [8]byte Size uint32 Type FileType AttrOffset uint32 SubHeaderOffset uint32 }
func (*FileHeader) Deleted ¶
func (h *FileHeader) Deleted() bool
type FileType ¶
type FileType uint32
These are standard component types for well known
components (i.e - those that coreboot needs to consume. Users are welcome to use any other value for their components.
type Image ¶
type Image struct { Segs []ReadWriter // Scarf away the fmap info. FMAP *fmap.FMap FMAPMetadata *fmap.Metadata Area *fmap.Area // And all the data. Data []byte }
func (*Image) MarshalJSON ¶
type LegacyStageRecord ¶
type LegacyStageRecord struct { File StageHeader Data []byte }
func (*LegacyStageRecord) GetFile ¶
func (r *LegacyStageRecord) GetFile() *File
func (*LegacyStageRecord) MarshalJSON ¶
func (h *LegacyStageRecord) MarshalJSON() ([]byte, error)
func (*LegacyStageRecord) Read ¶
func (r *LegacyStageRecord) Read(in io.ReadSeeker) error
func (*LegacyStageRecord) String ¶
func (h *LegacyStageRecord) String() string
type MasterHeader ¶
type MasterRecord ¶
type MasterRecord struct { File MasterHeader }
func (*MasterRecord) GetFile ¶
func (r *MasterRecord) GetFile() *File
func (*MasterRecord) Read ¶
func (r *MasterRecord) Read(in io.ReadSeeker) error
func (*MasterRecord) String ¶
func (r *MasterRecord) String() string
type MicrocodeRecord ¶
type MicrocodeRecord struct {
File
}
func (*MicrocodeRecord) GetFile ¶
func (r *MicrocodeRecord) GetFile() *File
Header returns a pointer to the corresponding File
func (*MicrocodeRecord) Read ¶
func (r *MicrocodeRecord) Read(in io.ReadSeeker) error
func (*MicrocodeRecord) String ¶
func (r *MicrocodeRecord) String() string
type OptionRom ¶
type OptionRom struct { File Compression Compression Size uint32 }
type PayloadHeader ¶
type PayloadHeader struct { Type SegmentType Compression Compression Offset uint32 LoadAddress uint64 Size uint32 MemSize uint32 }
func (*PayloadHeader) String ¶
func (r *PayloadHeader) String() string
type PayloadRecord ¶
type PayloadRecord struct { File Segs []PayloadHeader Data []byte }
func (*PayloadRecord) GetFile ¶
func (r *PayloadRecord) GetFile() *File
func (*PayloadRecord) Read ¶
func (p *PayloadRecord) Read(in io.ReadSeeker) error
func (*PayloadRecord) String ¶
func (h *PayloadRecord) String() string
type ReadWriter ¶
type ReadWriter interface { GetFile() *File String() string Read(r io.ReadSeeker) error Write(f io.Writer) error }
Each CBFS file type must implement at least this interface.
func NewBootBlock ¶
func NewBootBlock(f *File) (ReadWriter, error)
func NewCMOSLayout ¶
func NewCMOSLayout(f *File) (ReadWriter, error)
func NewEmptyRecord ¶
func NewEmptyRecord(f *File) (ReadWriter, error)
func NewFSP ¶
func NewFSP(f *File) (ReadWriter, error)
NewFSP returns a ReadWriter interface for the CBFS type TypeFSP
func NewLegacyStageRecord ¶
func NewLegacyStageRecord(f *File) (ReadWriter, error)
func NewMaster ¶
func NewMaster(f *File) (ReadWriter, error)
func NewMicrocode ¶
func NewMicrocode(f *File) (ReadWriter, error)
NewMicrocode returns a ReadWriter interface for the CBFS type TypeMicroCode
func NewPayloadRecord ¶
func NewPayloadRecord(f *File) (ReadWriter, error)
func NewRaw ¶
func NewRaw(f *File) (ReadWriter, error)
func NewSPD ¶
func NewSPD(f *File) (ReadWriter, error)
NewSPD returns a ReadWriter for the CBFS type TypeSPD
func NewStageRecord ¶
func NewStageRecord(f *File) (ReadWriter, error)
type SPDRecord ¶
type SPDRecord struct {
File
}
type SegReader ¶
type SegReader struct { Type FileType New func(f *File) (ReadWriter, error) Name string }
type SegmentType ¶
type SegmentType uint32
fix this mess later to use characters, not constants. I had done this once and it never made it into coreboot and I still don't know why.
func (SegmentType) String ¶
func (s SegmentType) String() string
type StageHeader ¶
type StageHeader struct { Compression Compression Entry uint64 LoadAddress uint64 Size uint32 MemSize uint32 }
func (*StageHeader) String ¶
func (h *StageHeader) String() string
type StageRecord ¶
type StageRecord struct { File FileAttrStageHeader Data []byte }
func (*StageRecord) GetFile ¶
func (r *StageRecord) GetFile() *File
func (*StageRecord) Read ¶
func (r *StageRecord) Read(in io.ReadSeeker) error
func (*StageRecord) String ¶
func (h *StageRecord) String() string