Specify correct install location for vendor_ramdisk prebuilt kernel module
vendor_ramdisk prebuilt kernel files are installed under
`vendor_ramdisk/lib/modules` regardless of the product configuration in
make. This change matches the behavior and allows the kernel files to be
installed in the correct location.
Test: m soong_generated_vendor_ramdisk_filesystem_test
Bug: 381104942
Change-Id: Id2086de95f0554c849c1667ce190274232db6b99
diff --git a/kernel/prebuilt_kernel_modules.go b/kernel/prebuilt_kernel_modules.go
index 13d6482..2490455 100644
--- a/kernel/prebuilt_kernel_modules.go
+++ b/kernel/prebuilt_kernel_modules.go
@@ -100,6 +100,13 @@
strippedModules := stripDebugSymbols(ctx, modules)
installDir := android.PathForModuleInstall(ctx, "lib", "modules")
+ // Kernel module is installed to vendor_ramdisk/lib/modules regardless of product
+ // configuration. This matches the behavior in make and prevents the files from being
+ // installed in `vendor_ramdisk/first_stage_ramdisk`.
+ if pkm.InstallInVendorRamdisk() {
+ installDir = android.PathForModuleInPartitionInstall(ctx, "vendor_ramdisk", "lib", "modules")
+ }
+
if pkm.KernelVersion() != "" {
installDir = installDir.Join(ctx, pkm.KernelVersion())
}