From 01597316cf36c525bfc2e6c6ab2527904c208bbf Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Thu, 6 Jan 2022 14:38:29 +0900 Subject: [PATCH] Move ramdisk to the new init_boot partition The updated u-bootloader demands it. Bug: N/A Test: atest MicrodroidHostTestCases Change-Id: I7024f20eb9d7c637437236f844a0c0f45db41bf1 --- apex/Android.bp | 1 + apex/sign_virt_apex.py | 9 ++++++--- microdroid/Android.bp | 12 +++++++++++- microdroid/microdroid.json | 4 ++++ 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/apex/Android.bp b/apex/Android.bp index f1eeed9c..25cd4807 100644 --- a/apex/Android.bp +++ b/apex/Android.bp @@ -5,6 +5,7 @@ package { microdroid_filesystem_images = [ "microdroid_super", "microdroid_boot-5.10", + "microdroid_init_boot", "microdroid_vendor_boot-5.10", "microdroid_vbmeta", "microdroid_vbmeta_bootconfig", diff --git a/apex/sign_virt_apex.py b/apex/sign_virt_apex.py index 153b5dd4..9a0fe1a9 100644 --- a/apex/sign_virt_apex.py +++ b/apex/sign_virt_apex.py @@ -282,6 +282,8 @@ def SignVirtApex(args): boot_img = os.path.join(input_dir, 'etc', 'fs', 'microdroid_boot-5.10.img') vendor_boot_img = os.path.join( input_dir, 'etc', 'fs', 'microdroid_vendor_boot-5.10.img') + init_boot_img = os.path.join( + input_dir, 'etc', 'fs', 'microdroid_init_boot.img') super_img = os.path.join(input_dir, 'etc', 'fs', 'microdroid_super.img') vbmeta_img = os.path.join(input_dir, 'etc', 'fs', 'microdroid_vbmeta.img') vbmeta_bootconfig_img = os.path.join( @@ -297,10 +299,11 @@ def SignVirtApex(args): # while it's okay to use different keys for other image files. ReplaceBootloaderPubkey(args, key, bootloader, bootloader_pubkey) - # re-sign bootloader, boot.img, vendor_boot.img + # re-sign bootloader, boot.img, vendor_boot.img, and init_boot.img AddHashFooter(args, key, bootloader) AddHashFooter(args, key, boot_img) AddHashFooter(args, key, vendor_boot_img) + AddHashFooter(args, key, init_boot_img) # re-sign super.img with TempDirectory() as work_dir: @@ -320,12 +323,12 @@ def SignVirtApex(args): # re-pack super.img MakeSuperImage(args, partitions, super_img) - # re-generate vbmeta from re-signed {boot, vendor_boot, system_a, vendor_a}.img + # re-generate vbmeta from re-signed {boot, vendor_boot, init_boot, system_a, vendor_a}.img # Ideally, making VBmeta should be done out of TempDirectory block. But doing it here # to avoid unpacking re-signed super.img for system/vendor images which are available # in this block. MakeVbmetaImage(args, key, vbmeta_img, images=[ - boot_img, vendor_boot_img, system_a_img, vendor_a_img]) + boot_img, vendor_boot_img, init_boot_img, system_a_img, vendor_a_img]) # Re-sign bootconfigs with the same key bootconfig_sign_key = key diff --git a/microdroid/Android.bp b/microdroid/Android.bp index 3eaf1247..6c96cbfe 100644 --- a/microdroid/Android.bp +++ b/microdroid/Android.bp @@ -221,7 +221,6 @@ microdroid_boot_cmdline = [ bootimg { name: "microdroid_boot-5.10", - ramdisk_module: "microdroid_ramdisk-5.10", // We don't have kernel for arm and x86. But Soong demands one when it builds for // arm or x86 target. Satisfy that by providing an empty file as the kernel. kernel_prebuilt: "empty_kernel", @@ -251,6 +250,16 @@ bootimg { avb_private_key: ":microdroid_sign_key", } +bootimg { + name: "microdroid_init_boot", + ramdisk_module: "microdroid_ramdisk-5.10", + kernel_prebuilt: "empty_kernel", + header_version: "4", + partition_name: "init_boot", + use_avb: true, + avb_private_key: ":microdroid_sign_key", +} + android_filesystem { name: "microdroid_ramdisk-5.10", deps: [ @@ -551,6 +560,7 @@ vbmeta { "microdroid_vendor_boot-5.10", "microdroid", "microdroid_boot-5.10", + "microdroid_init_boot", ], } diff --git a/microdroid/microdroid.json b/microdroid/microdroid.json index 84960524..9e630f85 100644 --- a/microdroid/microdroid.json +++ b/microdroid/microdroid.json @@ -7,6 +7,10 @@ "label": "boot_a", "path": "/apex/com.android.virt/etc/fs/microdroid_boot-5.10.img" }, + { + "label": "init_boot_a", + "path": "/apex/com.android.virt/etc/fs/microdroid_init_boot.img" + }, { "label": "vendor_boot_a", "path": "/apex/com.android.virt/etc/fs/microdroid_vendor_boot-5.10.img"