Install VNDK libs in /system instead of /vendor
If BOARD_VNDK_VERSION is set, and a module is set to `vendor_available: true` it is installed in /system and /vendor. However, if the module is a VNDK library, it must be installed at `/system/${LIB}/vndk` instead of /vendor/${LIB}. For those modules, need following to set. vendor_available: true, vndk: { enabled: true, support_system_process: true, }, `support_system_process` is optional to define. If it is defined to true, the module is regarded as vndk-sp. link-type check for VNDK modules is added to make sure that VNDK modules only link to other VNDK shared libraries or LL-NDKs. move the ABI checks to VNDK from all of vendor_available. Bug: 38304436 Test: attempt to compile with BOARD_VNDK_VERSION:=current Test: Use `vendor_available_vndk: true` for VNDK modules and compile with BOARD_VNDK_VERSION:=current Change-Id: I409268e0b7f05a9d01697bf9f9f4726b5aac631f
This commit is contained in:
59
cc/cc.go
59
cc/cc.go
@@ -183,6 +183,8 @@ type ModuleContextIntf interface {
|
||||
sdk() bool
|
||||
sdkVersion() string
|
||||
vndk() bool
|
||||
isVndk() bool
|
||||
isVndkSp() bool
|
||||
createVndkSourceAbiDump() bool
|
||||
selectedStl() string
|
||||
baseModuleName() string
|
||||
@@ -291,6 +293,7 @@ type Module struct {
|
||||
sanitize *sanitize
|
||||
coverage *coverage
|
||||
sabi *sabi
|
||||
vndkdep *vndkdep
|
||||
|
||||
androidMkSharedLibDeps []string
|
||||
|
||||
@@ -327,6 +330,9 @@ func (c *Module) Init() android.Module {
|
||||
if c.sabi != nil {
|
||||
c.AddProperties(c.sabi.props()...)
|
||||
}
|
||||
if c.vndkdep != nil {
|
||||
c.AddProperties(c.vndkdep.props()...)
|
||||
}
|
||||
for _, feature := range c.features {
|
||||
c.AddProperties(feature.props()...)
|
||||
}
|
||||
@@ -353,6 +359,13 @@ func (c *Module) vndk() bool {
|
||||
return c.Properties.UseVndk
|
||||
}
|
||||
|
||||
func (c *Module) isVndk() bool {
|
||||
if c.vndkdep != nil {
|
||||
return c.vndkdep.isVndk()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type baseModuleContext struct {
|
||||
android.BaseContext
|
||||
moduleContextImpl
|
||||
@@ -368,10 +381,10 @@ type moduleContext struct {
|
||||
moduleContextImpl
|
||||
}
|
||||
|
||||
// Vendor returns true for vendor modules so that they get installed onto the
|
||||
// correct partition
|
||||
// Vendor returns true for vendor modules excluding VNDK libraries so that
|
||||
// they get installed onto the correct partition
|
||||
func (ctx *moduleContext) Vendor() bool {
|
||||
return ctx.ModuleContext.Vendor() || ctx.moduleContextImpl.mod.Properties.UseVndk
|
||||
return ctx.ModuleContext.Vendor() || (ctx.mod.vndk() && !ctx.mod.isVndk())
|
||||
}
|
||||
|
||||
type moduleContextImpl struct {
|
||||
@@ -431,9 +444,20 @@ func (ctx *moduleContextImpl) vndk() bool {
|
||||
return ctx.mod.vndk()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) isVndk() bool {
|
||||
return ctx.mod.isVndk()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) isVndkSp() bool {
|
||||
if vndk := ctx.mod.vndkdep; vndk != nil {
|
||||
return vndk.isVndkSp()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Create source abi dumps if the module belongs to the list of VndkLibraries.
|
||||
func (ctx *moduleContextImpl) createVndkSourceAbiDump() bool {
|
||||
return ctx.ctx.Device() && ((Bool(ctx.mod.Properties.Vendor_available)) || (inList(ctx.baseModuleName(), config.LLndkLibraries())))
|
||||
return ctx.ctx.Device() && (ctx.mod.isVndk() || inList(ctx.baseModuleName(), config.LLndkLibraries()))
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) selectedStl() string {
|
||||
@@ -463,6 +487,7 @@ func newModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Mo
|
||||
module.sanitize = &sanitize{}
|
||||
module.coverage = &coverage{}
|
||||
module.sabi = &sabi{}
|
||||
module.vndkdep = &vndkdep{}
|
||||
return module
|
||||
}
|
||||
|
||||
@@ -591,6 +616,9 @@ func (c *Module) begin(ctx BaseModuleContext) {
|
||||
if c.sabi != nil {
|
||||
c.sabi.begin(ctx)
|
||||
}
|
||||
if c.vndkdep != nil {
|
||||
c.vndkdep.begin(ctx)
|
||||
}
|
||||
for _, feature := range c.features {
|
||||
feature.begin(ctx)
|
||||
}
|
||||
@@ -624,6 +652,9 @@ func (c *Module) deps(ctx DepsContext) Deps {
|
||||
if c.sabi != nil {
|
||||
deps = c.sabi.deps(ctx, deps)
|
||||
}
|
||||
if c.vndkdep != nil {
|
||||
deps = c.vndkdep.deps(ctx, deps)
|
||||
}
|
||||
for _, feature := range c.features {
|
||||
deps = feature.deps(ctx, deps)
|
||||
}
|
||||
@@ -828,7 +859,12 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||
return
|
||||
}
|
||||
if from.Properties.UseVndk {
|
||||
// Vendor code is already limited by the vendor mutator
|
||||
// Though vendor code is limited by the vendor mutator,
|
||||
// each vendor-available module needs to check
|
||||
// link-type for VNDK.
|
||||
if from.vndkdep != nil {
|
||||
from.vndkdep.vndkCheckLinkType(ctx, to)
|
||||
}
|
||||
return
|
||||
}
|
||||
if from.Properties.Sdk_version == "" {
|
||||
@@ -1169,6 +1205,18 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
|
||||
"doesn't make sense at the same time as `vendor: true` or `proprietary: true`")
|
||||
return
|
||||
}
|
||||
if vndk := m.vndkdep; vndk != nil {
|
||||
if vndk.isVndk() && !Bool(m.Properties.Vendor_available) {
|
||||
mctx.PropertyErrorf("vndk",
|
||||
"has to define `vendor_available: true` to enable vndk")
|
||||
return
|
||||
}
|
||||
if !vndk.isVndk() && vndk.isVndkSp() {
|
||||
mctx.PropertyErrorf("vndk",
|
||||
"must set `enabled: true` to set `support_system_process: true`")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if !mctx.DeviceConfig().CompileVndk() {
|
||||
// If the device isn't compiling against the VNDK, we always
|
||||
@@ -1180,6 +1228,7 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
|
||||
mctx.CreateVariations(vendorMode)
|
||||
} else if Bool(m.Properties.Vendor_available) {
|
||||
// This will be available in both /system and /vendor
|
||||
// or a /system directory that is available to vendor.
|
||||
mod := mctx.CreateVariations(coreMode, vendorMode)
|
||||
mod[1].(*Module).Properties.UseVndk = true
|
||||
} else if mctx.Vendor() && m.Properties.Sdk_version == "" {
|
||||
|
Reference in New Issue
Block a user