Merge "Add new armv8-2a-dotprod arch variant support."
diff --git a/core/Makefile b/core/Makefile
index 65f51fc..fcc89b7 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1422,20 +1422,6 @@
     $(hide) echo "odm_dlkm_selinux_fc=$(SELINUX_FC)" >> $(1)
     $(hide) echo "building_odm_dlkm_image=$(BUILDING_ODM_DLKM_IMAGE)" >> $(1)
 )
-$(if $(filter $(2),modules),\
-    $(if $(BOARD_MODULESIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "modules_fs_type=$(BOARD_MODULESIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
-    $(if $(BOARD_MODULESIMAGE_EXTFS_INODE_COUNT),$(hide) echo "modules_extfs_inode_count=$(BOARD_MODULESIMAGE_EXTFS_INODE_COUNT)" >> $(1))
-    $(if $(BOARD_MODULESIMAGE_EXTFS_RSV_PCT),$(hide) echo "modules_extfs_rsv_pct=$(BOARD_MODULESIMAGE_EXTFS_RSV_PCT)" >> $(1))
-    $(if $(BOARD_MODULESIMAGE_PARTITION_SIZE),$(hide) echo "modules_size=$(BOARD_MODULESIMAGE_PARTITION_SIZE)" >> $(1))
-    $(if $(BOARD_MODULESIMAGE_JOURNAL_SIZE),$(hide) echo "modules_journal_size=$(BOARD_MODULESIMAGE_JOURNAL_SIZE)" >> $(1))
-    $(if $(BOARD_MODULESIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "modules_squashfs_compressor=$(BOARD_MODULESIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
-    $(if $(BOARD_MODULESIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "modules_squashfs_compressor_opt=$(BOARD_MODULESIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
-    $(if $(BOARD_MODULESIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "modules_squashfs_block_size=$(BOARD_MODULESIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
-    $(if $(BOARD_MODULESIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "modules_squashfs_disable_4k_align=$(BOARD_MODULESIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
-    $(if $(BOARD_MODULESIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "modules_reserved_size=$(BOARD_MODULESIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
-    $(hide) echo "modules_selinux_fc=$(SELINUX_FC)" >> $(1)
-    $(hide) echo "building_modules_image=$(BUILDING_MODULES_IMAGE)" >> $(1)
-)
 $(if $(filter $(2),oem),\
     $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
     $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
@@ -1571,9 +1557,6 @@
 ifdef BUILDING_ODM_DLKM_IMAGE
   PROP_DICTIONARY_IMAGES += odm_dlkm
 endif
-ifdef BUILDING_MODULES_IMAGE
-  PROP_DICTIONARY_IMAGES += modules
-endif
 define generate-userimage-prop-dictionary
   $(call generate-image-prop-dictionary,$(1),$(PROP_DICTIONARY_IMAGES),$(2))
 endef
@@ -3030,54 +3013,6 @@
 $(eval $(call copy-one-file,$(BOARD_PREBUILT_ODM_DLKMIMAGE),$(INSTALLED_ODM_DLKMIMAGE_TARGET)))
 endif
 
-# -----------------------------------------------------------------
-# modules partition image
-ifdef BUILDING_MODULES_IMAGE
-INTERNAL_MODULESIMAGE_FILES := \
-    $(filter $(TARGET_OUT_MODULES)/%,\
-      $(ALL_DEFAULT_INSTALLED_MODULES))
-
-INSTALLED_FILES_FILE_MODULES := $(PRODUCT_OUT)/installed-files-modules.txt
-INSTALLED_FILES_JSON_MODULES := $(INSTALLED_FILES_FILE_MODULES:.txt=.json)
-$(INSTALLED_FILES_FILE_MODULES): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_MODULES)
-$(INSTALLED_FILES_FILE_MODULES) : $(INTERNAL_MODULESIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
-	@echo Installed file list: $@
-	@mkdir -p $(dir $@)
-	@rm -f $@
-	@mkdir -p $(TARGET_OUT_MODULES)
-	$(hide) $(FILESLIST) $(TARGET_OUT_MODULES) > $(@:.txt=.json)
-	$(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
-
-modulesimage_intermediates := \
-    $(call intermediates-dir-for,PACKAGING,modules)
-BUILT_MODULESIMAGE_TARGET := $(PRODUCT_OUT)/modules.img
-define build-modulesimage-target
-  $(call pretty,"Target modules fs image: $(INSTALLED_MODULESIMAGE_TARGET)")
-  @mkdir -p $(TARGET_OUT_MODULES)
-  @mkdir -p $(modulesimage_intermediates) && rm -rf $(modulesimage_intermediates)/modules_image_info.txt
-  $(call generate-userimage-prop-dictionary, $(modulesimage_intermediates)/modules_image_info.txt, skip_fsck=true)
-  PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
-      $(BUILD_IMAGE) \
-          $(TARGET_OUT_MODULES) $(modulesimage_intermediates)/modules_image_info.txt \
-          $(INSTALLED_MODULESIMAGE_TARGET) $(TARGET_OUT)
-  $(call assert-max-image-size,$(INSTALLED_MODULESIMAGE_TARGET),$(BOARD_MODULESIMAGE_PARTITION_SIZE))
-endef
-
-# We just build this directly to the install location.
-INSTALLED_MODULESIMAGE_TARGET := $(BUILT_MODULESIMAGE_TARGET)
-$(INSTALLED_MODULESIMAGE_TARGET): \
-    $(INTERNAL_USERIMAGES_DEPS) \
-    $(INTERNAL_MODULESIMAGE_FILES) \
-    $(INSTALLED_FILES_FILE_MODULES)
-	$(build-modulesimage-target)
-
-.PHONY: modulesimage-nodeps mnod
-modulesimage-nodeps mnod: | $(INTERNAL_USERIMAGES_DEPS)
-	$(build-modulesimage-target)
-
-sync: $(INTERNAL_MODULESIMAGE_FILES)
-# BOARD_PREBUILT_MODULESIMAGE is not allowed.
-endif
 
 # -----------------------------------------------------------------
 # dtbo image
@@ -3577,10 +3512,7 @@
 # -----------------------------------------------------------------
 # Check VINTF of build
 
-# Note: the following do not have VINTF files:
-# - vendor_dlkm
-# - odm_dlkm
-# - modules
+# Note: vendor_dlkm and odm_dlkm does not have VINTF files.
 ifeq (,$(TARGET_BUILD_UNBUNDLED))
 
 intermediates := $(call intermediates-dir-for,PACKAGING,check_vintf_all)
@@ -4603,11 +4535,6 @@
 	$(hide) $(call package_files-copy-root, \
 	    $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
 endif
-ifdef BUILDING_MODULES_IMAGE
-	@# Contents of the modules image
-	$(hide) $(call package_files-copy-root, \
-	    $(TARGET_OUT_MODULES),$(zip_root)/MODULES)
-endif
 	@# Extra contents of the OTA package
 	$(hide) mkdir -p $(zip_root)/OTA
 	$(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
@@ -4656,7 +4583,6 @@
 	$(hide) cp $(PRODUCT_ODM_DLKM_BASE_FS_PATH) \
 	  $(zip_root)/META/$(notdir $(PRODUCT_ODM_DLKM_BASE_FS_PATH))
 endif
-# No PRODUCT_MODULES_BASE_FS_PATH for modules partition
 ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
 ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
 	$(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
@@ -4751,9 +4677,6 @@
 ifdef BUILDING_ODM_DLKM_IMAGE
 	$(hide) $(call fs_config,$(zip_root)/ODM_DLKM,odm_dlkm/) > $(zip_root)/META/odm_dlkm_filesystem_config.txt
 endif
-ifdef BUILDING_MODULES_IMAGE
-	$(hide) $(call fs_config,$(zip_root)/MODULES,modules/) > $(zip_root)/META/modules_filesystem_config.txt
-endif
 	@# ROOT always contains the files for the root under normal boot.
 	$(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
@@ -4956,7 +4879,7 @@
   $(PROFDATA_ZIP): $(SOONG_ZIP)
 	$(hide) $(SOONG_ZIP) -d -o $@ -C $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION) -f $(LLVM_PROFDATA) -f $(LIBCXX)
 
-  $(call dist-for-goals,droidcore,$(PROFDATA_ZIP))
+  $(call dist-for-goals,droidcore apps_only,$(PROFDATA_ZIP))
 endif
 
 # -----------------------------------------------------------------
@@ -5297,16 +5220,6 @@
 droidcore: $(INSTALLED_QEMU_ODM_DLKMIMAGE)
 endif
 
-ifdef INSTALLED_MODULESIMAGE_TARGET
-INSTALLED_QEMU_MODULESIMAGE := $(PRODUCT_OUT)/modules-qemu.img
-$(INSTALLED_QEMU_MODULESIMAGE): $(INSTALLED_MODULESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
-	@echo Create modules-qemu.img
-	(export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_MODULESIMAGE_TARGET))
-
-modulesimage: $(INSTALLED_QEMU_MODULESIMAGE)
-droidcore: $(INSTALLED_QEMU_MODULESIMAGE)
-endif
-
 QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
 $(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE_TARGET) \
     $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(AVBTOOL)
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 1b41898..58be7a2 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -766,7 +766,7 @@
     $(foreach test_config_file, $(LOCAL_EXTRA_FULL_TEST_CONFIGS), \
       $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
         $(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
-          $(test_config_file):$(dir)/$(notdir $(test_config_file))))))
+          $(test_config_file):$(dir)/$(basename $(notdir $(test_config_file))).config))))
   endif
 
   ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
diff --git a/core/board_config.mk b/core/board_config.mk
index 103e415..95d8af8 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -628,31 +628,6 @@
 .KATI_READONLY := BUILDING_ODM_DLKM_IMAGE
 
 ###########################################
-# Are we building modules image
-BOARD_USES_MODULESIMAGE :=
-ifdef BOARD_PREBUILT_MODULESIMAGE
-  $(error BOARD_PREBUILT_MODULESIMAGE must not be set. Prebuilt modules image is not allowed. Instead, install prebuilt APEXes.)
-endif
-ifdef BOARD_MODULESIMAGE_FILE_SYSTEM_TYPE
-  BOARD_USES_MODULESIMAGE := true
-endif
-
-BUILDING_MODULES_IMAGE :=
-ifeq ($(PRODUCT_BUILD_MODULES_IMAGE),)
-  ifdef BOARD_MODULESIMAGE_FILE_SYSTEM_TYPE
-    BUILDING_MODULES_IMAGE := true
-  endif
-else ifeq ($(PRODUCT_BUILD_MODULES_IMAGE),true)
-  BUILDING_MODULES_IMAGE := true
-  ifndef BOARD_MODULESIMAGE_FILE_SYSTEM_TYPE
-    $(error PRODUCT_BUILD_MODULES_IMAGE set to true, but BOARD_MODULESIMAGE_FILE_SYSTEM_TYPE not defined)
-  endif
-endif
-# BOARD_PREBUILT_MODULESIMAGE is not allowed.
-# The prebuilt for an individual module should be provided instead.
-.KATI_READONLY := BUILDING_MODULES_IMAGE
-
-###########################################
 # Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE.
 TARGET_RECOVERY_UPDATER_LIBS ?=
 AB_OTA_UPDATER ?=
diff --git a/core/combo/HOST_CROSS_linux_bionic-arm64.mk b/core/combo/HOST_CROSS_linux_bionic-arm64.mk
new file mode 100644
index 0000000..df6865f
--- /dev/null
+++ b/core/combo/HOST_CROSS_linux_bionic-arm64.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2020 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.
+#
+
+# Configuration for builds hosted on linux_arm-arm64
+# Included by combo/select.mk
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
diff --git a/core/config.mk b/core/config.mk
index 7886d10..be0b55c 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -898,7 +898,7 @@
 )
 
 # BOARD_*_PARTITION_LIST: a list of the following tokens
-valid_super_partition_list := system vendor product system_ext odm vendor_dlkm odm_dlkm modules
+valid_super_partition_list := system vendor product system_ext odm vendor_dlkm odm_dlkm
 $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
     $(if $(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)), \
         $(error BOARD_$(group)_PARTITION_LIST contains invalid partition name \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index e8eb158..a5571ae 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -148,15 +148,25 @@
 # BUILD_OS is the real host doing the build.
 BUILD_OS := $(HOST_OS)
 
-HOST_CROSS_OS :=
-# We can cross-build Windows binaries on Linux
+# We can do the cross-build only on Linux
 ifeq ($(HOST_OS),linux)
-ifeq ($(BUILD_HOST_static),)
-HOST_CROSS_OS := windows
-HOST_CROSS_ARCH := x86
-HOST_CROSS_2ND_ARCH := x86_64
-2ND_HOST_CROSS_IS_64_BIT := true
-endif
+  # Windows has been the default host_cross OS
+  ifeq (,$(filter-out windows,$(HOST_CROSS_OS)))
+    # We can only create static host binaries for Linux, so if static host
+    # binaries are requested, turn off Windows cross-builds.
+    ifeq ($(BUILD_HOST_static),)
+      HOST_CROSS_OS := windows
+      HOST_CROSS_ARCH := x86
+      HOST_CROSS_2ND_ARCH := x86_64
+      2ND_HOST_CROSS_IS_64_BIT := true
+    endif
+  else ifeq ($(HOST_CROSS_OS),linux_bionic)
+    ifeq (,$(HOST_CROSS_ARCH))
+      $(error HOST_CROSS_ARCH missing.)
+    endif
+  else
+    $(error Unsupported HOST_CROSS_OS $(HOST_CROSS_OS))
+  endif
 endif
 
 ifeq ($(HOST_OS),)
@@ -255,7 +265,6 @@
 TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk
 TARGET_COPY_OUT_ROOT := root
 TARGET_COPY_OUT_RECOVERY := recovery
-TARGET_COPY_OUT_MODULES := modules
 # The directory used for optional partitions depend on the BoardConfig, so
 # they're defined to placeholder values here and swapped after reading the
 # BoardConfig, to be either the partition dir, or a subdir within 'system'.
@@ -888,56 +897,6 @@
   $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS \
   $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED
 
-# Unlike other partitions, modules partition should only contain APEXes at build time.
-TARGET_OUT_MODULES := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_MODULES)
-.KATI_READONLY := TARGET_OUT_MODULES
-
-TARGET_OUT_MODULES_EXECUTABLES :=
-TARGET_OUT_MODULES_OPTIONAL_EXECUTABLES :=
-TARGET_OUT_MODULES_SHARED_LIBRARIES :=
-TARGET_OUT_MODULES_RENDERSCRIPT_BITCODE :=
-TARGET_OUT_MODULES_JAVA_LIBRARIES :=
-TARGET_OUT_MODULES_APPS :=
-TARGET_OUT_MODULES_APPS_PRIVILEGED :=
-TARGET_OUT_MODULES_ETC :=
-.KATI_READONLY := \
-  TARGET_OUT_MODULES_EXECUTABLES \
-  TARGET_OUT_MODULES_OPTIONAL_EXECUTABLES \
-  TARGET_OUT_MODULES_SHARED_LIBRARIES \
-  TARGET_OUT_MODULES_RENDERSCRIPT_BITCODE \
-  TARGET_OUT_MODULES_JAVA_LIBRARIES \
-  TARGET_OUT_MODULES_APPS \
-  TARGET_OUT_MODULES_APPS_PRIVILEGED \
-  TARGET_OUT_MODULES_ETC
-
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_EXECUTABLES :=
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_SHARED_LIBRARIES :=
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_RENDERSCRIPT_BITCODE :=
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_APPS :=
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_APPS_PRIVILEGED :=
-.KATI_READONLY := \
-  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_EXECUTABLES \
-  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_SHARED_LIBRARIES \
-  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_RENDERSCRIPT_BITCODE \
-  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_APPS \
-  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_APPS_PRIVILEGED
-
-$(KATI_obsolete_var \
-    TARGET_OUT_MODULES_EXECUTABLES \
-    TARGET_OUT_MODULES_OPTIONAL_EXECUTABLES \
-    TARGET_OUT_MODULES_SHARED_LIBRARIES \
-    TARGET_OUT_MODULES_RENDERSCRIPT_BITCODE \
-    TARGET_OUT_MODULES_JAVA_LIBRARIES \
-    TARGET_OUT_MODULES_APPS \
-    TARGET_OUT_MODULES_APPS_PRIVILEGED \
-    TARGET_OUT_MODULES_ETC \
-    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_EXECUTABLES \
-    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_SHARED_LIBRARIES \
-    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_RENDERSCRIPT_BITCODE \
-    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_APPS \
-    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_MODULES_APPS_PRIVILEGED \
-    , modules partition should not contain any executables, libraries, or apps. It should only contain APEXes)
-
 TARGET_OUT_BREAKPAD := $(PRODUCT_OUT)/breakpad
 .KATI_READONLY := TARGET_OUT_BREAKPAD
 
diff --git a/core/main.mk b/core/main.mk
index 363ee3d..ebec885 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -608,8 +608,8 @@
   $(eval modules_32 := $(patsubst %:32,%,$(filter %:32,$(2)))) \
   $(eval modules_64 := $(patsubst %:64,%,$(filter %:64,$(2)))) \
   $(eval modules_both := $(filter-out %:32 %:64,$(2))) \
-  $(eval ### For host cross modules, the primary arch is windows x86 and secondary is x86_64) \
-  $(if $(filter HOST_CROSS,$(1)), \
+  $(eval ### if 2ND_HOST_CROSS_IS_64_BIT, then primary/secondary are reversed for HOST_CROSS modules) \
+  $(if $(filter HOST_CROSS_true,$(1)_$(2ND_HOST_CROSS_IS_64_BIT)), \
     $(eval modules_1st_arch := $(modules_32)) \
     $(eval modules_2nd_arch := $(modules_64)), \
     $(eval modules_1st_arch := $(modules_64)) \
@@ -1581,9 +1581,6 @@
 .PHONY: vbmetavendorimage
 vbmetavendorimage: $(INSTALLED_VBMETA_VENDORIMAGE_TARGET)
 
-.PHONY: modulesimage
-modulesimage: $(INSTALLED_MODULESIMAGE_TARGET)
-
 # Build files and then package it into the rom formats
 .PHONY: droidcore
 droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \
diff --git a/core/rbe.mk b/core/rbe.mk
index 5e55cfb..91606d4 100644
--- a/core/rbe.mk
+++ b/core/rbe.mk
@@ -57,7 +57,7 @@
   java_r8_d8_platform := $(platform),Pool=java16
 
   RBE_WRAPPER := $(rbe_dir)/rewrapper
-  RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD --exec_strategy=$(cxx_rbe_exec_strategy) --platform=$(cxx_platform) --compare=$(cxx_compare)
+  RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_allowlist=PWD --exec_strategy=$(cxx_rbe_exec_strategy) --platform=$(cxx_platform) --compare=$(cxx_compare)
 
   # Append rewrapper to existing *_WRAPPER variables so it's possible to
   # use both ccache and rewrapper.
diff --git a/envsetup.sh b/envsetup.sh
index e981034..abe1eab 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1613,6 +1613,41 @@
     done
 }
 
+function showcommands() {
+    local T=$(gettop)
+    if [[ -z "$TARGET_PRODUCT" ]]; then
+        >&2 echo "TARGET_PRODUCT not set. Run lunch."
+        return
+    fi
+    case $(uname -s) in
+        Darwin)
+            PREBUILT_NAME=darwin-x86
+            ;;
+        Linux)
+            PREBUILT_NAME=linux-x86
+            ;;
+        *)
+            >&2 echo Unknown host $(uname -s)
+            return
+            ;;
+    esac
+    if [[ -z "$OUT_DIR" ]]; then
+      if [[ -z "$OUT_DIR_COMMON_BASE" ]]; then
+        OUT_DIR=out
+      else
+        OUT_DIR=${OUT_DIR_COMMON_BASE}/${PWD##*/}
+      fi
+    fi
+    if [[ "$1" == "--regenerate" ]]; then
+      shift 1
+      NINJA_ARGS="-t commands $@" m
+    else
+      (cd $T && prebuilts/build-tools/$PREBUILT_NAME/bin/ninja \
+          -f $OUT_DIR/combined-${TARGET_PRODUCT}.ninja \
+          -t commands "$@")
+    fi
+}
+
 validate_current_shell
 source_vendorsetup
 addcompletions
diff --git a/help.sh b/help.sh
index fd22a78..4af5154 100755
--- a/help.sh
+++ b/help.sh
@@ -48,8 +48,6 @@
                             Stands for "VendorDlkm, NO Dependencies"
     odnod                   Quickly rebuild the odm_dlkm image from built packages
                             Stands for "OdmDlkm, NO Dependencies"
-    mnod                    Quickly rebuild the modules image from built packages
-                            Stands for "Modules, NO Dependencies"
 
 
 So, for example, you could run:
diff --git a/target/board/generic_64bitonly_x86_64/BoardConfig.mk b/target/board/generic_64bitonly_x86_64/BoardConfig.mk
new file mode 100644
index 0000000..71c4357
--- /dev/null
+++ b/target/board/generic_64bitonly_x86_64/BoardConfig.mk
@@ -0,0 +1,45 @@
+# Copyright (C) 2020 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.
+#
+
+# x86_64 emulator specific definitions
+TARGET_CPU_ABI := x86_64
+TARGET_ARCH := x86_64
+TARGET_ARCH_VARIANT := x86_64
+
+# Keep the following for 32-bit native code support
+# There are a few native services still on 32-bit modes, e.g. media & audio.
+# Remove them in S.
+TARGET_2ND_CPU_ABI := x86
+TARGET_2ND_ARCH := x86
+TARGET_2ND_ARCH_VARIANT := x86_64
+
+TARGET_PRELINK_MODULE := false
+include build/make/target/board/BoardConfigGsiCommon.mk
+include build/make/target/board/BoardConfigEmuCommon.mk
+
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86
+
+# Wifi.
+BOARD_WLAN_DEVICE           := emulator
+BOARD_HOSTAPD_DRIVER        := NL80211
+BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+BOARD_HOSTAPD_PRIVATE_LIB   := lib_driver_cmd_simulated
+BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated
+WPA_SUPPLICANT_VERSION      := VER_0_8_X
+WIFI_DRIVER_FW_PATH_PARAM   := "/dev/null"
+WIFI_DRIVER_FW_PATH_STA     := "/dev/null"
+WIFI_DRIVER_FW_PATH_AP      := "/dev/null"
diff --git a/target/board/generic_64bitonly_x86_64/README.txt b/target/board/generic_64bitonly_x86_64/README.txt
new file mode 100644
index 0000000..dc7efd3
--- /dev/null
+++ b/target/board/generic_64bitonly_x86_64/README.txt
@@ -0,0 +1,7 @@
+The "generic_x86_64_app" product defines a non-hardware-specific IA target
+without a kernel or bootloader.
+
+It can be used to build the entire user-level system, and
+will work with the IA version of the emulator,
+
+This supports 64-bit apps only.
diff --git a/target/board/generic_64bitonly_x86_64/device.mk b/target/board/generic_64bitonly_x86_64/device.mk
new file mode 100644
index 0000000..bb49057
--- /dev/null
+++ b/target/board/generic_64bitonly_x86_64/device.mk
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2020 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.
+#
+
+ifdef NET_ETH0_STARTONBOOT
+  PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
+endif
+
+# Ensure we package the BIOS files too.
+PRODUCT_HOST_PACKAGES += \
+    bios.bin \
+    vgabios-cirrus.bin \
diff --git a/target/board/generic_64bitonly_x86_64/system.prop b/target/board/generic_64bitonly_x86_64/system.prop
new file mode 100644
index 0000000..ed9d173
--- /dev/null
+++ b/target/board/generic_64bitonly_x86_64/system.prop
@@ -0,0 +1,5 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/vendor/lib64/libreference-ril.so
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 8c069ba..61a7583 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -43,6 +43,7 @@
 
 else
 PRODUCT_MAKEFILES := \
+    $(LOCAL_DIR)/aosp_64bitonly_x86_64.mk \
     $(LOCAL_DIR)/aosp_arm64_ab.mk \
     $(LOCAL_DIR)/aosp_arm64.mk \
     $(LOCAL_DIR)/aosp_arm_ab.mk \
diff --git a/target/product/aosp_64bitonly_x86_64.mk b/target/product/aosp_64bitonly_x86_64.mk
new file mode 100644
index 0000000..4de4e0c8
--- /dev/null
+++ b/target/product/aosp_64bitonly_x86_64.mk
@@ -0,0 +1,72 @@
+#
+# Copyright 2020 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.
+#
+
+PRODUCT_USE_DYNAMIC_PARTITIONS := true
+
+# The system image of aosp_x86_64_app-userdebug is a GSI for the devices with:
+# - x86 64 bits user space
+# - 64 bits binder interface
+# - system-as-root
+# - VNDK enforcement
+# - compatible property override enabled
+
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+# GSI for system/product & support 64-bit apps only
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+# Enable mainline checking for excat this product name
+ifeq (aosp_64bitonly_x86_64,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# All components inherited here go to vendor image
+#
+$(call inherit-product-if-exists, device/generic/goldfish/x86_64-vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
+
+#
+# Special settings for GSI releasing
+#
+ifeq (aosp_64bitonly_x86_64,$(TARGET_PRODUCT))
+$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_release.mk)
+endif
+
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST += \
+    root/init.zygote64.rc
+
+# This build configuration supports 64-bit apps only
+PRODUCT_NAME := aosp_64bitonly_x86_64
+PRODUCT_DEVICE := generic_64bitonly_x86_64
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on x86_64 App
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index ccff4a6..b97d98d 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -27,6 +27,7 @@
     android.test.base \
     android.test.mock \
     android.test.runner \
+    ANGLE \
     apexd \
     appops \
     app_process \
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index 41e8ca5..5fb68b8 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -24,7 +24,7 @@
 $(error Using $(TARGET_DEVICE_DIR)/android_filesystem_config.h is deprecated, please use TARGET_FS_CONFIG_GEN instead)
 endif
 
-system_android_filesystem_config := system/core/include/private/android_filesystem_config.h
+system_android_filesystem_config := system/core/libcutils/include/private/android_filesystem_config.h
 system_capability_header := bionic/libc/kernel/uapi/linux/capability.h
 
 # List of supported vendor, oem, odm, vendor_dlkm, odm_dlkm, product and system_ext Partitions
diff --git a/tools/fs_config/README b/tools/fs_config/README
deleted file mode 100644
index 21bdeb8..0000000
--- a/tools/fs_config/README
+++ /dev/null
@@ -1,137 +0,0 @@
- _____  _____  _____  _____  __  __  _____
-/  _  \/   __\/  _  \|  _  \/  \/  \/   __\
-|  _  <|   __||  _  ||  |  ||  \/  ||   __|
-\__|\_/\_____/\__|__/|_____/\__ \__/\_____/
-
-The fs_config_generator.py tool uses the platform android_filesystem_config.h and the
-TARGET_FS_CONFIG_GEN files to generate the fs_config_dirs and fs_config_files files for each
-partition, as well as passwd and group files, and the generated_oem_aid.h header.
-
-The fs_config_dirs and fs_config_files binary files are interpreted by the libcutils fs_config()
-function, along with the built-in defaults, to serve as overrides to complete the results. The
-Target files are used by filesystem and adb tools to ensure that the file and directory properties
-are preserved during runtime operations. The host files in the ${OUT} directory are used in the
-final stages when building the filesystem images to set the file and directory properties.
-
-See ./fs_config_generator.py fsconfig --help for how these files are generated.
-
-The passwd and group files are formatted as documented in man pages passwd(5) and group(5) and used
-by bionic for implementing getpwnam() and related functions.
-
-See ./fs_config_generator.py passwd --help and ./fs_config_generator.py group --help for how these
-files are generated.
-
-The generated_oem_aid.h creates identifiers for non-platform AIDs for developers wishing to use them
-in their native code.  To do so, include the oemaids_headers header library in the corresponding
-makefile and #include "generated_oem_aid.h" in the code wishing to use these identifiers.
-
-See ./fs_config_generator.py oemaid --help for how this file is generated.
-
-The parsing of the TARGET_FS_CONFIG_GEN files follows the Python ConfigParser specification, with
-the sections and fields as defined below. There are two types of sections, both sections require all
-options to be specified. The first section type is the "caps" section.
-
-The "caps" section follows the following syntax:
-
-[path]
-mode: Octal file mode
-user: AID_<user>
-group: AID_<group>
-caps: cap*
-
-Where:
-
-[path]
-  The filesystem path to configure. A path ending in / is considered a dir,
-  else its a file.
-
-mode:
-  A valid octal file mode of at least 3 digits. If 3 is specified, it is
-  prefixed with a 0, else mode is used as is.
-
-user:
-  Either the C define for a valid AID or the friendly name. For instance both
-  AID_RADIO and radio are acceptable. Note custom AIDs can be defined in the
-  AID section documented below.
-
-group:
-  Same as user.
-
-caps:
-  The name as declared in
-  system/core/include/private/android_filesystem_capability.h without the
-  leading CAP_. Mixed case is allowed. Caps can also be the raw:
-   * binary (0b0101)
-   * octal (0455)
-   * int (42)
-   * hex (0xFF)
-  For multiple caps, just separate by whitespace.
-
-It is an error to specify multiple sections with the same [path] in different
-files. Note that the same file may contain sections that override the previous
-section in Python versions <= 3.2. In Python 3.2 it's set to strict mode.
-
-
-The next section type is the "AID" section, for specifying OEM specific AIDS.
-
-The AID section follows the following syntax:
-
-[AID_<name>]
-value: <number>
-
-Where:
-
-[AID_<name>]
-  The <name> can contain characters in the set uppercase, numbers
-  and underscores.
-
-value:
-  A valid C style number string. Hex, octal, binary and decimal are supported.
-  See "caps" above for more details on number formatting.
-
-It is an error to specify multiple sections with the same [AID_<name>]. With
-the same constraints as [path] described above. It is also an error to specify
-multiple sections with the same value option. It is also an error to specify a
-value that is outside of the inclusive OEM ranges:
- * AID_OEM_RESERVED_START(2900) - AID_OEM_RESERVED_END(2999)
- * AID_OEM_RESERVED_2_START(5000) - AID_OEM_RESERVED_2_END(5999)
-
-as defined by system/core/include/private/android_filesystem_config.h.
-
-Ordering within the TARGET_FS_CONFIG_GEN files is not relevant. The paths for files are sorted
-like so within their respective array definition:
- * specified path before prefix match
- ** ie foo before f*
- * lexicographical less than before other
- ** ie boo before foo
-
-Given these paths:
-
-paths=['ac', 'a', 'acd', 'an', 'a*', 'aa', 'ac*']
-
-The sort order would be:
-paths=['a', 'aa', 'ac', 'acd', 'an', 'ac*', 'a*']
-
-Thus the fs_config tools will match on specified paths before attempting prefix, and match on the
-longest matching prefix.
-
-The declared AIDS are sorted in ascending numerical order based on the option "value". The string
-representation of value is preserved. Both choices were made for maximum readability of the generated
-file and to line up files. Sync lines are placed with the source file as comments in the generated
-header file.
-
-Unit Tests:
-
-From within the fs_config directory, unit tests can be executed like so:
-$ python -m unittest test_fs_config_generator.Tests
-.............
-----------------------------------------------------------------------
-Ran 13 tests in 0.004s
-
-OK
-
-One could also use nose if they would like:
-$ nose2
-
-To add new tests, simply add a test_<xxx> method to the test class. It will automatically
-get picked up and added to the test suite.
diff --git a/tools/fs_config/README.md b/tools/fs_config/README.md
new file mode 100644
index 0000000..bad5e104
--- /dev/null
+++ b/tools/fs_config/README.md
@@ -0,0 +1,84 @@
+# FS Config Generator
+
+The `fs_config_generator.py` tool uses the platform `android_filesystem_config.h` and the
+`TARGET_FS_CONFIG_GEN` files to generate the following:
+* `fs_config_dirs` and `fs_config_files` files for each partition
+* `passwd` and `group` files for each partition
+* The `generated_oem_aid.h` header
+
+## Outputs
+
+### `fs_config_dirs` and `fs_config_files`
+
+The `fs_config_dirs` and `fs_config_files` binary files are interpreted by the libcutils
+`fs_config()` function, along with the built-in defaults, to serve as overrides to complete the
+results. The Target files are used by filesystem and adb tools to ensure that the file and directory
+properties are preserved during runtime operations. The host files in the `$OUT` directory are used
+in the final stages when building the filesystem images to set the file and directory properties.
+
+See `./fs_config_generator.py fsconfig --help` for how these files are generated.
+
+### `passwd` and `group` files
+
+The `passwd` and `group` files are formatted as documented in man pages passwd(5) and group(5) and
+used by bionic for implementing `getpwnam()` and related functions.
+
+See `./fs_config_generator.py passwd --help` and `./fs_config_generator.py group --help` for how
+these files are generated.
+
+### The `generated_oem_aid.h` header
+
+The `generated_oem_aid.h` creates identifiers for non-platform AIDs for developers wishing to use
+them in their native code.  To do so, include the `oemaids_headers` header library in the
+corresponding makefile and `#include "generated_oem_aid.h"` in the code wishing to use these
+identifiers.
+
+See `./fs_config_generator.py oemaid --help` for how this file is generated.
+
+## Parsing
+
+See the documentation on [source.android.com](https://source.android.com/devices/tech/config/filesystem#configuring-aids) for details and examples.
+
+
+## Ordering
+
+Ordering within the `TARGET_FS_CONFIG_GEN` files is not relevant. The paths for files are sorted
+like so within their respective array definition:
+ * specified path before prefix match
+   * for example: foo before f*
+ * lexicographical less than before other
+   * for example: boo before foo
+
+Given these paths:
+
+    paths=['ac', 'a', 'acd', 'an', 'a*', 'aa', 'ac*']
+
+The sort order would be:
+
+    paths=['a', 'aa', 'ac', 'acd', 'an', 'ac*', 'a*']
+
+Thus the `fs_config` tools will match on specified paths before attempting prefix, and match on the
+longest matching prefix.
+
+The declared AIDs are sorted in ascending numerical order based on the option "value". The string
+representation of value is preserved. Both choices were made for maximum readability of the
+generated file and to line up files. Sync lines are placed with the source file as comments in the
+generated header file.
+
+## Unit Tests
+
+From within the `fs_config` directory, unit tests can be executed like so:
+
+    $ python -m unittest test_fs_config_generator.Tests
+    .............
+    ----------------------------------------------------------------------
+    Ran 13 tests in 0.004s
+
+    OK
+
+One could also use nose if they would like:
+
+    $ nose2
+
+To add new tests, simply add a `test_<xxx>` method to the test class. It will automatically
+get picked up and added to the test suite.
diff --git a/tools/fs_config/end_to_end_test/run_test.sh b/tools/fs_config/end_to_end_test/run_test.sh
index 7402276..b5a7e83 100755
--- a/tools/fs_config/end_to_end_test/run_test.sh
+++ b/tools/fs_config/end_to_end_test/run_test.sh
@@ -1,7 +1,7 @@
 cd $ANDROID_BUILD_TOP/build/make/tools/fs_config/end_to_end_test
 
 $ANDROID_BUILD_TOP/build/make/tools/fs_config/fs_config_generator.py fsconfig \
-  --aid-header $ANDROID_BUILD_TOP/system/core/include/private/android_filesystem_config.h \
+  --aid-header $ANDROID_BUILD_TOP/system/core/libcutils/include/private/android_filesystem_config.h \
   --capability-header $ANDROID_BUILD_TOP/bionic/libc/kernel/uapi/linux/capability.h \
   --partition system \
   --all-partitions vendor,product \
@@ -13,7 +13,7 @@
   echo 'Fail: Mismatch between system_fs_config_files and result_system_fs_config_files'
 
 $ANDROID_BUILD_TOP/build/make/tools/fs_config/fs_config_generator.py fsconfig \
-  --aid-header $ANDROID_BUILD_TOP/system/core/include/private/android_filesystem_config.h \
+  --aid-header $ANDROID_BUILD_TOP/system/core/libcutils/include/private/android_filesystem_config.h \
   --capability-header $ANDROID_BUILD_TOP/bionic/libc/kernel/uapi/linux/capability.h \
   --partition system \
   --all-partitions vendor,product \
@@ -25,7 +25,7 @@
   echo 'Fail: Mismatch between system_fs_config_dirs and result_system_fs_config_dirs'
 
 $ANDROID_BUILD_TOP/build/make/tools/fs_config/fs_config_generator.py fsconfig \
-  --aid-header $ANDROID_BUILD_TOP/system/core/include/private/android_filesystem_config.h \
+  --aid-header $ANDROID_BUILD_TOP/system/core/libcutils/include/private/android_filesystem_config.h \
   --capability-header $ANDROID_BUILD_TOP/bionic/libc/kernel/uapi/linux/capability.h \
   --partition vendor \
   --files \
@@ -36,7 +36,7 @@
   echo 'Fail: Mismatch between vendor_fs_config_files and result_vendor_fs_config_files'
 
 $ANDROID_BUILD_TOP/build/make/tools/fs_config/fs_config_generator.py fsconfig \
-  --aid-header $ANDROID_BUILD_TOP/system/core/include/private/android_filesystem_config.h \
+  --aid-header $ANDROID_BUILD_TOP/system/core/libcutils/include/private/android_filesystem_config.h \
   --capability-header $ANDROID_BUILD_TOP/bionic/libc/kernel/uapi/linux/capability.h \
   --partition vendor \
   --dirs \
@@ -47,7 +47,7 @@
   echo 'Fail: Mismatch between vendor_fs_config_dirs and result_vendor_fs_config_dirs'
 
 $ANDROID_BUILD_TOP/build/make/tools/fs_config/fs_config_generator.py fsconfig \
-  --aid-header $ANDROID_BUILD_TOP/system/core/include/private/android_filesystem_config.h \
+  --aid-header $ANDROID_BUILD_TOP/system/core/libcutils/include/private/android_filesystem_config.h \
   --capability-header $ANDROID_BUILD_TOP/bionic/libc/kernel/uapi/linux/capability.h \
   --partition product \
   --files \
@@ -58,7 +58,7 @@
   echo 'Fail: Mismatch between product_fs_config_files and result_product_fs_config_files'
 
 $ANDROID_BUILD_TOP/build/make/tools/fs_config/fs_config_generator.py fsconfig \
-  --aid-header $ANDROID_BUILD_TOP/system/core/include/private/android_filesystem_config.h \
+  --aid-header $ANDROID_BUILD_TOP/system/core/libcutils/include/private/android_filesystem_config.h \
   --capability-header $ANDROID_BUILD_TOP/bionic/libc/kernel/uapi/linux/capability.h \
   --partition product \
   --dirs \
diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp
index 7f727fb..45e0514 100644
--- a/tools/releasetools/Android.bp
+++ b/tools/releasetools/Android.bp
@@ -272,7 +272,9 @@
         "bsdiff",
         "imgdiff",
         "minigzip",
+        "lz4",
         "mkbootfs",
+        "signapk",
     ],
 }
 
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 43d2e3a..a1f8e31 100644
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -296,7 +296,6 @@
       block_list=block_list)
   return img.name
 
-
 def AddOdmDlkm(output_zip):
   """Turn the contents of OdmDlkm into an odm_dlkm image and store it in output_zip."""
 
@@ -313,22 +312,6 @@
   return img.name
 
 
-def AddModules(output_zip):
-  """Turn the contents of Modules into an modules image and store it in output_zip."""
-
-  img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "modules.img")
-  if os.path.exists(img.name):
-    logger.info("modules.img already exists; no need to rebuild...")
-    return img.name
-
-  block_list = OutputFile(
-      output_zip, OPTIONS.input_tmp, "IMAGES", "modules.map")
-  CreateImage(
-      OPTIONS.input_tmp, OPTIONS.info_dict, "modules", img,
-      block_list=block_list)
-  return img.name
-
-
 def AddDtbo(output_zip):
   """Adds the DTBO image.
 
@@ -437,9 +420,7 @@
   # Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and
   # build fingerprint).
   build_info = common.BuildInfo(info_dict)
-  uuid_seed = what
-  if what != "modules":
-    uuid_seed += "-" + build_info.GetPartitionFingerprint(what)
+  uuid_seed = what + "-" + build_info.GetPartitionFingerprint(what)
   image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed))
   hash_seed = "hash_seed-" + uuid_seed
   image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed))
@@ -817,12 +798,6 @@
                   OPTIONS.info_dict.get("building_product_image") == "true") or
                  os.path.exists(
                      os.path.join(OPTIONS.input_tmp, "IMAGES", "product.img")))
-  has_modules = ((os.path.isdir(os.path.join(OPTIONS.input_tmp,
-                                              "MODULES")) and
-                   OPTIONS.info_dict.get("building_modules_image")
-                   == "true") or
-                  os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
-                                              "modules.img")))
   has_system_ext = (
       (os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM_EXT")) and
        OPTIONS.info_dict.get("building_system_ext_image") == "true") or
@@ -952,10 +927,6 @@
     banner("odm_dlkm")
     partitions['odm_dlkm'] = AddOdmDlkm(output_zip)
 
-  if has_modules:
-    banner("modules")
-    partitions['modules'] = AddModules(output_zip)
-
   if has_system_other:
     banner("system_other")
     AddSystemOther(output_zip)
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index d0f0bd7..9cc072f 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -754,22 +754,6 @@
       d["extfs_rsv_pct"] = "0"
     copy_prop("odm_dlkm_reserved_size", "partition_reserved_size")
     copy_prop("odm_dlkm_selinux_fc", "selinux_fc")
-  elif mount_point == "modules":
-    # modules partition has no AVB.
-    copy_prop("modules_fs_type", "fs_type")
-    copy_prop("modules_size", "partition_size")
-    if not copy_prop("modules_journal_size", "journal_size"):
-      d["journal_size"] = "0"
-    # not setting ext4_share_dup_blocks because modules partition is writable.
-    copy_prop("modules_squashfs_compressor", "squashfs_compressor")
-    copy_prop("modules_squashfs_compressor_opt", "squashfs_compressor_opt")
-    copy_prop("modules_squashfs_block_size", "squashfs_block_size")
-    copy_prop("modules_squashfs_disable_4k_align", "squashfs_disable_4k_align")
-    copy_prop("modules_extfs_inode_count", "extfs_inode_count")
-    if not copy_prop("modules_extfs_rsv_pct", "extfs_rsv_pct"):
-      d["extfs_rsv_pct"] = "0"
-    copy_prop("modules_reserved_size", "partition_reserved_size")
-    copy_prop("modules_selinux_fc", "selinux_fc")
   elif mount_point == "oem":
     copy_prop("fs_type", "fs_type")
     copy_prop("oem_size", "partition_size")
@@ -822,8 +806,6 @@
     copy_prop("partition_size", "product_size")
   elif mount_point == "system_ext":
     copy_prop("partition_size", "system_ext_size")
-  elif mount_point == "modules":
-    copy_prop("partition_size", "modules_size")
   return d
 
 
@@ -869,8 +851,6 @@
       mount_point = "product"
     elif image_filename == "system_ext.img":
       mount_point = "system_ext"
-    elif image_filename == "modules.img":
-      mount_point = "modules"
     else:
       logger.error("Unknown image file name %s", image_filename)
       sys.exit(1)
diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py
index 5151567..0edefac 100755
--- a/tools/releasetools/check_target_files_vintf.py
+++ b/tools/releasetools/check_target_files_vintf.py
@@ -46,10 +46,7 @@
     '/product': ('PRODUCT', 'SYSTEM/product'),
     '/odm': ('ODM', 'VENDOR/odm', 'SYSTEM/vendor/odm'),
     '/system_ext': ('SYSTEM_EXT', 'SYSTEM/system_ext'),
-    # The following do not have VINTF files:
-    # - vendor_dlkm
-    # - odm_dlkm
-    # - modules
+    # vendor_dlkm and odm_dlkm does not have VINTF files.
 }
 
 UNZIP_PATTERN = ['META/*', '*/build.prop']
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index f5aebdd..2833397 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -272,7 +272,7 @@
 # Images to be excluded from secondary payload. We essentially only keep
 # 'system_other' and bootloader partitions.
 SECONDARY_PAYLOAD_SKIPPED_IMAGES = [
-    'boot', 'dtbo', 'modules', 'modem', 'odm', 'odm_dlkm', 'product', 'radio', 'recovery',
+    'boot', 'dtbo', 'modem', 'odm', 'odm_dlkm', 'product', 'radio', 'recovery',
     'system_ext', 'vbmeta', 'vbmeta_system', 'vbmeta_vendor', 'vendor',
     'vendor_boot']