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@gmail.com>
Reviewed-on: http://review.coreboot.org/10372
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <edward.ocallaghan@koparo.com>
This commit is contained in:
Vladimir Serbinenko 2015-05-29 21:43:51 +02:00
parent 68f5f62fca
commit 2d615e58da
1 changed files with 14 additions and 3 deletions

View File

@ -90,6 +90,7 @@ type Context struct {
Model string Model string
BaseDirectory string BaseDirectory string
InfoSource DevReader InfoSource DevReader
SaneVendor string
} }
type IOAPICIRQ struct { type IOAPICIRQ struct {
@ -622,7 +623,7 @@ const MoboDir = "/src/mainboard/"
func makeVendor(ctx Context) { func makeVendor(ctx Context) {
vendor := ctx.Vendor vendor := ctx.Vendor
vendorSane := sanitize(ctx.Vendor) vendorSane := ctx.SaneVendor
vendorDir := *FlagOutDir + MoboDir + vendorSane vendorDir := *FlagOutDir + MoboDir + vendorSane
vendorUpper := strings.ToUpper(vendorSane) vendorUpper := strings.ToUpper(vendorSane)
kconfig := vendorDir + "/Kconfig" kconfig := vendorDir + "/Kconfig"
@ -702,8 +703,18 @@ func main() {
if dmi.IsLaptop { if dmi.IsLaptop {
KconfigBool["SYSTEM_TYPE_LAPTOP"] = true KconfigBool["SYSTEM_TYPE_LAPTOP"] = true
} }
ctx.MoboID = sanitize(ctx.Vendor) + "/" + sanitize(ctx.Model) ctx.SaneVendor = sanitize(ctx.Vendor)
ctx.KconfigName = "BOARD_" + strings.ToUpper(sanitize(ctx.Vendor)+"_"+sanitize(ctx.Model)) 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 ctx.BaseDirectory = *FlagOutDir + MoboDir + ctx.MoboID
KconfigStringUnquoted["MAINBOARD_DIR"] = ctx.MoboID KconfigStringUnquoted["MAINBOARD_DIR"] = ctx.MoboID
KconfigString["MAINBOARD_PART_NUMBER"] = ctx.Model KconfigString["MAINBOARD_PART_NUMBER"] = ctx.Model