zimage

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: BSD-3-Clause Imports: 3 Imported by: 7

Documentation

Overview

Package zimage contains a Parser for the arm zImage Linux format. It assumes little endian arm.

Index

Constants

View Source
const (
	Magic      = 0x016f2818
	Endianess  = 0x04030201
	TableMagic = 0x45454545
)

Magic values used in the zImage header and table.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Magic      uint32
	Start      uint32
	End        uint32
	Endianess  uint32
	TableMagic uint32
	TableAddr  uint32
}

Header appears near the beginning of the zImage.

The layout is defined in Linux:

arch/arm/boot/compressed/head.S

type TableEntry

type TableEntry struct {
	Tag  Tag
	Data []uint32
}

TableEntry is an extension to Header. A zImage may have 0 or more entries.

The layout is defined in Linux:

arch/arm/boot/compressed/vmlinux.lds.S

type Tag

type Tag uint32

Tag is used to identify a TableEntry.

const (
	TagKernelSize Tag = 0x5a534c4b
)

Tags used by TableEntry (at the time of writing, there is only one tag).

type ZImage

type ZImage struct {
	Header Header
	Table  []TableEntry
}

ZImage is one of the major formats used by Linux on ARM. This struct is only for storing the metadata.

func Parse

func Parse(f io.ReadSeeker) (*ZImage, error)

Parse a ZImage from a file.

func (*ZImage) GetEntry

func (z *ZImage) GetEntry(t Tag) (*TableEntry, error)

GetEntry searches through the zImage table for the given tag.

func (*ZImage) GetKernelSizes

func (z *ZImage) GetKernelSizes() (piggySizeAddr uint32, kernelBSSSize uint32, err error)

GetKernelSizes returns two kernel sizes relevant for kexec.

Jump to

Keyboard shortcuts

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