https://github.com/mimoja/amdfw
golang library to parse AMD Firmware Structures
https://github.com/mimoja/amdfw
Last synced: about 1 year ago
JSON representation
golang library to parse AMD Firmware Structures
- Host: GitHub
- URL: https://github.com/mimoja/amdfw
- Owner: Mimoja
- License: gpl-3.0
- Created: 2019-06-18T07:02:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-17T17:49:26.000Z (over 5 years ago)
- Last Synced: 2024-06-19T03:05:41.561Z (almost 2 years ago)
- Language: Go
- Size: 37.1 KB
- Stars: 14
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# amdfw
Golang library for reading and writing AMD firmware components
Credit goes to @cwerling for his [psptool](https://github.com/cwerling/psptool)
## amddump
cmd/amddump is a small tool, that dumps all informations known to this library on a specfic image.
```
amddump ryzeimage.rom
```
## Current Limitations
- Always assumes valid FirmwareEntryTable.
- Some AM1 CPUs are not using it.
- Older FETs might be parsed wrong
- Non Directory-Based Firmware (IMC, GEC, XHCI) cannot be extracted
- All Offsets are treated as absolute. Partial Images often can't be read.
## Usage
See cmd/amddump.go for read-only example code.
```golang
func main() {
imageBytes, err := ioutil.ReadFile(os.Args[1])
if err != nil {
log.Fatal("Could not read file: ", err)
}
image, err := amdfw.ParseImage(imageBytes)
if err != nil {
log.Println("Error while parse Image: ", err.Error())
}
targetAddress := uint32(0x1C1000)
image.FET.ImcRomBase = &targetAddress
image.FET.Write(imageBytes, image.FET.Location)
ioutil.WriteFile(os.Args[1], imageBytes, 666)
}
```