Commit 84629e5 1 parent b0fd406 commit 84629e5 Copy full SHA for 84629e5
File tree 2 files changed +96
-0
lines changed
2 files changed +96
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2017-2018 the LinuxBoot Authors. All rights reserved
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ // fspinfo prints FSP header information.
6
+
7
+ package main
8
+
9
+ import (
10
+ "bytes"
11
+ "encoding/json"
12
+ "flag"
13
+ "fmt"
14
+ "os"
15
+
16
+ "github.com/linuxboot/fiano/pkg/intel/metadata/bg/bgbootpolicy"
17
+ "github.com/linuxboot/fiano/pkg/log"
18
+ )
19
+
20
+ var (
21
+ flagJSON = flag .Bool ("j" , false , "Output as JSON" )
22
+ )
23
+
24
+ func main () {
25
+ flag .Parse ()
26
+ if flag .Arg (0 ) == "" {
27
+ log .Fatalf ("missing file name" )
28
+ }
29
+ data , err := os .ReadFile (flag .Arg (0 ))
30
+ if err != nil {
31
+ log .Fatalf ("cannot read input file: %v" , err )
32
+ }
33
+ m := bgbootpolicy.Manifest {}
34
+ _ , err = m .ReadFrom (bytes .NewReader (data ))
35
+ if err != nil {
36
+ log .Fatalf ("%v" , err )
37
+ }
38
+
39
+ j , err := json .MarshalIndent (m , "" , " " )
40
+ if err != nil {
41
+ log .Fatalf ("cannot marshal JSON: %v" , err )
42
+ }
43
+ if * flagJSON {
44
+ fmt .Println (string (j ))
45
+ } else {
46
+ fmt .Print (m .PrettyString (0 , true ))
47
+ }
48
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2017-2018 the LinuxBoot Authors. All rights reserved
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ // fspinfo prints FSP header information.
6
+
7
+ package main
8
+
9
+ import (
10
+ "bytes"
11
+ "encoding/json"
12
+ "flag"
13
+ "fmt"
14
+ "os"
15
+
16
+ "github.com/linuxboot/fiano/pkg/intel/metadata/cbnt/cbntkey"
17
+ "github.com/linuxboot/fiano/pkg/log"
18
+ )
19
+
20
+ var (
21
+ flagJSON = flag .Bool ("j" , false , "Output as JSON" )
22
+ )
23
+
24
+ func main () {
25
+ flag .Parse ()
26
+ if flag .Arg (0 ) == "" {
27
+ log .Fatalf ("missing file name" )
28
+ }
29
+ data , err := os .ReadFile (flag .Arg (0 ))
30
+ if err != nil {
31
+ log .Fatalf ("cannot read input file: %v" , err )
32
+ }
33
+ m := cbntkey.Manifest {}
34
+ _ , err = m .ReadFrom (bytes .NewReader (data ))
35
+ if err != nil {
36
+ log .Fatalf ("%v" , err )
37
+ }
38
+
39
+ j , err := json .MarshalIndent (m , "" , " " )
40
+ if err != nil {
41
+ log .Fatalf ("cannot marshal JSON: %v" , err )
42
+ }
43
+ if * flagJSON {
44
+ fmt .Println (string (j ))
45
+ } else {
46
+ fmt .Print (m .PrettyString (0 , true ))
47
+ }
48
+ }
You can’t perform that action at this time.
0 commit comments