sections

package
v0.0.0-...-341aec2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2025 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Boot2Section

type Boot2Section struct {
	*interfaces.BaseSection

	// BOOT2 specific fields
	Magic      uint32 `json:"magic"`       // Offset 0x00
	SizeDwords uint32 `json:"size_dwords"` // Offset 0x04 - size in dwords
	Reserved   uint64 `json:"reserved"`    // Offset 0x08

	// The actual boot2 code data (without header and CRC)
	CodeData []byte `json:"-"` // Binary code data - not parsed, requires raw data file
}

Boot2Section represents the BOOT2 section

func NewBoot2Section

func NewBoot2Section(base *interfaces.BaseSection) *Boot2Section

NewBoot2Section creates a new BOOT2 section from base

func (*Boot2Section) Parse

func (s *Boot2Section) Parse(data []byte) error

Parse parses the raw BOOT2 data

func (*Boot2Section) VerifyCRC

func (s *Boot2Section) VerifyCRC() error

VerifyCRC verifies the CRC for BOOT2 section BOOT2 has a special CRC format where the CRC16 is stored in the lower 16 bits of the last dword, at offset (size_dwords + 3) * 4

type CRDumpMaskDataSection

type CRDumpMaskDataSection struct {
	*interfaces.BaseSection
	Header *types.CRDumpMaskData
	Data   []byte
}

CRDumpMaskDataSection represents a CRDUMP_MASK_DATA section

func NewCRDumpMaskDataSection

func NewCRDumpMaskDataSection(base *interfaces.BaseSection) *CRDumpMaskDataSection

NewCRDumpMaskDataSection creates a new CRDumpMaskData section

func (*CRDumpMaskDataSection) MarshalJSON

