Skip to content

Commit

Permalink
intelana fixup
Browse files Browse the repository at this point in the history
example from parsing System76 Lemp10 image:
```
== IFD ==
BIOS  region not found: invalid FV length (is greater than the data length): 211669285660000467 > 9199616
ME    region not found: invalid FV length (is greater than the data length): 211669285660000467 > 9199616
GBE   region not found: invalid FV length (is greater than the data length): 211669285660000467 > 9199616
PTT   region not found: invalid FV length (is greater than the data length): 211669285660000467 > 9199616
EC    region not found: invalid FV length (is greater than the data length): 211669285660000467 > 9199616
ucode region not found: invalid FV length (is greater than the data length): 211669285660000467 > 9199616

== FIT ==
{
  "Address": 15420327944232370193,
  "Size": 0,
  "Reserved": 5,
  "Version": {
    "maj": 255,
    "min": 255
  },
  "Type": 127,
  "IsChecksumValid": true,
  "Checksum": 255
}
```

Something is odd here.

Signed-off-by: Daniel Maslowski <[email protected]>
  • Loading branch information
orangecms committed Sep 22, 2024
1 parent a1dab0a commit 63ecbc6
Showing 1 changed file with 39 additions and 15 deletions.
54 changes: 39 additions & 15 deletions cmds/intelana/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,51 @@ func main() {
flag.Parse()
args := flag.Args()

var path string

if len(args) > 0 {
path = args[0]
path := args[0]
data, err := ioutil.ReadFile(path)
if err != nil {
log.Fatal(err)
}

fmt.Printf("\n== IFD ==\n")
a, b, err := ifd.GetRegion(data, uefi.RegionTypeBIOS)
fmt.Printf("BIOS offset %x size %x\n", a, b)
a, b, err = ifd.GetRegion(data, uefi.RegionTypeME)
fmt.Printf("ME offset %x size %x\n", a, b)
a, b, err = ifd.GetRegion(data, uefi.RegionTypeGBE)
fmt.Printf("GBE offset %x size %x\n", a, b)
a, b, err = ifd.GetRegion(data, uefi.RegionTypePTT)
fmt.Printf("PTT offset %x size %x\n", a, b)
a, b, err = ifd.GetRegion(data, uefi.RegionTypeEC)
fmt.Printf("EC offset %x size %x\n", a, b)
a, b, err = ifd.GetRegion(data, uefi.RegionTypeMicrocode)
fmt.Printf("ucode offset %x size %x\n", a, b)
o, s, err := ifd.GetRegion(data, uefi.RegionTypeBIOS)
if err != nil {
fmt.Printf("BIOS region not found: %s\n", err)
} else {
fmt.Printf("BIOS offset %x size %x\n", o, s)
}
o, s, err = ifd.GetRegion(data, uefi.RegionTypeME)
if err != nil {
fmt.Printf("ME region not found: %s\n", err)
} else {
fmt.Printf("ME offset %x size %x\n", o, s)
}
o, s, err = ifd.GetRegion(data, uefi.RegionTypeGBE)
if err != nil {
fmt.Printf("GBE region not found: %s\n", err)
} else {
fmt.Printf("GBE offset %x size %x\n", o, s)
}
o, s, err = ifd.GetRegion(data, uefi.RegionTypePTT)
if err != nil {
fmt.Printf("PTT region not found: %s\n", err)
} else {
fmt.Printf("PTT offset %x size %x\n", o, s)
}
o, s, err = ifd.GetRegion(data, uefi.RegionTypeEC)
if err != nil {
fmt.Printf("EC region not found: %s\n", err)
} else {
fmt.Printf("EC offset %x size %x\n", o, s)
}
o, s, err = ifd.GetRegion(data, uefi.RegionTypeMicrocode)
if err != nil {
fmt.Printf("ucode region not found: %s\n", err)
} else {
fmt.Printf("ucode offset %x size %x\n", o, s)
}

fmt.Printf("\n== FIT ==\n")
file, err := os.Open(path)

Check failure on line 66 in cmds/intelana/main.go

View workflow job for this annotation

GitHub Actions / lint (1.21, ubuntu-latest)

SA4006: this value of `err` is never used (staticcheck)

Check failure on line 66 in cmds/intelana/main.go

View workflow job for this annotation

GitHub Actions / lint (1.21, macos-latest)

SA4006: this value of `err` is never used (staticcheck)

Check failure on line 66 in cmds/intelana/main.go

View workflow job for this annotation

GitHub Actions / lint (1.22, ubuntu-latest)

SA4006: this value of `err` is never used (staticcheck)
headers, err := fit.ParseEntryHeadersFrom(file)

Check failure on line 67 in cmds/intelana/main.go

View workflow job for this annotation

GitHub Actions / lint (1.21, ubuntu-latest)

SA4006: this value of `err` is never used (staticcheck)

Check failure on line 67 in cmds/intelana/main.go

View workflow job for this annotation

GitHub Actions / lint (1.21, macos-latest)

SA4006: this value of `err` is never used (staticcheck)

Check failure on line 67 in cmds/intelana/main.go

View workflow job for this annotation

GitHub Actions / lint (1.22, ubuntu-latest)

SA4006: this value of `err` is never used (staticcheck)
Expand Down

0 comments on commit 63ecbc6

Please sign in to comment.