Create symlink for bionic files
This change creates following symlinks for bionic files.
/system/lib/libc.so -> /apex/com.android.runtime/lib/bionic/libc.so
/system/lib/libm.so -> /apex/com.android.runtime/lib/bionic/libm.so
/system/lib/libdl.so -> /apex/com.android.runtime/lib/bionic/libdl.so
/system/bin/linker -> /apex/com.android.runtime/bin/linker
...
This allows us to not have mountpoints under /bionic.
Bug: 125549215
Test: m and inspect the symlinks in the system partition.
Change-Id: I3a58bf4f88c967862dbf06065a1af8fc4700dda3
diff --git a/android/module.go b/android/module.go
index c1f3e79..c5252c8 100644
--- a/android/module.go
+++ b/android/module.go
@@ -124,6 +124,7 @@
InstallExecutable(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath
InstallFile(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath
InstallSymlink(installPath OutputPath, name string, srcPath OutputPath) OutputPath
+ InstallAbsoluteSymlink(installPath OutputPath, name string, absPath string) OutputPath
CheckbuildFile(srcPath Path)
AddMissingDependencies(deps []string)
@@ -1316,6 +1317,28 @@
return fullInstallPath
}
+// installPath/name -> absPath where absPath might be a path that is available only at runtime
+// (e.g. /apex/...)
+func (a *androidModuleContext) InstallAbsoluteSymlink(installPath OutputPath, name string, absPath string) OutputPath {
+ fullInstallPath := installPath.Join(a, name)
+ a.module.base().hooks.runInstallHooks(a, fullInstallPath, true)
+
+ if !a.skipInstall(fullInstallPath) {
+ a.Build(pctx, BuildParams{
+ Rule: Symlink,
+ Description: "install symlink " + fullInstallPath.Base() + " -> " + absPath,
+ Output: fullInstallPath,
+ Default: !a.Config().EmbeddedInMake(),
+ Args: map[string]string{
+ "fromPath": absPath,
+ },
+ })
+
+ a.installFiles = append(a.installFiles, fullInstallPath)
+ }
+ return fullInstallPath
+}
+
func (a *androidModuleContext) CheckbuildFile(srcPath Path) {
a.checkbuildFiles = append(a.checkbuildFiles, srcPath)
}