flashrom

package
v0.0.0-...-f44e450 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

View Source
const (
	// DefaultDevMemPath is the default path where to look for the device
	// to access memory by physical addresses.
	DefaultDevMemPath = `/dev/mem`

	// DefaultIOMemPath is the default path to look for the lists ranges
	// of physical memory addresses.
	DefaultIOMemPath = `/proc/iomem`

	// DefaultFlashromPath is the default command for os.Exec to execute
	// "flashrom".
	DefaultFlashromPath = `flashrom`

	// DefaultDevPath is the default path where to look for various
	// devices.
	DefaultDevPath = `/dev`

	// DefaultSysFSMTDPath is the default path to look for sysfs exports
	// of MTD devices.
	DefaultSysFSMTDPath = `/sys/class/mtd`
)
View Source
const (
	// DumpMethodAuto means to pick the method automatically
	DumpMethodAuto = DumpMethod(iota)

	// DumpMethodFlashrom means to use an external tool "flashrom" to dump
	// a firmware image.
	DumpMethodFlashrom

	// DumpMethodFlashrom means to use an external tool "AFULNX64" to dump
	// a firmware image.
	DumpMethodAfulnx64

	// DumpMethodDevMem means to dump a firmware image directly from
	// physical memory ("/dev/mem", see also DefaultDevMemPath and
	// DefaultIOMemPath).
	DumpMethodDevMem

	// DumpMethodMTD means to dump a firmware image using MTD
	// ("/dev/mtd*" and "/sysfs/class/mtd", see also DefaultDevPath and
	// DefaultSysFSMTDPath).
	DumpMethodMTD
)

Variables

This section is empty.

Functions

func Dump

func Dump(ctx context.Context, opts ...Option) ([]byte, error)

Dump dumps a firmware image on the local machine

Types

type DumpMethod

type DumpMethod int

DumpMethod defines which way to use to dump a firmware image

type IOMemEntries

type IOMemEntries []*IOMemEntry

IOMemEntries is the result of GetIOMem

func GetIOMem

func GetIOMem(opts ...Option) (IOMemEntries, error)

GetIOMem returns the content of `/proc/iomem`

func ParseIOMem

func ParseIOMem(iomemBytes []byte) (IOMemEntries, error)

ParseIOMem parses `/proc/iomem` contents.

type IOMemEntry

type IOMemEntry struct {
	Start       uint64
	End         uint64
	Description string
	Children    IOMemEntries
}

IOMemEntry is one entry of `/proc/iomem`

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is an abstract option for flashrom commands.

type OptionAfulnx64Path

type OptionAfulnx64Path string

OptionAfulnx64Path is an Option which defines the command for os.Exec to execute tool "AFULNX64"

type OptionDevMemPath

type OptionDevMemPath string

OptionDevMemPath is an Option which defines the path where to look for the device to access memory by physical addresses.

type OptionDevPath

type OptionDevPath string

OptionDevPath is an Option which defines where to look for various devices.

type OptionDumpMethod

type OptionDumpMethod DumpMethod

OptionDumpMethod is an Option which defines which way to use to dump a firmware image

type OptionFirmwareFallbackLayoutPath

type OptionFirmwareFallbackLayoutPath string

OptionFirmwareFallbackLayoutPath is an Option which defines a path to a firmware layout text file.

In case if "flashrom" wasn't able to read the firmware layout table, it is possible to use a predefined layout. Such layout could be read by tool "ifdtool" using the original image of the firmware.

type OptionFlashromPath

type OptionFlashromPath string

OptionFlashromPath is an Option which defines the command for os.Exec to execute tool "flashrom".

type OptionIOMemPath

type OptionIOMemPath string

OptionIOMemPath is an Option which defines the path to look for the lists ranges of physical memory addresses.

type OptionSysFSMTDPath

type OptionSysFSMTDPath string

OptionSysFSMTDPath is an Option which defines where to look for sysfs exports of MTD devices.

Jump to

Keyboard shortcuts

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