diff options
author | 2024-11-18 21:30:22 +0000 | |
---|---|---|
committer | 2024-11-18 21:55:55 +0000 | |
commit | 6c03c8ee70c1412e6b2e2a960081c94cbdf0b45e (patch) | |
tree | ceeca5c551153bde6f4ada4ac6bfac5d81a7322d /filesystem/filesystem.go | |
parent | 385f75bfacf3a29949e3acbccd0cbc9baf347ee4 (diff) |
Specify dev nodes list file for ramdisk partition generation
Ramdisk partition requires "-n" argument to be passed when generating
the image file. Given that the value is agnostic to the target product
and is set to a constant value, this is implicitly set internally in
filesystem module.
Test: inspect ramdisk.img build command
Bug: 379190521
Change-Id: I01d0c1bf06e087ab49c71bdb0cfe48a08b9c7fc9
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r-- | filesystem/filesystem.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index c34677060..ba5319fb6 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -162,6 +162,10 @@ type FilesystemProperties struct { // Determines if the module is auto-generated from Soong or not. If the module is // auto-generated, its deps are exempted from visibility enforcement. Is_auto_generated *bool + + // Path to the dev nodes description file. This is only needed for building the ramdisk + // partition and should not be explicitly specified. + Dev_nodes_description_file *string `android:"path" blueprint:"mutated"` } // Additional properties required to generate erofs FS partitions. @@ -210,6 +214,10 @@ func initFilesystemModule(module android.DefaultableModule, filesystemModule *fi filesystemModule.PackagingBase.AllowHighPriorityDeps = true android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon) android.InitDefaultableModule(module) + + android.AddLoadHook(module, func(ctx android.LoadHookContext) { + filesystemModule.setDevNodesDescriptionProp() + }) } type depTag struct { @@ -229,6 +237,16 @@ func (t depTagWithVisibilityEnforcementBypass) ExcludeFromVisibilityEnforcement( var dependencyTagWithVisibilityEnforcementBypass = depTagWithVisibilityEnforcementBypass{} +// ramdiskDevNodesDescription is the name of the filegroup module that provides the file that +// contains the description of dev nodes added to the CPIO archive for the ramdisk partition. +const ramdiskDevNodesDescription = "ramdisk_node_list" + +func (f *filesystem) setDevNodesDescriptionProp() { + if proptools.String(f.properties.Partition_name) == "ramdisk" { + f.properties.Dev_nodes_description_file = proptools.StringPtr(":" + ramdiskDevNodesDescription) + } +} + func (f *filesystem) DepsMutator(ctx android.BottomUpMutatorContext) { if proptools.Bool(f.properties.Is_auto_generated) { f.AddDeps(ctx, dependencyTagWithVisibilityEnforcementBypass) @@ -659,6 +677,9 @@ func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool) cmd := builder.Command(). BuiltTool("mkbootfs"). Text(rootDir.String()) // input directory + if nodeList := f.properties.Dev_nodes_description_file; nodeList != nil { + cmd.FlagWithInput("-n ", android.PathForModuleSrc(ctx, proptools.String(nodeList))) + } if compressed { cmd.Text("|"). BuiltTool("lz4"). |