Add Mega_device configuration option
This lets you configure soong to build for every supported architecture
in one build. Installation is disabled, since it's not actually setting
up multiple devices, and would try to install multiple versions to a
single path.
Configurations that do not build are commented out.
Change-Id: I92ddea0b9ddbd53e12187c7f581b8ac5bd5fdec3
diff --git a/common/arch.go b/common/arch.go
index 1d7d0de..70ac85c 100644
--- a/common/arch.go
+++ b/common/arch.go
@@ -901,6 +901,65 @@
return hostTypeArches, deviceArches, nil
}
+func decodeMegaDevice() ([]Arch, error) {
+ archSettings := []struct {
+ arch string
+ archVariant string
+ cpuVariant string
+ abi []string
+ }{
+ {"arm", "armv7-a-neon", "cortex-a7", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "cortex-a8", []string{"armeabi-v7a"}},
+ // gtest_all_test.cc fails to build:
+ // error in backend: Unsupported library call operation!
+ //{"arm", "armv7-a-neon", "cortex-a9", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "cortex-a15", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "cortex-a53", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "cortex-a53.a57", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "denver", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "krait", []string{"armeabi-v7a"}},
+ {"arm64", "", "cortex-a53", []string{"arm64-v8a"}},
+ {"arm64", "", "denver64", []string{"arm64-v8a"}},
+ // mips is missing __popcountsi2 from libc
+ //{"mips", "mips32-fp", "", []string{"mips"}},
+ //{"mips", "mips32r2-fp", "", []string{"mips"}},
+ //{"mips", "mips32r2-fp-xburst", "", []string{"mips"}},
+ //{"mips", "mips32r6", "", []string{"mips32r6"}},
+ // mips32r2dsp[r2]-fp also fails in the assembler for dmisc.c in libc:
+ // Error: invalid operands `mtlo $ac0,$8'
+ // Error: invalid operands `mthi $ac0,$3'
+ //{"mips", "mips32r2dsp-fp", "", []string{"mips"}},
+ //{"mips", "mips32r2dspr2-fp", "", []string{"mips"}},
+ // mips64r2 is mismatching 64r2 and 64r6 libraries during linking to libgcc
+ //{"mips64", "mips64r2", "", []string{"mips64"}},
+ {"mips64", "mips64r6", "", []string{"mips64"}},
+ {"x86", "", "", []string{"x86"}},
+ {"x86", "atom", "", []string{"x86"}},
+ {"x86", "haswell", "", []string{"x86"}},
+ {"x86", "ivybridge", "", []string{"x86"}},
+ {"x86", "sandybridge", "", []string{"x86"}},
+ {"x86", "silvermont", "", []string{"x86"}},
+ {"x86_64", "", "", []string{"x86_64"}},
+ {"x86_64", "haswell", "", []string{"x86_64"}},
+ {"x86_64", "ivybridge", "", []string{"x86_64"}},
+ {"x86_64", "sandybridge", "", []string{"x86_64"}},
+ {"x86_64", "silvermont", "", []string{"x86_64"}},
+ }
+
+ var ret []Arch
+
+ for _, config := range archSettings {
+ arch, err := decodeArch(config.arch, &config.archVariant,
+ &config.cpuVariant, &config.abi)
+ if err != nil {
+ return nil, err
+ }
+ ret = append(ret, arch)
+ }
+
+ return ret, nil
+}
+
// Convert a set of strings from product variables into a single Arch struct
func decodeArch(arch string, archVariant, cpuVariant *string, abi *[]string) (Arch, error) {
stringPtr := func(p *string) string {
diff --git a/common/config.go b/common/config.go
index 74e0660..a4a2039 100644
--- a/common/config.go
+++ b/common/config.go
@@ -35,6 +35,7 @@
// A FileConfigurableOptions contains options which can be configured by the
// config file. These will be included in the config struct.
type FileConfigurableOptions struct {
+ Mega_device *bool `json:",omitempty"`
}
func (f *FileConfigurableOptions) SetDefaultConfig() {
@@ -179,6 +180,13 @@
return Config{}, err
}
+ if Bool(config.Mega_device) {
+ deviceArches, err = decodeMegaDevice()
+ if err != nil {
+ return Config{}, err
+ }
+ }
+
config.HostArches = hostArches
config.DeviceArches = deviceArches
@@ -295,3 +303,7 @@
func (c *config) AllowMissingDependencies() bool {
return Bool(c.ProductVariables.Unbundled_build)
}
+
+func (c *config) SkipInstall() bool {
+ return c.EmbeddedInMake() || Bool(c.Mega_device)
+}
diff --git a/common/module.go b/common/module.go
index 0f6ecb5..988104f 100644
--- a/common/module.go
+++ b/common/module.go
@@ -519,17 +519,19 @@
fullInstallPath := installPath.Join(a, name)
- deps = append(deps, a.installDeps...)
+ if !a.AConfig().SkipInstall() {
+ deps = append(deps, a.installDeps...)
- a.ModuleBuild(pctx, ModuleBuildParams{
- Rule: Cp,
- Output: fullInstallPath,
- Input: srcPath,
- OrderOnly: Paths(deps),
- Default: !a.AConfig().EmbeddedInMake(),
- })
+ a.ModuleBuild(pctx, ModuleBuildParams{
+ Rule: Cp,
+ Output: fullInstallPath,
+ Input: srcPath,
+ OrderOnly: Paths(deps),
+ Default: true,
+ })
- a.installFiles = append(a.installFiles, fullInstallPath)
+ a.installFiles = append(a.installFiles, fullInstallPath)
+ }
a.checkbuildFiles = append(a.checkbuildFiles, srcPath)
return fullInstallPath
}