From bc675eb9fa318f18ef21e38fca8a9cdd55e05eae Mon Sep 17 00:00:00 2001 From: Jerry Huang Date: Tue, 10 Jan 2023 02:51:48 +0000 Subject: [PATCH] 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 --- filesystem/Android.bp | 1 - filesystem/avb_add_hash_footer.go | 8 --- filesystem/avb_gen_vbmeta_image.go | 108 ----------------------------- filesystem/filesystem.go | 1 - filesystem/filesystem_test.go | 29 -------- 5 files changed, 147 deletions(-) delete mode 100644 filesystem/avb_gen_vbmeta_image.go diff --git a/filesystem/Android.bp b/filesystem/Android.bp index 07d57c915..dfcd405d3 100644 --- a/filesystem/Android.bp +++ b/filesystem/Android.bp @@ -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", diff --git a/filesystem/avb_add_hash_footer.go b/filesystem/avb_add_hash_footer.go index f3fecd042..2ee420cdb 100644 --- a/filesystem/avb_add_hash_footer.go +++ b/filesystem/avb_add_hash_footer.go @@ -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) } diff --git a/filesystem/avb_gen_vbmeta_image.go b/filesystem/avb_gen_vbmeta_image.go deleted file mode 100644 index 0f331f923..000000000 --- a/filesystem/avb_gen_vbmeta_image.go +++ /dev/null @@ -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) -} diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 577e9805e..d01608f33 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -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 { diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go index 444ffd0aa..9bfcc3d6a 100644 --- a/filesystem/filesystem_test.go +++ b/filesystem/filesystem_test.go @@ -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 ") }