diff options
author | bohu <bohu@google.com> | 2019-03-07 22:41:54 -0800 |
---|---|---|
committer | Bo Hu <bohu@google.com> | 2019-05-03 03:37:06 +0000 |
commit | 38bfe2c4f6b8942a8bb526d2fbb95697002533dd (patch) | |
tree | e586544037fec0e9137492831d5c7a3070773fef | |
parent | d52814976bacc6909ed286cab22d8b2b86b0bce5 (diff) | |
download | android_device_generic_goldfish-38bfe2c4f6b8942a8bb526d2fbb95697002533dd.tar.gz android_device_generic_goldfish-38bfe2c4f6b8942a8bb526d2fbb95697002533dd.tar.bz2 android_device_generic_goldfish-38bfe2c4f6b8942a8bb526d2fbb95697002533dd.zip |
goldfish: support dynamic partition
BUG: 125540538
Change-Id: I846d17934d690c641326c5aa13ffd4ee646fa93d
Merged-In: I846d17934d690c641326c5aa13ffd4ee646fa93d
-rw-r--r-- | arm32-vendor.mk | 5 | ||||
-rw-r--r-- | arm64-vendor.mk | 5 | ||||
-rw-r--r-- | data/etc/advancedFeatures.ini | 3 | ||||
-rw-r--r-- | data/etc/advancedFeatures.ini.arm | 2 | ||||
-rw-r--r-- | data/etc/user/advancedFeatures.ini | 3 | ||||
-rw-r--r-- | fstab.ranchu | 12 | ||||
-rw-r--r-- | fstab.ranchu.arm | 6 | ||||
-rw-r--r-- | fstab.ranchu.initrd | 4 | ||||
-rw-r--r-- | fstab.ranchu.initrd.arm | 4 | ||||
-rw-r--r-- | kernel-tests/advancedFeatures.ini | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | tools/mk_combined_img.py | 7 | ||||
-rwxr-xr-x | tools/mk_vbmeta_boot_params.sh | 89 | ||||
-rw-r--r-- | vendor.mk | 2 | ||||
-rw-r--r-- | x86-vendor.mk | 4 | ||||
-rw-r--r-- | x86_64-vendor.mk | 4 |
15 files changed, 127 insertions, 27 deletions
diff --git a/arm32-vendor.mk b/arm32-vendor.mk index cc2aee9..9a34d5d 100644 --- a/arm32-vendor.mk +++ b/arm32-vendor.mk @@ -7,11 +7,12 @@ PRODUCT_PROPERTY_OVERRIDES += \ # take priority and override the rules it inherit from other mk files # see copy file rules in core/Makefile PRODUCT_SDK_ADDON_COPY_FILES += \ - development/sys-img/advancedFeatures.ini.arm:images/armeabi-v7a/advancedFeatures.ini \ + device/generic/goldfish/data/etc/advancedFeatures.ini.arm:images/armeabi-v7a/advancedFeatures.ini \ prebuilts/qemu-kernel/arm64/$(PRODUCT_KERNEL_VERSION)/kernel-qemu2:images/armeabi-v7a/kernel-ranchu-64 PRODUCT_COPY_FILES += \ + device/generic/goldfish/fstab.ranchu.initrd.arm:$(TARGET_COPY_OUT_RAMDISK)/fstab.ranchu \ device/generic/goldfish/manifest-arm.xml:$(TARGET_COPY_OUT_VENDOR)/manifest.xml \ - development/sys-img/advancedFeatures.ini.arm:advancedFeatures.ini \ + device/generic/goldfish/data/etc/advancedFeatures.ini.arm:advancedFeatures.ini \ prebuilts/qemu-kernel/arm64/$(PRODUCT_KERNEL_VERSION)/kernel-qemu2:kernel-ranchu-64 \ device/generic/goldfish/fstab.ranchu.arm:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.ranchu diff --git a/arm64-vendor.mk b/arm64-vendor.mk index a579d35..a05654d 100644 --- a/arm64-vendor.mk +++ b/arm64-vendor.mk @@ -7,12 +7,13 @@ PRODUCT_PROPERTY_OVERRIDES += \ # take priority and override the rules it inherit from other mk files # see copy file rules in core/Makefile PRODUCT_SDK_ADDON_COPY_FILES += \ - development/sys-img/advancedFeatures.ini.arm:images/arm64-v8a/advancedFeatures.ini \ + device/generic/goldfish/data/etc/advancedFeatures.ini.arm:images/arm64-v8a/advancedFeatures.ini \ prebuilts/qemu-kernel/arm64/$(PRODUCT_KERNEL_VERSION)/kernel-qemu2:images/arm64-v8a/kernel-ranchu PRODUCT_COPY_FILES += \ + device/generic/goldfish/fstab.ranchu.initrd.arm:$(TARGET_COPY_OUT_RAMDISK)/fstab.ranchu \ device/generic/goldfish/manifest-arm.xml:$(TARGET_COPY_OUT_VENDOR)/manifest.xml \ - development/sys-img/advancedFeatures.ini.arm:advancedFeatures.ini \ + device/generic/goldfish/data/etc/advancedFeatures.ini.arm:advancedFeatures.ini \ prebuilts/qemu-kernel/arm64/$(PRODUCT_KERNEL_VERSION)/kernel-qemu2:kernel-ranchu \ device/generic/goldfish/fstab.ranchu.arm:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.ranchu EMULATOR_VENDOR_NO_GNSS := true diff --git a/data/etc/advancedFeatures.ini b/data/etc/advancedFeatures.ini index 70dec80..e1f8b6a 100644 --- a/data/etc/advancedFeatures.ini +++ b/data/etc/advancedFeatures.ini @@ -5,7 +5,6 @@ GLESDynamicVersion = on GLDMA = on EncryptUserData = on IntelPerformanceMonitoringUnit = on -SystemAsRoot = on Wifi = on -KernelDeviceTreeBlobSupport = on HostComposition = on +DynamicPartition = on diff --git a/data/etc/advancedFeatures.ini.arm b/data/etc/advancedFeatures.ini.arm index 29c1cf7..0acc6d5 100644 --- a/data/etc/advancedFeatures.ini.arm +++ b/data/etc/advancedFeatures.ini.arm @@ -3,4 +3,4 @@ LogcatPipe = on GLAsyncSwap = on GLESDynamicVersion = on GLDMA = on -SystemAsRoot = on +DynamicPartition = on diff --git a/data/etc/user/advancedFeatures.ini b/data/etc/user/advancedFeatures.ini index cb8280a..a63f367 100644 --- a/data/etc/user/advancedFeatures.ini +++ b/data/etc/user/advancedFeatures.ini @@ -6,7 +6,6 @@ GLESDynamicVersion = on PlayStoreImage = on EncryptUserData = on IntelPerformanceMonitoringUnit = on -SystemAsRoot = on Wifi = on -KernelDeviceTreeBlobSupport = on HostComposition = on +DynamicPartition = on diff --git a/fstab.ranchu b/fstab.ranchu index 4925334..5fcd5ce 100644 --- a/fstab.ranchu +++ b/fstab.ranchu @@ -1,7 +1,7 @@ # Android fstab file. -#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> -# The filesystem that contains the filesystem checker binary (typically /system) cannot -# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK -/dev/block/vdc /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,quota,fileencryption=aes-256-xts:aes-256-cts,reservedsize=128M -/devices/*/block/vdf auto auto defaults voldmanaged=sdcard:auto,encryptable=userdata -/dev/block/zram0 none swap defaults zramsize=75% +#<dev> <mnt_point> <type> <mnt_flags options> <fs_mgr_flags> +system /system ext4 ro,barrier=1 wait,logical,avb=vbmeta,first_stage_mount +vendor /vendor ext4 ro,barrier=1 wait,logical,first_stage_mount +/dev/block/vdc /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,quota,fileencryption=aes-256-xts:aes-256-cts,reservedsize=128M +/devices/*/block/vdf auto auto defaults voldmanaged=sdcard:auto,encryptable=userdata +dev/block/zram0 none swap defaults zramsize=75% diff --git a/fstab.ranchu.arm b/fstab.ranchu.arm index 41ecddc..a821e97 100644 --- a/fstab.ranchu.arm +++ b/fstab.ranchu.arm @@ -2,5 +2,7 @@ #<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> # The filesystem that contains the filesystem checker binary (typically /system) cannot # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK -/dev/block/vdc /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,quota -/devices/*/block/vde auto auto defaults voldmanaged=sdcard:auto,encryptable=userdata +system /system ext4 ro,barrier=1 wait,logical,first_stage_mount +vendor /vendor ext4 ro,barrier=1 wait,logical,first_stage_mount +/dev/block/vdc /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,quota +/devices/*/block/vde auto auto defaults voldmanaged=sdcard:auto,encryptable=userdata diff --git a/fstab.ranchu.initrd b/fstab.ranchu.initrd new file mode 100644 index 0000000..e792feb --- /dev/null +++ b/fstab.ranchu.initrd @@ -0,0 +1,4 @@ +# Android fstab file for ramdisk +#<dev> <mnt_point> <type> <mnt_flags options> <fs_mgr_flags> +system /system ext4 ro,barrier=1 wait,logical,avb=vbmeta,first_stage_mount +vendor /vendor ext4 ro,barrier=1 wait,logical,first_stage_mount diff --git a/fstab.ranchu.initrd.arm b/fstab.ranchu.initrd.arm new file mode 100644 index 0000000..5605663 --- /dev/null +++ b/fstab.ranchu.initrd.arm @@ -0,0 +1,4 @@ +# Android fstab file. +#<dev> <mnt_point> <type> <mnt_flags options> <fs_mgr_flags> +system /system ext4 ro,barrier=1 wait,logical,first_stage_mount +vendor /vendor ext4 ro,barrier=1 wait,logical,first_stage_mount diff --git a/kernel-tests/advancedFeatures.ini b/kernel-tests/advancedFeatures.ini index 0ba5e04..e1f8b6a 100644 --- a/kernel-tests/advancedFeatures.ini +++ b/kernel-tests/advancedFeatures.ini @@ -5,8 +5,6 @@ GLESDynamicVersion = on GLDMA = on EncryptUserData = on IntelPerformanceMonitoringUnit = on -SystemAsRoot = on Wifi = on -KernelDeviceTreeBlobSupport = on HostComposition = on - +DynamicPartition = on diff --git a/tools/mk_combined_img.py b/tools/mk_combined_img.py index 6769db2..1b7bbff 100644..100755 --- a/tools/mk_combined_img.py +++ b/tools/mk_combined_img.py @@ -74,7 +74,7 @@ def write_partition(partition, output_file, offset): def unsparse_partition(partition): # if the input image is in sparse format, unsparse it - simg2img = os.environ.get('ANDROID_HOST_OUT', '/usr') + '/bin/simg2img' + simg2img = os.environ.get('SIMG2IMG', 'simg2img') print "Unsparsing %s" % (partition["path"]), partition["fd"], temp_file = mkstemp() shell_command([simg2img, partition["path"], temp_file]) @@ -83,12 +83,13 @@ def unsparse_partition(partition): return def clear_partition_table(filename): - sgdisk = os.environ.get('ANDROID_HOST_OUT', '/usr') + '/bin/sgdisk' + sgdisk = os.environ.get('SGDISK', 'sgdisk') + print "%s --clear %s" % (sgdisk, filename) shell_command([sgdisk, '--clear', filename]) return def add_partition(partition, output_file): - sgdisk = os.environ.get('ANDROID_HOST_OUT', '/usr') + '/bin/sgdisk' + sgdisk = os.environ.get('SGDISK', 'sgdisk') num = str(partition["num"]) new_comm = '--new='+num+':'+partition["start"]+':'+partition["end"] type_comm = '--type='+num+':8300' diff --git a/tools/mk_vbmeta_boot_params.sh b/tools/mk_vbmeta_boot_params.sh new file mode 100755 index 0000000..17a39e8 --- /dev/null +++ b/tools/mk_vbmeta_boot_params.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +if [ $# -ne 3 ]; then + echo "Usage: $0 <vbmeta.img> <system.img> <VbmetaBootParams.textproto>" + exit 1 +fi + +# Example Output from 'avbtool calculate_vbmeta_digest --image $OUT/vbmeta.img': +# 3254db8a232946c712b5c6f8c1a80b31f2a200bab98553d86f5915d06bfd5436 +# +# Example Output from 'avbtool info_image --image $OUT/vbmeta.img': +# +# Minimum libavb version: 1.0 +# Header Block: 256 bytes +# Authentication Block: 576 bytes +# Auxiliary Block: 1600 bytes +# Algorithm: SHA256_RSA4096 +# Rollback Index: 0 +# Flags: 0 +# Release String: 'avbtool 1.1.0' +# Descriptors: +# ... +# +# + +set -e + +function die { + echo $1 >&2 + exit 1 +} + +# Incrementing major version causes emulator binaries that do not support the +# version to ignore this file. This can be useful if there is a change +# not supported by older emulator binaries. +readonly MAJOR_VERSION=2 + +readonly VBMETAIMG=$1 +readonly SYSIMG=$2 +readonly TARGET=$3 + +# Extract the digest +readonly VBMETA_DIGEST=$(${AVBTOOL:-avbtool} calculate_vbmeta_digest --image $VBMETAIMG) + +echo "digest is $VBMETA_DIGEST" + +readonly INFO_OUTPUT=$(${AVBTOOL:-avbtool} info_image --image $VBMETAIMG | grep "^Algorithm:") +echo "output is $INFO_OUTPUT" + +# Extract the algorithm +readonly ALG_OUTPUT=$(echo $INFO_OUTPUT | grep "Algorithm:") +echo \"$ALG_OUTPUT\" +readonly ALG_SPLIT=($(echo $ALG_OUTPUT | tr ' ' '\n')) +readonly ORG_ALGORITHM=${ALG_SPLIT[1]} + +if [[ $ORG_ALGORITHM == "SHA256_RSA4096" ]]; then +VBMETA_HASH_ALG=sha256 +else +die "Don't know anything about $ORG_ALGORITHM" +fi + +echo "hash algorithm is $VBMETA_HASH_ALG" + +# extract the size + +function get_bytes { + MY_OUTPUT=$(${AVBTOOL:-avbtool} info_image --image $1 | grep "$2" ) + MY_SPLIT=($(echo $MY_OUTPUT | tr ' ' '\n')) + MY_BYTES=${MY_SPLIT[2]} + echo $MY_BYTES +} + +HEADER_SIZE=$(get_bytes $VBMETAIMG "Header Block:") +AUTHEN_SIZE=$(get_bytes $VBMETAIMG "Authentication Block:") +AUX_SIZE=$(get_bytes $VBMETAIMG "Auxiliary Block:") +SYSMETA_SIZE=$(get_bytes $SYSIMG "VBMeta size:") + +VBMETA_SIZE=$(expr $HEADER_SIZE + $AUTHEN_SIZE + $AUX_SIZE + $SYSMETA_SIZE) + +echo "vbmeta size $VBMETA_SIZE" + +HEADER_COMMENT="# androidboot.vbmeta.size=$VBMETA_SIZE androidboot.vbmeta.hash_alg=$VBMETA_HASH_ALG androidboot.vbmeta.digest=$VBMETA_DIGEST" + +echo $HEADER_COMMENT > $TARGET +echo "major_version: $MAJOR_VERSION" >> $TARGET +#echo "param: \"androidboot.slot_suffix=_a\"" >> $TARGET +echo "param: \"androidboot.vbmeta.size=$VBMETA_SIZE\"" >> $TARGET +echo "param: \"androidboot.vbmeta.hash_alg=$VBMETA_HASH_ALG\"" >> $TARGET +echo "param: \"androidboot.vbmeta.digest=$VBMETA_DIGEST\"" >> $TARGET @@ -91,6 +91,7 @@ PRODUCT_PACKAGES += \ android.hardware.gnss@1.0-impl endif + PRODUCT_PACKAGES += \ android.hardware.sensors@1.0-impl \ android.hardware.sensors@1.0-service @@ -138,6 +139,7 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ + device/generic/goldfish/fstab.ranchu.initrd:$(TARGET_COPY_OUT_RAMDISK)/fstab.ranchu \ device/generic/goldfish/data/etc/apns-conf.xml:data/misc/apns/apns-conf.xml \ device/generic/goldfish/data/etc/local.prop:data/local.prop \ device/generic/goldfish/init.ranchu-core.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.ranchu-core.sh \ diff --git a/x86-vendor.mk b/x86-vendor.mk index 6824b87..4a2eb10 100644 --- a/x86-vendor.mk +++ b/x86-vendor.mk @@ -8,11 +8,11 @@ PRODUCT_PROPERTY_OVERRIDES += \ # build quite specifically for the emulator, and might not be # entirely appropriate to inherit from for on-device configurations. PRODUCT_COPY_FILES += \ - development/sys-img/advancedFeatures.ini:advancedFeatures.ini \ + device/generic/goldfish/data/etc/advancedFeatures.ini:advancedFeatures.ini \ device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \ prebuilts/qemu-kernel/x86_64/$(PRODUCT_KERNEL_VERSION)/kernel-qemu2:kernel-ranchu-64 PRODUCT_SDK_ADDON_COPY_FILES += \ - development/sys-img/advancedFeatures.ini:images/x86/advancedFeatures.ini \ + device/generic/goldfish/data/etc/advancedFeatures.ini:images/x86/advancedFeatures.ini \ device/generic/goldfish/data/etc/encryptionkey.img:images/x86/encryptionkey.img \ prebuilts/qemu-kernel/x86_64/$(PRODUCT_KERNEL_VERSION)/kernel-qemu2:images/x86/kernel-ranchu-64 diff --git a/x86_64-vendor.mk b/x86_64-vendor.mk index bab4ae8..16ccf6a 100644 --- a/x86_64-vendor.mk +++ b/x86_64-vendor.mk @@ -8,11 +8,11 @@ PRODUCT_PROPERTY_OVERRIDES += \ # build quite specifically for the emulator, and might not be # entirely appropriate to inherit from for on-device configurations. PRODUCT_COPY_FILES += \ - development/sys-img/advancedFeatures.ini:advancedFeatures.ini \ + device/generic/goldfish/data/etc/advancedFeatures.ini:advancedFeatures.ini \ device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \ prebuilts/qemu-kernel/x86_64/$(PRODUCT_KERNEL_VERSION)/kernel-qemu2:kernel-ranchu PRODUCT_SDK_ADDON_COPY_FILES += \ - development/sys-img/advancedFeatures.ini:images/x86_64/advancedFeatures.ini \ + device/generic/goldfish/data/etc/advancedFeatures.ini:images/x86_64/advancedFeatures.ini \ device/generic/goldfish/data/etc/encryptionkey.img:images/x86_64/encryptionkey.img \ prebuilts/qemu-kernel/x86_64/$(PRODUCT_KERNEL_VERSION)/kernel-qemu2:images/x86_64/kernel-ranchu |