-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: more Intel metadata utilty commands (to be discarded)
Signed-off-by: Daniel Maslowski <[email protected]>
- Loading branch information
Showing
2 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2017-2018 the LinuxBoot Authors. All rights reserved | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// fspinfo prints FSP header information. | ||
|
||
package main | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/linuxboot/fiano/pkg/intel/metadata/bg/bgbootpolicy" | ||
"github.com/linuxboot/fiano/pkg/log" | ||
) | ||
|
||
var ( | ||
flagJSON = flag.Bool("j", false, "Output as JSON") | ||
) | ||
|
||
func main() { | ||
flag.Parse() | ||
if flag.Arg(0) == "" { | ||
log.Fatalf("missing file name") | ||
} | ||
data, err := os.ReadFile(flag.Arg(0)) | ||
if err != nil { | ||
log.Fatalf("cannot read input file: %v", err) | ||
} | ||
m := bgbootpolicy.Manifest{} | ||
_, err = m.ReadFrom(bytes.NewReader(data)) | ||
if err != nil { | ||
log.Fatalf("%v", err) | ||
} | ||
|
||
j, err := json.MarshalIndent(m, "", " ") | ||
if err != nil { | ||
log.Fatalf("cannot marshal JSON: %v", err) | ||
} | ||
if *flagJSON { | ||
fmt.Println(string(j)) | ||
} else { | ||
fmt.Print(m.PrettyString(0, true)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2017-2018 the LinuxBoot Authors. All rights reserved | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// fspinfo prints FSP header information. | ||
|
||
package main | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/linuxboot/fiano/pkg/intel/metadata/cbnt/cbntkey" | ||
"github.com/linuxboot/fiano/pkg/log" | ||
) | ||
|
||
var ( | ||
flagJSON = flag.Bool("j", false, "Output as JSON") | ||
) | ||
|
||
func main() { | ||
flag.Parse() | ||
if flag.Arg(0) == "" { | ||
log.Fatalf("missing file name") | ||
} | ||
data, err := os.ReadFile(flag.Arg(0)) | ||
if err != nil { | ||
log.Fatalf("cannot read input file: %v", err) | ||
} | ||
m := cbntkey.Manifest{} | ||
_, err = m.ReadFrom(bytes.NewReader(data)) | ||
if err != nil { | ||
log.Fatalf("%v", err) | ||
} | ||
|
||
j, err := json.MarshalIndent(m, "", " ") | ||
if err != nil { | ||
log.Fatalf("cannot marshal JSON: %v", err) | ||
} | ||
if *flagJSON { | ||
fmt.Println(string(j)) | ||
} else { | ||
fmt.Print(m.PrettyString(0, true)) | ||
} | ||
} |