sm8250-common: Import FOD HAL from device/oneplus/sm8150-common

This commit is contained in:
LuK1337
2020-06-22 20:00:06 +02:00
parent 7e343c47fe
commit e7779bb46f
13 changed files with 501 additions and 2 deletions

17
soong/Android.bp Normal file
View File

@@ -0,0 +1,17 @@
bootstrap_go_package {
name: "soong-oneplus-kona-plugins",
pkgPath: "device/oneplus/sm8250-common",
deps: [
"blueprint",
"blueprint-pathtools",
"soong",
"soong-android",
"soong-cc",
"soong-genrule",
],
srcs: [
"fod.go",
"main.go",
],
pluginFor: ["soong_build"],
}

40
soong/fod.go Normal file
View File

@@ -0,0 +1,40 @@
package kona
import (
"android/soong/android"
"android/soong/cc"
"strings"
)
func fodFlags(ctx android.BaseContext) []string {
var cflags []string
var config = ctx.AConfig().VendorConfig("ONEPLUS_KONA_FOD")
var posX = strings.TrimSpace(config.String("POS_X"))
var posY = strings.TrimSpace(config.String("POS_Y"))
var size = strings.TrimSpace(config.String("SIZE"))
cflags = append(cflags, "-DFOD_POS_X=" + posX, "-DFOD_POS_Y=" + posY, "-DFOD_SIZE=" + size)
return cflags
}
func fodHalBinary(ctx android.LoadHookContext) {
type props struct {
Target struct {
Android struct {
Cflags []string
}
}
}
p := &props{}
p.Target.Android.Cflags = fodFlags(ctx)
ctx.AppendProperties(p)
}
func fodHalBinaryFactory() android.Module {
module, _ := cc.NewBinary(android.HostAndDeviceSupported)
newMod := module.Init()
android.AddLoadHook(newMod, fodHalBinary)
return newMod
}

9
soong/main.go Normal file
View File

@@ -0,0 +1,9 @@
package kona
import (
"android/soong/android"
)
func init() {
android.RegisterModuleType("oneplus_kona_fod_hal_binary", fodHalBinaryFactory)
}