summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReka Norman <rekanorman@google.com>2021-09-16 10:50:02 +1000
committerFurquan Shaikh <furquan@google.com>2021-09-21 17:21:49 +0000
commitf4be6f6d859938b22dd62785a13ef3df2f80143d (patch)
treeabd192386c56e1020d11d2234b26d9aceb6e259e
parent4e4e2d7ab1fbb6a6c744b3fed9072f92706b5952 (diff)
util/spd_tools: Add 'Generated by' string to part_id_gen output files
Add a 'Generated by' string to the generated Makefile.inc and dram_id.generated.txt, showing the command used to generate the files. BUG=b:191776301 TEST=Run part_id_gen, check that the generated files contain the string Signed-off-by: Reka Norman <rekanorman@google.com> Change-Id: Ic9a7826212a732288f36f111b7bc20365a1f702d Reviewed-on: https://review.coreboot.org/c/coreboot/+/57692 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Maxim Polyakov <max.senia.poliak@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com>
-rw-r--r--util/spd_tools/src/part_id_gen/part_id_gen.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/util/spd_tools/src/part_id_gen/part_id_gen.go b/util/spd_tools/src/part_id_gen/part_id_gen.go
index 10388bfbf9..781c244cd4 100644
--- a/util/spd_tools/src/part_id_gen/part_id_gen.go
+++ b/util/spd_tools/src/part_id_gen/part_id_gen.go
@@ -244,6 +244,13 @@ type partIds struct {
memParts string
}
+func getFileHeader() string {
+ return `# SPDX-License-Identifier: GPL-2.0-or-later
+# This is an auto-generated file. Do not edit!!
+# Generated by:
+` + fmt.Sprintf("# %s\n\n", strings.Join(os.Args[0:], " "))
+}
+
/*
* For each part used by the variant, check if the SPD (as per the manifest) already has an ID
* assigned to it. If yes, then add the part name to the list of memory parts supported by the
@@ -339,22 +346,19 @@ func genPartIdInfo(parts []usedPart, partToSPDMap map[string]string, SPDToIndexM
}
fmt.Printf("%s", s)
+
+ s = getFileHeader() + s
err := ioutil.WriteFile(filepath.Join(makefileDirName, DRAMIdFileName), []byte(s), 0644)
return partIdList, err
}
-var generatedCodeLicense string = "## SPDX-License-Identifier: GPL-2.0-or-later"
-var autoGeneratedInfo string = "## This is an auto-generated file. Do not edit!!"
-
/*
* This function generates Makefile.inc under the variant directory path and adds assigned SPDs
* to SPD_SOURCES.
*/
func genMakefile(partIdList []partIds, makefileDirName string, SPDDir string) error {
- var s string
-
- s += fmt.Sprintf("%s\n%s\n\n", generatedCodeLicense, autoGeneratedInfo)
+ s := getFileHeader()
s += fmt.Sprintf("SPD_SOURCES =\n")
for i := 0; i < len(partIdList); i++ {