Add PRODUCT_BOOT_JARS to derive BOOTCLASSPATH

- BOOTCLASSPATH now is product-configurable;
- No need to maintain the duplicate values in core/dex_preopt.mk.
- clean up some legacy ALL_PREBUILTs.
Bug: 9990214

Change-Id: Ie3953e66d282e335bb7782b0ebd56102c35ec10e
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index ce27763..77b239b 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -3,9 +3,9 @@
 #
 ####################################
 
-# TODO: replace it with device's BOOTCLASSPATH
-DEXPREOPT_BOOT_JARS := core:conscrypt:okhttp:core-junit:bouncycastle:ext:framework:framework2:telephony-common:voip-common:mms-common:android.policy:services:apache-xml:webviewchromium
+DEXPREOPT_BOOT_JARS := $(PRODUCT_BOOT_JARS)
 DEXPREOPT_BOOT_JARS_MODULES := $(subst :, ,$(DEXPREOPT_BOOT_JARS))
+PRODUCT_BOOTCLASSPATH := $(subst $(space),:,$(foreach m,$(DEXPREOPT_BOOT_JARS_MODULES),/system/framework/$(m).jar))
 
 DEXPREOPT_BUILD_DIR := $(OUT_DIR)
 DEXPREOPT_PRODUCT_DIR := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(PRODUCT_OUT))/dex_bootjars
diff --git a/core/legacy_prebuilts.mk b/core/legacy_prebuilts.mk
index f767644..c477900 100644
--- a/core/legacy_prebuilts.mk
+++ b/core/legacy_prebuilts.mk
@@ -34,8 +34,6 @@
 	cdt.bin \
 	chat-ril \
 	cpcap-key.kl \
-	data \
-	dev \
 	egl.cfg \
 	firmware_error.565 \
 	firmware_install.565 \
@@ -45,13 +43,11 @@
 	gps.stingray.so \
 	gralloc.omap3.so \
 	gralloc.tegra.so \
-	hosts \
 	hwcomposer.tegra.so \
 	ime \
 	init.goldfish.rc \
 	init.goldfish.sh \
 	init.olympus.rc \
-	init.rc \
 	init.sholes.rc \
 	init.stingray.rc \
 	input \
@@ -76,23 +72,18 @@
 	pm \
 	pppd-ril \
 	pppd-ril.options \
-	proc \
 	qwerty.kl \
 	radio.img \
 	rdl.bin \
 	RFFspeed_501.bmd \
 	RFFstd_501.bmd \
 	savebpver \
-	sbin \
 	sholes-keypad.kl \
 	suplcerts.bks \
 	svc \
-	sys \
-	system \
 	tcmd \
 	ueventd.goldfish.rc \
 	ueventd.olympus.rc \
-	ueventd.rc \
 	ueventd.stingray.rc \
 	vold.fstab \
 	wl1271.bin
diff --git a/core/product.mk b/core/product.mk
index 89bce1d..35b5b84 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -96,7 +96,8 @@
     PRODUCT_VENDOR_KERNEL_HEADERS \
     PRODUCT_FACTORY_RAMDISK_MODULES \
     PRODUCT_FACTORY_BUNDLE_MODULES \
-    PRODUCT_RUNTIMES
+    PRODUCT_RUNTIMES \
+    PRODUCT_BOOT_JARS
 
 
 define dump-product
@@ -208,6 +209,7 @@
 
 
 _product_stash_var_list := $(_product_var_list) \
+	PRODUCT_BOOTCLASSPATH \
 	TARGET_ARCH \
 	TARGET_ARCH_VARIANT \
 	TARGET_CPU_VARIANT \
diff --git a/core/product_config.mk b/core/product_config.mk
index db52f7a..e4b68cf 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -268,6 +268,9 @@
 product_runtimes :=
 #############################################################################
 
+# A list of module names of BOOTCLASSPATH (jar files)
+PRODUCT_BOOT_JARS := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BOOT_JARS)
+
 # Find the device that this product maps to.
 TARGET_DEVICE := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEVICE)
 
diff --git a/target/board/vbox_x86/BoardConfig.mk b/target/board/vbox_x86/BoardConfig.mk
index 80a9077..815ad9e 100644
--- a/target/board/vbox_x86/BoardConfig.mk
+++ b/target/board/vbox_x86/BoardConfig.mk
@@ -9,7 +9,6 @@
 TARGET_HARDWARE_3D := false
 BOARD_USES_GENERIC_AUDIO := true
 USE_CAMERA_STUB := true
-TARGET_PROVIDES_INIT_RC := true
 TARGET_CPU_ABI := x86
 TARGET_USERIMAGES_USE_EXT4 := true
 TARGET_BOOTIMAGE_USE_EXT2 := true
diff --git a/target/board/vbox_x86/device.mk b/target/board/vbox_x86/device.mk
index 2bb96b9..a44a87f 100644
--- a/target/board/vbox_x86/device.mk
+++ b/target/board/vbox_x86/device.mk
@@ -30,7 +30,6 @@
     device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
     device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml \
-    system/core/rootdir/init.rc:root/init.rc \
     build/target/board/vbox_x86/init.vbox_x86.rc:root/init.vbox_x86.rc \
     $(LOCAL_KERNEL):kernel
 
diff --git a/target/product/core.mk b/target/product/core.mk
index b321efd..3e74697 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -78,3 +78,6 @@
     voip-common
 
 $(call inherit-product, $(SRC_TARGET_DIR)/product/core_minimal.mk)
+
+# Override the PRODUCT_BOOT_JARS set in core_minimal.mk
+PRODUCT_BOOT_JARS := core:conscrypt:okhttp:core-junit:bouncycastle:ext:framework:framework2:telephony-common:voip-common:mms-common:android.policy:services:apache-xml:webviewchromium
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 313aee2..04e05a4 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -57,6 +57,8 @@
     sensorservice \
     uiautomator
 
+PRODUCT_BOOT_JARS := core:conscrypt:okhttp:core-junit:bouncycastle:ext:framework:framework2:android.policy:services:apache-xml:webviewchromium
+
 PRODUCT_RUNTIMES := runtime_libdvm_default
 ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
     PRODUCT_RUNTIMES += runtime_libart
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index 15331a9..a9d28fa 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -27,6 +27,8 @@
     gralloc.default \
     gzip \
     init \
+    init.environ.rc \
+    init.rc \
     input \
     libEGL \
     libETC1 \
@@ -72,6 +74,9 @@
     property_contexts \
     mac_permissions.xml
 
+
 PRODUCT_COPY_FILES += \
     system/core/rootdir/init.usb.rc:root/init.usb.rc \
     system/core/rootdir/init.trace.rc:root/init.trace.rc \
+    system/core/rootdir/ueventd.rc:root/ueventd.rc \
+    system/core/rootdir/etc/hosts:system/etc/hosts