15 var ClobberDir
= flag
.Bool("clobber", false, "Clobber temporary output when finished. Useful for debugging.")
17 func RunAndSave(output
string, name
string, arg
...string) {
18 cmd
:= exec
.Command(name
, arg
...)
20 f
, err
:= os
.Create(output
)
35 /* Missing features: serial, upload, ssh */
40 cb
, err
:= cbfs
.OpenROM()
44 config
, err
:= cb
.GetFile("config")
48 revision
, err
:= cb
.GetFile("revision")
53 parsedConfig
:= kconfig
.ParseKConfig(config
)
54 mainboardDir
:= kconfig
.UnQuote(parsedConfig
["CONFIG_MAINBOARD_DIR"])
56 tempDir
, err
:= ioutil
.TempDir("", "coreboot_board_status")
61 tbl
, err
:= cbtables
.Open()
66 taggedVersion
, err
:= tbl
.GetVersion()
70 versionTimestamp
, err
:= tbl
.GetVersionTimestamp()
74 timestampFormated
:= versionTimestamp
.UTC().Format("2006-01-02T15:04:05Z")
75 outputDir
:= tempDir
+ "/" + mainboardDir
+ "/" + taggedVersion
+ "/" + timestampFormated
76 os
.MkdirAll(outputDir
, 0755)
77 fmt
.Printf("Temporarily placing output in %s\n", outputDir
)
78 cf
, err
:= os
.Create(outputDir
+ "/cbfs.txt")
83 fmt
.Fprintf(cf
, "%v", cb
)
85 cf
, err
= os
.Create(outputDir
+ "/config.txt")
92 cf
, err
= os
.Create(outputDir
+ "/revision.txt")
99 RunAndSave(outputDir
+"/kernel_log.txt", "dmesg")
101 cons
, lost
, err
:= tbl
.GetConsole()
106 cf
, err
= os
.Create(outputDir
+ "/coreboot_console.txt")
115 fmt
.Fprintf(cf
, "\none byte lost\n")
117 fmt
.Fprintf(cf
, "\n%d bytes lost\n", lost
)
119 timest
, err
:= tbl
.GetTimestamps()
124 ts
, err
:= os
.Create(outputDir
+ "/coreboot_timestamps.txt")
129 fmt
.Fprintf(ts
, "%v", timest
)
132 os
.RemoveAll(tempDir
)