diff options
author | 2025-01-09 20:51:54 +0000 | |
---|---|---|
committer | 2025-01-09 21:55:57 +0000 | |
commit | 3be1716f397ab1777ba749f4f9891d3e6324bfd2 (patch) | |
tree | 77a05e5ddc20ef06c9b96e6a6993117c510371d5 /fsgen/filesystem_creator.go | |
parent | 3c6b81ef50dbddcd8a38b81621b891c79e527fd1 (diff) |
Copy bootloader to PRODUCT_OUT
Implementation details:
- Import BOARD_PREBUILT_BOOTLOADER to Soong, and create a filegroup
module
- Introduce `bootloader` property in android_device
- Introduce file copying (to PRODUCT_OUT) mechanism in android_device
Test: m aosp_cf_x86_64_phone_generated_device --soong-only
Bug: 388852084
Change-Id: I89a08590e39e771019e507b419fafae37bc4bb97
Diffstat (limited to 'fsgen/filesystem_creator.go')
-rw-r--r-- | fsgen/filesystem_creator.go | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index 41faf948a..0fcb22f9e 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -180,6 +180,26 @@ func generatedModuleNameForPartition(cfg android.Config, partitionType string) s return generatedModuleName(cfg, fmt.Sprintf("%s_image", partitionType)) } +func (f *filesystemCreator) createBootloaderFilegroup(ctx android.LoadHookContext) (string, bool) { + bootloaderPath := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.PrebuiltBootloader + if len(bootloaderPath) == 0 { + return "", false + } + + bootloaderFilegroupName := generatedModuleName(ctx.Config(), "bootloader") + filegroupProps := &struct { + Name *string + Srcs []string + Visibility []string + }{ + Name: proptools.StringPtr(bootloaderFilegroupName), + Srcs: []string{bootloaderPath}, + Visibility: []string{"//visibility:public"}, + } + ctx.CreateModuleInDirectory(android.FileGroupFactory, ".", filegroupProps) + return bootloaderFilegroupName, true +} + func (f *filesystemCreator) createDeviceModule( ctx android.LoadHookContext, generatedPartitionTypes []string, @@ -234,7 +254,12 @@ func (f *filesystemCreator) createDeviceModule( } partitionProps.Vbmeta_partitions = vbmetaPartitions - ctx.CreateModule(filesystem.AndroidDeviceFactory, baseProps, partitionProps) + deviceProps := &filesystem.DeviceProperties{} + if bootloader, ok := f.createBootloaderFilegroup(ctx); ok { + deviceProps.Bootloader = proptools.StringPtr(":" + bootloader) + } + + ctx.CreateModule(filesystem.AndroidDeviceFactory, baseProps, partitionProps, deviceProps) } func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesystem.FilesystemProperties, partitionVars android.PartitionVariables, partitionType string) { |