From 6f47365fb8c8b538a5b1e029e9e448f6767b32b8 Mon Sep 17 00:00:00 2001 From: Jerry Huang Date: Tue, 10 Jan 2023 02:51:48 +0000 Subject: [PATCH] Revert "[avb_footer] Include initrd_* hashes as hash descriptors..." Revert submission 2375848-initrd_avb_footer Reason for revert: build break Reverted changes: /q/submissionid:2375848-initrd_avb_footer Bug: 264940248 Change-Id: I44081c54a648936273cbb9d3c4c5046361eb2c4d --- microdroid/Android.bp | 28 +++++----------------------- microdroid/initrd/Android.bp | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/microdroid/Android.bp b/microdroid/Android.bp index d43b8c97..ecaadf82 100644 --- a/microdroid/Android.bp +++ b/microdroid/Android.bp @@ -538,26 +538,6 @@ filegroup { srcs: ["bootconfig.normal"], } -// python -c "import hashlib; print(hashlib.sha256(b'initrd_normal').hexdigest())" -initrd_normal_salt = "8041a07d54ac82290f6d90bac1fa8d7fdbc4db974d101d60faf294749d1ebaf8" - -avb_gen_vbmeta_image { - name: "microdroid_initrd_normal_hashdesc", - src: ":microdroid_initrd_normal", - partition_name: "initrd_normal", - salt: initrd_normal_salt, -} - -// python -c "import hashlib; print(hashlib.sha256(b'initrd_debug').hexdigest())" -initrd_debug_salt = "8ab9dc9cb7e6456700ff6ef18c6b4c3acc24c5fa5381b829563f8d7a415d869a" - -avb_gen_vbmeta_image { - name: "microdroid_initrd_debug_hashdesc", - src: ":microdroid_initrd_debuggable", - partition_name: "initrd_debug", - salt: initrd_debug_salt, -} - avb_add_hash_footer { name: "microdroid_kernel_signed", src: "empty_kernel", @@ -576,9 +556,11 @@ avb_add_hash_footer { enabled: true, }, }, - include_descriptors_from_images: [ - ":microdroid_initrd_normal_hashdesc", - ":microdroid_initrd_debug_hashdesc", + props: [ + { + name: "trusted_ramdisk", + file: ":microdroid_initrd_hashes", + }, ], } diff --git a/microdroid/initrd/Android.bp b/microdroid/initrd/Android.bp index 45315834..d05ea864 100644 --- a/microdroid/initrd/Android.bp +++ b/microdroid/initrd/Android.bp @@ -122,3 +122,28 @@ prebuilt_etc { }, filename: "microdroid_initrd_normal.img", } + +genrule { + name: "microdroid_initrd_normal.sha256", + srcs: [":microdroid_initrd_normal"], + cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)", + out: ["hash"], +} + +genrule { + name: "microdroid_initrd_debuggable.sha256", + srcs: [":microdroid_initrd_debuggable"], + cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)", + out: ["hash"], +} + +genrule { + name: "microdroid_initrd_hashes", + srcs: [ + ":microdroid_initrd_normal.sha256", + ":microdroid_initrd_debuggable.sha256", + ], + // join the hashes with commas + cmd: "cat $(in) | tr '\n' ',' > $(out) && truncate -s -1 $(out)", + out: ["output"], +}