func (s *CRDumpMaskDataSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the CRDUMP_MASK_DATA section

func (*CRDumpMaskDataSection) Parse

func (s *CRDumpMaskDataSection) Parse(data []byte) error

Parse parses the CRDUMP_MASK_DATA section data

type DBGFwIniSection

type DBGFwIniSection struct {
	*interfaces.BaseSection
	Header  *types.DBGFwIni
	IniData []byte // Stores the decompressed INI file content
}

DBGFwIniSection represents a DBG_FW_INI section

func NewDBGFwIniSection

func NewDBGFwIniSection(base *interfaces.BaseSection) *DBGFwIniSection

NewDBGFwIniSection creates a new DBGFwIni section

func (*DBGFwIniSection) GetExtractedData

func (s *DBGFwIniSection) GetExtractedData() []byte

GetExtractedData returns the decompressed INI data if available

func (*DBGFwIniSection) Marshal

func (s *DBGFwIniSection) Marshal() ([]byte, error)

Marshal marshals the DBGFwIniSection back to binary format

func (*DBGFwIniSection) MarshalJSON

func (s *DBGFwIniSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the DBG_FW_INI section

func (*DBGFwIniSection) Parse

func (s *DBGFwIniSection) Parse(data []byte) error

Parse parses the DBG_FW_INI section data

type DBGFwParamsSection

type DBGFwParamsSection struct {
	*interfaces.BaseSection
	Header *types.DBGFwParams
	Data   []byte
}

DBGFwParamsSection represents a DBG_FW_PARAMS section

func NewDBGFwParamsSection

func NewDBGFwParamsSection(base *interfaces.BaseSection) *DBGFwParamsSection

NewDBGFwParamsSection creates a new DBGFwParams section

func (*DBGFwParamsSection) MarshalJSON

func (s *DBGFwParamsSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the DBG_FW_PARAMS section

func (*DBGFwParamsSection) Parse

func (s *DBGFwParamsSection) Parse(data []byte) error

Parse parses the DBG_FW_PARAMS section data

type DTOCSection

type DTOCSection struct {
	*interfaces.BaseSection
	Header  *types.ITOCHeader // DTOC uses same header structure as ITOC
	Entries []*types.ITOCEntry
	// contains filtered or unexported fields
}

DTOCSection represents a DTOC (Device Table of Contents) section

func NewDTOCSection

func NewDTOCSection(base *interfaces.BaseSection) *DTOCSection

NewDTOCSection creates a new DTOC section

func (*DTOCSection) CalculateCRC

func (s *DTOCSection) CalculateCRC() (uint32, error)

CalculateCRC calculates the CRC for the DTOC section

func (*DTOCSection) MarshalJSON

func (s *DTOCSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the DTOC section

func (*DTOCSection) Parse

func (s *DTOCSection) Parse(data []byte) error

Parse parses the DTOC section data

func (*DTOCSection) VerifyCRC

func (s *DTOCSection) VerifyCRC() error

VerifyCRC verifies the DTOC section's CRC

type DefaultSectionFactory

type DefaultSectionFactory struct {
	// contains filtered or unexported fields
}

DefaultSectionFactory is the default implementation of SectionFactory

func NewDefaultSectionFactory

func NewDefaultSectionFactory() *DefaultSectionFactory

NewDefaultSectionFactory creates a new default section factory

func (*DefaultSectionFactory) CreateSection

func (f *DefaultSectionFactory) CreateSection(sectionType uint16, offset uint64, size uint32,
	crcType types.CRCType, crc uint32, isEncrypted, isDeviceData bool,
	entry *types.ITOCEntry, isFromHWPointer bool) (interfaces.CompleteSectionInterface, error)

CreateSection creates a new section instance based on the section type

func (*DefaultSectionFactory) CreateSectionFromData

func (f *DefaultSectionFactory) CreateSectionFromData(sectionType uint16, offset uint64,
	size uint32, crcType types.CRCType, crc uint32, isEncrypted, isDeviceData bool,
	entry *types.ITOCEntry, isFromHWPointer bool, data []byte) (interfaces.CompleteSectionInterface, error)

CreateSectionFromData creates a section and parses its data

type DeviceInfoSection

type DeviceInfoSection struct {
	*interfaces.BaseSection
	Info *types.DevInfo
}

DeviceInfoSection represents a Device Info section

func NewDeviceInfoSection

func NewDeviceInfoSection(base *interfaces.BaseSection) *DeviceInfoSection

NewDeviceInfoSection creates a new Device Info section

func (*DeviceInfoSection) MarshalJSON

func (s *DeviceInfoSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the Device Info section

func (*DeviceInfoSection) Parse

func (s *DeviceInfoSection) Parse(data []byte) error

Parse parses the Device Info section data

func (*DeviceInfoSection) VerifyCRC

func (s *DeviceInfoSection) VerifyCRC() error

VerifyCRC verifies the CRC for the DeviceInfo section

type DigitalCertPtrSection

type DigitalCertPtrSection struct {
	*interfaces.BaseSection
	CertPtr *types.DigitalCertPtr
}

DigitalCertPtrSection represents DIGITAL_CERT_PTR section

func NewDigitalCertPtrSection

func NewDigitalCertPtrSection(base *interfaces.BaseSection) *DigitalCertPtrSection

NewDigitalCertPtrSection creates a new DigitalCertPtr section

func (*DigitalCertPtrSection) MarshalJSON

func (s *DigitalCertPtrSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the DIGITAL_CERT_PTR section

func (*DigitalCertPtrSection) Parse

func (s *DigitalCertPtrSection) Parse(data []byte) error

Parse parses the DIGITAL_CERT_PTR section data

type DigitalCertRWSection

type DigitalCertRWSection struct {
	*interfaces.BaseSection
	Cert *types.DigitalCertRW
}

DigitalCertRWSection represents DIGITAL_CERT_RW section

func NewDigitalCertRWSection

func NewDigitalCertRWSection(base *interfaces.BaseSection) *DigitalCertRWSection

NewDigitalCertRWSection creates a new DigitalCertRW section

func (*DigitalCertRWSection) MarshalJSON

func (s *DigitalCertRWSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the DIGITAL_CERT_RW section

func (*DigitalCertRWSection) Parse

func (s *DigitalCertRWSection) Parse(data []byte) error

Parse parses the DIGITAL_CERT_RW section data

type FWAdbSection

type FWAdbSection struct {
	*interfaces.BaseSection
	Header *types.FWAdb
	Data   []byte
}

FWAdbSection represents a FW_ADB section

func NewFWAdbSection

func NewFWAdbSection(base *interfaces.BaseSection) *FWAdbSection

NewFWAdbSection creates a new FWAdb section

func (*FWAdbSection) MarshalJSON

func (s *FWAdbSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the FW_ADB section

func (*FWAdbSection) Parse

func (s *FWAdbSection) Parse(data []byte) error

Parse parses the FW_ADB section data

type FWInternalUsageSection

type FWInternalUsageSection struct {
	*interfaces.BaseSection
	Header *types.FWInternalUsage
	Data   []byte
}

FWInternalUsageSection represents a FW_INTERNAL_USAGE section

func NewFWInternalUsageSection

func NewFWInternalUsageSection(base *interfaces.BaseSection) *FWInternalUsageSection

NewFWInternalUsageSection creates a new FWInternalUsage section

func (*FWInternalUsageSection) MarshalJSON

func (s *FWInternalUsageSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the FW_INTERNAL_USAGE section

func (*FWInternalUsageSection) Parse

func (s *FWInternalUsageSection) Parse(data []byte) error

Parse parses the FW_INTERNAL_USAGE section data

type FWNVLogSection

type FWNVLogSection struct {
	*interfaces.BaseSection
	Header *types.FWNVLog
	Data   []byte
}

FWNVLogSection represents a FW_NV_LOG section

func NewFWNVLogSection

func NewFWNVLogSection(base *interfaces.BaseSection) *FWNVLogSection

NewFWNVLogSection creates a new FWNVLog section

func (*FWNVLogSection) MarshalJSON

func (s *FWNVLogSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the FW_NV_LOG section

func (*FWNVLogSection) Parse

func (s *FWNVLogSection) Parse(data []byte) error

Parse parses the FW_NV_LOG section data

type ForbiddenVersionsSection

type ForbiddenVersionsSection struct {
	*interfaces.BaseSection
	ForbiddenVersions *types.ForbiddenVersions `json:"forbidden_versions,omitempty"`
}

ForbiddenVersionsSection represents a FORBIDDEN_VERSIONS section

func NewForbiddenVersionsSection

func NewForbiddenVersionsSection(base *interfaces.BaseSection) *ForbiddenVersionsSection

NewForbiddenVersionsSection creates a new ForbiddenVersions section

func (*ForbiddenVersionsSection) Parse

func (s *ForbiddenVersionsSection) Parse(data []byte) error

Parse parses the FORBIDDEN_VERSIONS section data

type GenericSection

type GenericSection struct {
	*interfaces.BaseSection
	// contains filtered or unexported fields
}

GenericSection represents a generic/unknown section type

func NewGenericSection

func NewGenericSection(base *interfaces.BaseSection) *GenericSection

NewGenericSection creates a new generic section

func (*GenericSection) CalculateCRC

func (s *GenericSection) CalculateCRC() (uint32, error)

CalculateCRC calculates the CRC for the generic section

func (*GenericSection) MarshalJSON

func (s *GenericSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the generic section

func (*GenericSection) Parse

func (s *GenericSection) Parse(data []byte) error

Parse stores the raw data for generic sections

func (*GenericSection) VerifyCRC

func (s *GenericSection) VerifyCRC() error

VerifyCRC verifies the section's CRC using the BaseSection implementation which properly uses the CRC handlers set up by the factory

type HWPointerSection

type HWPointerSection struct {
	*interfaces.BaseSection
	FS4Pointers *types.FS4HWPointers `json:"fs4_pointers,omitempty"`
	FS5Pointers *types.FS5HWPointers `json:"fs5_pointers,omitempty"`
	Format      types.FirmwareFormat `json:"format,omitempty"`
}

HWPointerSection represents a Hardware Pointer section

func NewHWPointerSection

func NewHWPointerSection(base *interfaces.BaseSection) *HWPointerSection

NewHWPointerSection creates a new HW Pointer section

func (*HWPointerSection) Parse

func (s *HWPointerSection) Parse(data []byte) error

Parse parses the HW Pointer section data

type HashesTableSection

type HashesTableSection struct {
	*interfaces.BaseSection
	Header       *types.HashesTableHeader `json:"header,omitempty"`
	Entries      []*types.HashTableEntry  `json:"entries,omitempty"`
	ReservedTail types.FWByteSlice        `json:"reserved_tail,omitempty"` // Reserved data at the end of the section after entries
}

HashesTableSection represents a Hashes Table section

func NewHashesTableSection

func NewHashesTableSection(base *interfaces.BaseSection) *HashesTableSection

NewHashesTableSection creates a new Hashes Table section

func (*HashesTableSection) Parse

func (s *HashesTableSection) Parse(data []byte) error

Parse parses the Hashes Table section data

type ITOCSection

type ITOCSection struct {
	*interfaces.BaseSection
	Header  *types.ITOCHeader
	Entries []*types.ITOCEntry
	// contains filtered or unexported fields
}

ITOCSection represents an ITOC (Image Table of Contents) section

func NewITOCSection

func NewITOCSection(base *interfaces.BaseSection) *ITOCSection

NewITOCSection creates a new ITOC section

func (*ITOCSection) CalculateCRC

func (s *ITOCSection) CalculateCRC() (uint32, error)

CalculateCRC calculates the CRC for the ITOC section

func (*ITOCSection) MarshalJSON

func (s *ITOCSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the ITOC section

func (*ITOCSection) Parse

func (s *ITOCSection) Parse(data []byte) error

Parse parses the ITOC section data

func (*ITOCSection) VerifyCRC

func (s *ITOCSection) VerifyCRC() error

VerifyCRC verifies the ITOC section's CRC

type ImageInfoSection

type ImageInfoSection struct {
	*interfaces.BaseSection
	Info *types.ImageInfo
	// contains filtered or unexported fields
}

ImageInfoSection represents an Image Info section

func NewImageInfoSection

func NewImageInfoSection(base *interfaces.BaseSection) *ImageInfoSection

NewImageInfoSection creates a new Image Info section

func (*ImageInfoSection) CalculateCRC

func (s *ImageInfoSection) CalculateCRC() (uint32, error)

CalculateCRC calculates the CRC for the Image Info section

func (*ImageInfoSection) MarshalJSON

func (s *ImageInfoSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the Image Info section

func (*ImageInfoSection) Parse

func (s *ImageInfoSection) Parse(data []byte) error

Parse parses the Image Info section data

type ImageSignature2Section

type ImageSignature2Section struct {
	*interfaces.BaseSection
	ImageSignature *types.ImageSignature2 `json:"image_signature,omitempty"`
	Padding        types.FWByteSlice      `json:"padding,omitempty"`
}

ImageSignature2Section represents an IMAGE_SIGNATURE_512 section

func NewImageSignature2Section

func NewImageSignature2Section(base *interfaces.BaseSection) *ImageSignature2Section

NewImageSignature2Section creates a new ImageSignature2 section

func (*ImageSignature2Section) Parse

func (s *ImageSignature2Section) Parse(data []byte) error

Parse parses the IMAGE_SIGNATURE_512 section data

type ImageSignatureSection

type ImageSignatureSection struct {
	*interfaces.BaseSection
	ImageSignature *types.ImageSignature `json:"image_signature,omitempty"`
	Padding        types.FWByteSlice     `json:"padding,omitempty"`
}

ImageSignatureSection represents an IMAGE_SIGNATURE_256 section

func NewImageSignatureSection

func NewImageSignatureSection(base *interfaces.BaseSection) *ImageSignatureSection

NewImageSignatureSection creates a new ImageSignature section

func (*ImageSignatureSection) Parse

func (s *ImageSignatureSection) Parse(data []byte) error

Parse parses the IMAGE_SIGNATURE section data

type MFGInfoSection

type MFGInfoSection struct {
	*interfaces.BaseSection
	MfgInfo *types.MfgInfo `json:"mfg_info,omitempty"`
}

MFGInfoSection represents a Manufacturing Info section

func NewMFGInfoSection

func NewMFGInfoSection(base *interfaces.BaseSection) *MFGInfoSection

NewMFGInfoSection creates a new MFG Info section

func (*MFGInfoSection) Parse

func (s *MFGInfoSection) Parse(data []byte) error

Parse parses the MFG Info section data

type NVDataSection

type NVDataSection struct {
	*interfaces.BaseSection
	Header *types.NVData
	Data   []byte
}

NVDataSection represents NV_DATA sections

func NewNVDataSection

func NewNVDataSection(base *interfaces.BaseSection) *NVDataSection

NewNVDataSection creates a new NVData section

func (*NVDataSection) MarshalJSON

func (s *NVDataSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the NV_DATA section

func (*NVDataSection) Parse

func (s *NVDataSection) Parse(data []byte) error

Parse parses the NV_DATA section data

type ProgrammableHWFWSection

type ProgrammableHWFWSection struct {
	*interfaces.BaseSection
	Header *types.ProgrammableHWFW
	Data   []byte
}

ProgrammableHWFWSection represents PROGRAMMABLE_HW_FW sections

func NewProgrammableHWFWSection

func NewProgrammableHWFWSection(base *interfaces.BaseSection) *ProgrammableHWFWSection

NewProgrammableHWFWSection creates a new ProgrammableHWFW section

func (*ProgrammableHWFWSection) MarshalJSON

func (s *ProgrammableHWFWSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the PROGRAMMABLE_HW_FW section

func (*ProgrammableHWFWSection) Parse

func (s *ProgrammableHWFWSection) Parse(data []byte) error

Parse parses the PROGRAMMABLE_HW_FW section data

type PublicKeys2Section

type PublicKeys2Section struct {
	*interfaces.BaseSection
	PublicKeys *types.PublicKeys2 `json:"public_keys,omitempty"`
}

PublicKeys2Section represents a PUBLIC_KEYS_4096 section

func NewPublicKeys2Section

func NewPublicKeys2Section(base *interfaces.BaseSection) *PublicKeys2Section

NewPublicKeys2Section creates a new PublicKeys2 section

func (*PublicKeys2Section) Parse

func (s *PublicKeys2Section) Parse(data []byte) error

Parse parses the PUBLIC_KEYS_4096 section data

type PublicKeysSection

type PublicKeysSection struct {
	*interfaces.BaseSection
	PublicKeys *types.PublicKeys `json:"public_keys,omitempty"`
}

PublicKeysSection represents a PUBLIC_KEYS_2048 section

func NewPublicKeysSection

func NewPublicKeysSection(base *interfaces.BaseSection) *PublicKeysSection

NewPublicKeysSection creates a new PublicKeys section

func (*PublicKeysSection) Parse

func (s *PublicKeysSection) Parse(data []byte) error

Parse parses the PUBLIC_KEYS section data

type ResetInfoSection

type ResetInfoSection struct {
	*interfaces.BaseSection
	ResetInfo *types.ResetInfo
}

ResetInfoSection represents a RESET_INFO section

func NewResetInfoSection

func NewResetInfoSection(base *interfaces.BaseSection) *ResetInfoSection

NewResetInfoSection creates a new ResetInfo section

func (*ResetInfoSection) MarshalJSON

func (s *ResetInfoSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the RESET_INFO section

func (*ResetInfoSection) Parse

func (s *ResetInfoSection) Parse(data []byte) error

Parse parses the RESET_INFO section data

type ToolsAreaExtendedSection

type ToolsAreaExtendedSection struct {
	*interfaces.BaseSection
	ToolsArea *types.ToolsAreaExtended
}

ToolsAreaExtendedSection represents a TOOLS_AREA section with extended parsing

func NewToolsAreaExtendedSection

func NewToolsAreaExtendedSection(base *interfaces.BaseSection) *ToolsAreaExtendedSection

NewToolsAreaExtendedSection creates a new ToolsAreaExtended section

func (*ToolsAreaExtendedSection) MarshalJSON

func (s *ToolsAreaExtendedSection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the TOOLS_AREA section

func (*ToolsAreaExtendedSection) Parse

func (s *ToolsAreaExtendedSection) Parse(data []byte) error

Parse parses the TOOLS_AREA section data

func (*ToolsAreaExtendedSection) VerifyCRC

func (s *ToolsAreaExtendedSection) VerifyCRC() error

VerifyCRC verifies the CRC for TOOLS_AREA section TOOLS_AREA has a special CRC format: 16-bit CRC at offset 62-63

type VPD_R0Section

type VPD_R0Section struct {
	*interfaces.BaseSection
	Header *types.VPD_R0
	Data   []byte
}

VPD_R0Section represents a VPD_R0 section

func NewVPD_R0Section

func NewVPD_R0Section(base *interfaces.BaseSection) *VPD_R0Section

NewVPD_R0Section creates a new VPD_R0 section

func (*VPD_R0Section) MarshalJSON

func (s *VPD_R0Section) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON representation of the VPD_R0 section

func (*VPD_R0Section) Parse

func (s *VPD_R0Section) Parse(data []byte) error

Parse parses the VPD_R0 section data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL