Revert "[avb_footer] Add avb_gen_vbmeta_image to generate vbmeta..."

Revert submission 2375848-initrd_avb_footer

Reason for revert: build break

Reverted changes: /q/submissionid:2375848-initrd_avb_footer

Bug: 264940248
Change-Id: Iab44c187183a5d8eeefc952910e6262fc63627de
This commit is contained in:
Jerry Huang 2023-01-10 02:51:48 +00:00
parent fafe064fe1
commit bc675eb9fa
5 changed files with 0 additions and 147 deletions

View file

@ -13,7 +13,6 @@ bootstrap_go_package {
],
srcs: [
"avb_add_hash_footer.go",
"avb_gen_vbmeta_image.go",
"bootimg.go",
"filesystem.go",
"logical_partition.go",

View file

@ -67,9 +67,6 @@ type avbAddHashFooterProperties struct {
// List of properties to add to the footer
Props []avbProp
// Include descriptors from images
Include_descriptors_from_images []string `android:"path,arch_variant"`
}
// The AVB footer adds verification information to the image.
@ -119,11 +116,6 @@ func (a *avbAddHashFooter) GenerateAndroidBuildActions(ctx android.ModuleContext
}
cmd.FlagWithArg("--salt ", proptools.String(a.properties.Salt))
imagePaths := android.PathsForModuleSrc(ctx, a.properties.Include_descriptors_from_images)
for _, imagePath := range imagePaths {
cmd.FlagWithInput("--include_descriptors_from_image ", imagePath)
}
for _, prop := range a.properties.Props {
addAvbProp(ctx, cmd, prop)
}

View file

@ -1,108 +0,0 @@
// Copyright (C) 2022 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package filesystem
import (
"fmt"
"github.com/google/blueprint/proptools"
"android/soong/android"
)
type avbGenVbmetaImage struct {
android.ModuleBase
properties avbGenVbmetaImageProperties
output android.OutputPath
installDir android.InstallPath
}
type avbGenVbmetaImageProperties struct {
// Source file of this image. Can reference a genrule type module with the ":module" syntax.
Src *string `android:"path,arch_variant"`
// Name of the image partition. Defaults to the name of this module.
Partition_name *string
// The salt in hex. Required for reproducible builds.
Salt *string
}
// The avbGenVbmetaImage generates an unsigned VBMeta image output for the given image.
func avbGenVbmetaImageFactory() android.Module {
module := &avbGenVbmetaImage{}
module.AddProperties(&module.properties)
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
return module
}
func (a *avbGenVbmetaImage) installFileName() string {
return a.Name() + ".img"
}
func (a *avbGenVbmetaImage) GenerateAndroidBuildActions(ctx android.ModuleContext) {
builder := android.NewRuleBuilder(pctx, ctx)
cmd := builder.Command().BuiltTool("avbtool").Text("add_hash_footer")
cmd.Flag("--dynamic_partition_size")
cmd.Flag("--do_not_append_vbmeta_image")
partition_name := proptools.StringDefault(a.properties.Partition_name, a.Name())
cmd.FlagWithArg("--partition_name ", partition_name)
if a.properties.Src == nil {
ctx.PropertyErrorf("src", "missing source file")
return
}
input := android.PathForModuleSrc(ctx, proptools.String(a.properties.Src))
cmd.FlagWithInput("--image ", input)
if a.properties.Salt == nil {
ctx.PropertyErrorf("salt", "missing salt value")
return
}
cmd.FlagWithArg("--salt ", proptools.String(a.properties.Salt))
a.output = android.PathForModuleOut(ctx, a.installFileName()).OutputPath
cmd.FlagWithOutput("--output_vbmeta_image ", a.output)
builder.Build("avbGenVbmetaImage", fmt.Sprintf("avbGenVbmetaImage %s", ctx.ModuleName()))
}
var _ android.AndroidMkEntriesProvider = (*avbGenVbmetaImage)(nil)
// Implements android.AndroidMkEntriesProvider
func (a *avbGenVbmetaImage) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "ETC",
OutputFile: android.OptionalPathForPath(a.output),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", a.installDir.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", a.installFileName())
},
},
}}
}
var _ android.OutputFileProducer = (*avbGenVbmetaImage)(nil)
// Implements android.OutputFileProducer
func (a *avbGenVbmetaImage) OutputFiles(tag string) (android.Paths, error) {
if tag == "" {
return []android.Path{a.output}, nil
}
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}

View file

@ -35,7 +35,6 @@ func registerBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("android_filesystem", filesystemFactory)
ctx.RegisterModuleType("android_system_image", systemImageFactory)
ctx.RegisterModuleType("avb_add_hash_footer", avbAddHashFooterFactory)
ctx.RegisterModuleType("avb_gen_vbmeta_image", avbGenVbmetaImageFactory)
}
type filesystem struct {

View file

@ -126,34 +126,8 @@ func TestFileSystemGathersItemsOnlyInSystemPartition(t *testing.T) {
android.AssertDeepEquals(t, "entries should have foo only", []string{"components/foo"}, module.entries)
}
func TestAvbGenVbmetaImage(t *testing.T) {
result := fixture.RunTestWithBp(t, `
avb_gen_vbmeta_image {
name: "input_hashdesc",
src: "input.img",
partition_name: "input_partition_name",
salt: "2222",
}`)
cmd := result.ModuleForTests("input_hashdesc", "android_arm64_armv8-a").Rule("avbGenVbmetaImage").RuleParams.Command
android.AssertStringDoesContain(t, "Can't find correct --partition_name argument",
cmd, "--partition_name input_partition_name")
android.AssertStringDoesContain(t, "Can't find --do_not_append_vbmeta_image",
cmd, "--do_not_append_vbmeta_image")
android.AssertStringDoesContain(t, "Can't find --output_vbmeta_image",
cmd, "--output_vbmeta_image ")
android.AssertStringDoesContain(t, "Can't find --salt argument",
cmd, "--salt 2222")
}
func TestAvbAddHashFooter(t *testing.T) {
result := fixture.RunTestWithBp(t, `
avb_gen_vbmeta_image {
name: "input_hashdesc",
src: "input.img",
partition_name: "input",
salt: "2222",
}
avb_add_hash_footer {
name: "myfooter",
src: "input.img",
@ -171,7 +145,6 @@ func TestAvbAddHashFooter(t *testing.T) {
file: "value_file",
},
],
include_descriptors_from_images: ["input_hashdesc"],
}
`)
cmd := result.ModuleForTests("myfooter", "android_arm64_armv8-a").Rule("avbAddHashFooter").RuleParams.Command
@ -185,6 +158,4 @@ func TestAvbAddHashFooter(t *testing.T) {
cmd, "--prop 'prop1:value1'")
android.AssertStringDoesContain(t, "Can't find --prop_from_file argument",
cmd, "--prop_from_file 'prop2:value_file'")
android.AssertStringDoesContain(t, "Can't find --include_descriptors_from_image",
cmd, "--include_descriptors_from_image ")
}