x86: qemu emulator is the default build target

Change-Id: I200536d2d997eda6a6e62eaa9050269e3c7ff6c4
Orig-Change-Id: I1fc3cb491d593d3e28f90278cfc8de5d77852932
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
diff --git a/core/Makefile b/core/Makefile
index f4669f2..8de9b04 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1219,7 +1219,7 @@
 
 INTERNAL_EMULATOR_PACKAGE_FILES += \
         $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
-        prebuilt/android-arm/kernel/kernel-qemu \
+        prebuilt/android-$(TARGET_ARCH)/kernel/kernel-qemu \
         $(INSTALLED_RAMDISK_TARGET) \
 		$(INSTALLED_SYSTEMIMAGE) \
 		$(INSTALLED_USERDATAIMAGE_TARGET)
@@ -1337,6 +1337,8 @@
 			-I $(HOST_OUT) \
 			-I $(TARGET_COMMON_OUT_ROOT) \
 			-v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
+			-v "TARGET_ARCH=$(TARGET_ARCH)" \
+			-v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
 			-o $(PRIVATE_DIR) && \
 		cp -f $(target_notice_file_txt) \
 				$(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \
diff --git a/target/board/generic_x86/AndroidBoard.mk b/target/board/generic_x86/AndroidBoard.mk
index d8b37c6..8fb68f8 100644
--- a/target/board/generic_x86/AndroidBoard.mk
+++ b/target/board/generic_x86/AndroidBoard.mk
@@ -1,10 +1,3 @@
 LOCAL_PATH := $(call my-dir)
 
-ifeq ($(TARGET_PREBUILT_KERNEL),)
-LOCAL_KERNEL := prebuilt/android-x86/kernel/kernel
-else
-LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
-endif
-
-PRODUCT_COPY_FILES += \
-    $(LOCAL_KERNEL):kernel
+#
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index 2268d41..1bad20d 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -1,30 +1,23 @@
-TARGET_ARCH=x86
-DISABLE_DEXPREOPT := true
-TARGET_COMPRESS_MODULE_SYMBOLS := false
-TARGET_PRELINK_MODULE := false
-TARGET_NO_RECOVERY := true
-TARGET_HARDWARE_3D := false
-BOARD_USES_GENERIC_AUDIO := true
-USE_CAMERA_STUB := true
-TARGET_PROVIDES_INIT_RC := true
-USE_CUSTOM_RUNTIME_HEAP_MAX := "32M"
+# config.mk
+#
+# Product-specific compile-time definitions.
+#
+
+# The generic product target doesn't have any hardware-specific pieces.
+TARGET_NO_BOOTLOADER := true
+TARGET_NO_KERNEL := true
 TARGET_CPU_ABI := x86
-TARGET_USERIMAGES_USE_EXT4 := true
-TARGET_BOOTIMAGE_USE_EXT2 := true
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := x86-atom
+TARGET_PRELINK_MODULE := false
 
-# For VirtualBox and likely other emulators
-BOARD_INSTALLER_CMDLINE := init=/init console=ttyS0 console=tty0 androidboot.hardware=generic_x86 vga=788 androidboot.console=tty0 verbose
-BOARD_KERNEL_CMDLINE := init=/init console=tty0 console=ttyS0 androidboot.hardware=generic_x86 vga=788 androidboot.console=tty0 verbose
-TARGET_USE_DISKINSTALLER := true
-TARGET_DISK_LAYOUT_CONFIG := build/target/board/generic_x86/disk_layout.conf
-BOARD_BOOTIMAGE_MAX_SIZE := 8388608
-BOARD_SYSLOADER_MAX_SIZE := 7340032
-BOARD_FLASH_BLOCK_SIZE := 512
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 50M
-BOARD_INSTALLERIMAGE_PARTITION_SIZE := 500M
-TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+# The IA emulator (qemu) uses the Goldfish devices
+HAVE_HTC_AUDIO_DRIVER := true
+BOARD_USES_GENERIC_AUDIO := true
 
+# no hardware camera
+USE_CAMERA_STUB := true
 
-# The eth0 device should be started with dhcp on boot.
-# Useful for emulators that don't provide a wifi connection.
-NET_ETH0_STARTONBOOT := true
+# Set /system/bin/sh to mksh, not ash, to test the transition.
+TARGET_SHELL := mksh
+
diff --git a/target/board/generic_x86/README.txt b/target/board/generic_x86/README.txt
index 585a373..938d982 100644
--- a/target/board/generic_x86/README.txt
+++ b/target/board/generic_x86/README.txt
@@ -1,29 +1,8 @@
-The generic_x86 board target provides basic services on very basic
-hardware (really for an emulation). To build with generic_x86, you will
-need an appropriate kernel for your emulation (or device).
+The "generic_x86" product defines a non-hardware-specific IA target
+without a kernel or bootloader.
 
-A1. Create a new top level directory and pull the AOSP repository
-        mkdir $HOME/AOSP
-        cd $HOME/AOSP
-        repo init -u git://android.git.kernel.org/platform/manifest.git
-        repo sync
+It can be used to build the entire user-level system, and
+will work with the IA version of the emulator,
 
-A2. Copy in the kernel
-        cd $HOME/AOSP
-        cp ~/bzImage.your_device $HOME/AOSP/prebuilt/android-x86/kernel/kernel
-
-A3. Build
-        cd $HOME/AOSP
-        source build/envsetup.sh
-        lunch generic_x86-eng
-        make -j8
-
-The build will generate some image files whose format may or may not be correct for your
-device. You can build an installer image disk for the VirtualBox emulator using the command:
-
-A4. Build a VirtualBox installer image
-	cd $HOME/AOSP
-        source build/envsetup.sh
-        lunch generic_x86-eng
-        make -j8 installer_vdi
-
+It is not a product "base class"; no other products inherit
+from it or use it in any way.
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
new file mode 100644
index 0000000..0b4dc27
--- /dev/null
+++ b/target/board/generic_x86/device.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2009 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.
+#
+
+# This is a build configuration for the product aspects that
+# are specific to the emulator.
+
+PRODUCT_PROPERTY_OVERRIDES := \
+    ro.ril.hsxpa=1 \
+    ro.ril.gprsclass=10
+
+PRODUCT_COPY_FILES := \
+    development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
+    development/data/etc/vold.conf:system/etc/vold.conf
diff --git a/target/board/generic_x86/disk_layout.conf b/target/board/generic_x86/disk_layout.conf
deleted file mode 100644
index 7b073ee..0000000
--- a/target/board/generic_x86/disk_layout.conf
+++ /dev/null
@@ -1,54 +0,0 @@
-device {
-    path /dev/block/sda
-
-    scheme mbr
-
-    # bytes in a disk sector (== 1 LBA), must be a power of 2!
-    sector_size 512
-
-    # What LBA should the partitions start at?
-    start_lba 2048
-
-    # Autodetect disk size if == 0
-    num_lba 0
-
-    partitions {
-        sysloader {
-            active y
-            type linux
-            len 7M
-        }
-
-        recovery {
-            active y
-            type linux
-            len 16M
-        }
-
-        boot {
-            active y
-            type linux
-            len 8M
-        }
-
-        cache {
-            type linux
-            len 512M
-        }
-
-        system {
-            type linux
-            len 512M
-        }
-
-        third_party {
-            type linux
-            len 512M
-        }
-
-        data {
-            type linux
-            len -1
-        }
-    }
-}
diff --git a/target/board/generic_x86/system.prop b/target/board/generic_x86/system.prop
new file mode 100644
index 0000000..137a0f9
--- /dev/null
+++ b/target/board/generic_x86/system.prop
@@ -0,0 +1,6 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/system/lib/libreference-ril.so
+rild.libargs=-d /dev/ttyS0
diff --git a/target/product/full_x86.mk b/target/product/full_x86.mk
index affdc13..e33ef14 100644
--- a/target/product/full_x86.mk
+++ b/target/product/full_x86.mk
@@ -16,19 +16,14 @@
 
 # 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
-# x86 build, but all those aspects can be overridden
-# in inherited configurations.
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
 
-# If running on an emulator or some other device that has a LAN connection
-# that isn't a wifi connection. This will instruct init.rc to enable the
-# network connection so that you can use it with ADB
-ifdef NET_ETH0_STARTONBOOT
-  PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
-endif
-
-$(call inherit-product, build/target/product/full.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk)
 
 # Overrides
 PRODUCT_NAME := full_x86
 PRODUCT_DEVICE := generic_x86
-PRODUCT_MODEL := Full Android x86
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := Full Android on x86 Emulator
diff --git a/target/product/generic_x86.mk b/target/product/generic_x86.mk
index 9713900..7e77a27 100644
--- a/target/product/generic_x86.mk
+++ b/target/product/generic_x86.mk
@@ -1,34 +1,26 @@
+#
+# Copyright (C) 2007 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.
+#
+
 # This is a generic product that isn't specialized for a specific device.
-# It includes the base Android platform. If you need Google-specific features,
-# you should derive from generic_with_google.mk
+# It includes the base Android platform.
 
-PRODUCT_PACKAGES := \
-    AlarmClock \
-    AlarmProvider \
-    Calendar \
-    Camera \
-    DrmProvider \
-    LatinIME \
-    Mms \
-    Music \
-    Settings \
-    Sync \
-    Updater \
-    CalendarProvider \
-    SubscribedFeedsProvider \
-    SyncProvider
-
+$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
 
 # Overrides
 PRODUCT_BRAND := generic_x86
 PRODUCT_DEVICE := generic_x86
 PRODUCT_NAME := generic_x86
-PRODUCT_POLICY := android.policy_phone
-
-# If running on an emulator or some other device that has a LAN connection
-# that isn't a wifi connection. This will instruct init.rc to enable the
-# network connection so that you can use it with ADB
-ifdef NET_ETH0_STARTONBOOT
-  PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
-endif