Version: v0.0.0-...-c97c800 Latest Latest

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

Go to latest
Published: Feb 6, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0



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



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

Magic values used in the zImage header and table.


This section is empty.


This section is empty.


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:


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:


type Tag

type Tag uint32

Tag is used to identify a TableEntry.

const (
	TagKernelSize Tag = 0x5a534c4b

Tags used by TableEntry (at the time of writting, 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.

Source Files

Jump to

Keyboard shortcuts

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