[coreboot-gerrit] New patch to review for coreboot: 65ae1a6 autoport: Strip inc, co and corp suffixes from vendor name

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Fri May 29 22:51:34 CEST 2015


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10372

-gerrit

commit 65ae1a64d5d75f03e78aa3e45bbf2119925980fd
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Fri May 29 21:43:51 2015 +0200

    autoport: Strip inc, co and corp suffixes from vendor name
    
    Apple is named Apple Inc in DMI but is "apple" in coreboot naming.
    For other vendors we should follow similar pattern.
    
    Change-Id: I7975b19faaf942c5bd44a704bcee994815499ceb
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 util/autoport/main.go | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/util/autoport/main.go b/util/autoport/main.go
index e9d847d..fb16a45 100644
--- a/util/autoport/main.go
+++ b/util/autoport/main.go
@@ -90,6 +90,7 @@ type Context struct {
 	Model         string
 	BaseDirectory string
 	InfoSource    DevReader
+	SaneVendor string
 }
 
 type IOAPICIRQ struct {
@@ -622,7 +623,7 @@ const MoboDir = "/src/mainboard/"
 
 func makeVendor(ctx Context) {
 	vendor := ctx.Vendor
-	vendorSane := sanitize(ctx.Vendor)
+	vendorSane := ctx.SaneVendor
 	vendorDir := *FlagOutDir + MoboDir + vendorSane
 	vendorUpper := strings.ToUpper(vendorSane)
 	kconfig := vendorDir + "/Kconfig"
@@ -682,6 +683,7 @@ func GuessSPDMap(ctx Context) []uint8 {
 	return []uint8{0x50, 0x52, 0x51, 0x53}
 }
 
+
 func main() {
 	flag.Parse()
 
@@ -702,8 +704,18 @@ func main() {
 	if dmi.IsLaptop {
 		KconfigBool["SYSTEM_TYPE_LAPTOP"] = true
 	}
-	ctx.MoboID = sanitize(ctx.Vendor) + "/" + sanitize(ctx.Model)
-	ctx.KconfigName = "BOARD_" + strings.ToUpper(sanitize(ctx.Vendor)+"_"+sanitize(ctx.Model))
+	ctx.SaneVendor = sanitize(ctx.Vendor)
+	for {
+		last := ctx.SaneVendor
+		for _, suf := range []string{"_inc", "_co", "_corp"} {
+			ctx.SaneVendor = strings.TrimSuffix(ctx.SaneVendor, suf)
+		}
+		if (last == ctx.SaneVendor) {
+			break
+		}
+	}
+	ctx.MoboID = ctx.SaneVendor + "/" + sanitize(ctx.Model)
+	ctx.KconfigName = "BOARD_" + strings.ToUpper(ctx.SaneVendor+"_"+sanitize(ctx.Model))
 	ctx.BaseDirectory = *FlagOutDir + MoboDir + ctx.MoboID
 	KconfigStringUnquoted["MAINBOARD_DIR"] = ctx.MoboID
 	KconfigString["MAINBOARD_PART_NUMBER"] = ctx.Model



More information about the coreboot-gerrit mailing list