sm8250-common: Import FOD HAL from device/oneplus/sm8150-common
This commit is contained in:
17
soong/Android.bp
Normal file
17
soong/Android.bp
Normal 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
40
soong/fod.go
Normal 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
9
soong/main.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package kona
|
||||
|
||||
import (
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
func init() {
|
||||
android.RegisterModuleType("oneplus_kona_fod_hal_binary", fodHalBinaryFactory)
|
||||
}
|
||||
Reference in New Issue
Block a user