boot_image modules inside APEX have correct names
This change fixed the problem that boot_image modules when installed to an APEX get incorrect names like signed.img. The filename now is "<modulename>.img" and can be overridden via the new `stem` property. Bug: 178978059 Test: m Change-Id: I1b25db04a4a2d888371b174c42f91a0cea87b877
This commit is contained in:
parent
0671146fd0
commit
1f55dbd0d6
|
@ -38,6 +38,9 @@ type bootimg struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type bootimgProperties struct {
|
type bootimgProperties struct {
|
||||||
|
// Set the name of the output. Defaults to <module_name>.img.
|
||||||
|
Stem *string
|
||||||
|
|
||||||
// Path to the linux kernel prebuilt file
|
// Path to the linux kernel prebuilt file
|
||||||
Kernel_prebuilt *string `android:"arch_variant,path"`
|
Kernel_prebuilt *string `android:"arch_variant,path"`
|
||||||
|
|
||||||
|
@ -96,7 +99,7 @@ func (b *bootimg) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bootimg) installFileName() string {
|
func (b *bootimg) installFileName() string {
|
||||||
return b.BaseModuleName() + ".img"
|
return proptools.StringDefault(b.properties.Stem, b.BaseModuleName()+".img")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bootimg) partitionName() string {
|
func (b *bootimg) partitionName() string {
|
||||||
|
@ -110,6 +113,7 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
} else {
|
} else {
|
||||||
// TODO(jiyong): fix this
|
// TODO(jiyong): fix this
|
||||||
ctx.PropertyErrorf("vendor_boot", "only vendor_boot:true is supported")
|
ctx.PropertyErrorf("vendor_boot", "only vendor_boot:true is supported")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if proptools.Bool(b.properties.Use_avb) {
|
if proptools.Bool(b.properties.Use_avb) {
|
||||||
|
@ -123,7 +127,8 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bootimg) buildVendorBootImage(ctx android.ModuleContext) android.OutputPath {
|
func (b *bootimg) buildVendorBootImage(ctx android.ModuleContext) android.OutputPath {
|
||||||
output := android.PathForModuleOut(ctx, "unsigned.img").OutputPath
|
output := android.PathForModuleOut(ctx, "unsigned", b.installFileName()).OutputPath
|
||||||
|
|
||||||
builder := android.NewRuleBuilder(pctx, ctx)
|
builder := android.NewRuleBuilder(pctx, ctx)
|
||||||
cmd := builder.Command().BuiltTool("mkbootimg")
|
cmd := builder.Command().BuiltTool("mkbootimg")
|
||||||
|
|
||||||
|
@ -182,21 +187,20 @@ func (b *bootimg) buildVendorBootImage(ctx android.ModuleContext) android.Output
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bootimg) signImage(ctx android.ModuleContext, unsignedImage android.OutputPath) android.OutputPath {
|
func (b *bootimg) signImage(ctx android.ModuleContext, unsignedImage android.OutputPath) android.OutputPath {
|
||||||
signedImage := android.PathForModuleOut(ctx, "signed.img").OutputPath
|
output := android.PathForModuleOut(ctx, b.installFileName()).OutputPath
|
||||||
key := android.PathForModuleSrc(ctx, proptools.String(b.properties.Avb_private_key))
|
key := android.PathForModuleSrc(ctx, proptools.String(b.properties.Avb_private_key))
|
||||||
|
|
||||||
builder := android.NewRuleBuilder(pctx, ctx)
|
builder := android.NewRuleBuilder(pctx, ctx)
|
||||||
builder.Command().Text("cp").Input(unsignedImage).Output(signedImage)
|
builder.Command().Text("cp").Input(unsignedImage).Output(output)
|
||||||
builder.Command().
|
builder.Command().
|
||||||
BuiltTool("avbtool").
|
BuiltTool("avbtool").
|
||||||
Flag("add_hash_footer").
|
Flag("add_hash_footer").
|
||||||
FlagWithArg("--partition_name ", b.partitionName()).
|
FlagWithArg("--partition_name ", b.partitionName()).
|
||||||
FlagWithInput("--key ", key).
|
FlagWithInput("--key ", key).
|
||||||
FlagWithOutput("--image ", signedImage)
|
FlagWithOutput("--image ", output)
|
||||||
|
|
||||||
builder.Build("sign_bootimg", fmt.Sprintf("Signing %s", b.BaseModuleName()))
|
builder.Build("sign_bootimg", fmt.Sprintf("Signing %s", b.BaseModuleName()))
|
||||||
|
return output
|
||||||
return signedImage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ android.AndroidMkEntriesProvider = (*bootimg)(nil)
|
var _ android.AndroidMkEntriesProvider = (*bootimg)(nil)
|
||||||
|
|
Loading…
Reference in New Issue