hikey: restructure hikey device configuration am: af628c2c2e
am: 8877dc9259

Change-Id: I9090530b25bde7acacc751637ba86e2cea7f188b
diff --git a/BoardConfig.mk b/BoardConfigCommon.mk
similarity index 68%
rename from BoardConfig.mk
rename to BoardConfigCommon.mk
index dd1fadc..58ba88a 100644
--- a/BoardConfig.mk
+++ b/BoardConfigCommon.mk
@@ -15,7 +15,6 @@
 TARGET_SUPPORTS_32_BIT_APPS := true
 TARGET_SUPPORTS_64_BIT_APPS := true
 
-TARGET_BOARD_PLATFORM := hikey
 WITH_DEXPREOPT ?= true
 USE_OPENGL_RENDERER := true
 ANDROID_ENABLE_RENDERSCRIPT := true
@@ -30,12 +29,6 @@
 BOARD_HOSTAPD_DRIVER := NL80211
 CONFIG_DRIVER_NL80211 := y
 
-ifeq ($(TARGET_KERNEL_USE_4_1), true)
-BOARD_KERNEL_CMDLINE := console=ttyAMA3,115200 androidboot.console=ttyAMA3 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime
-else
-BOARD_KERNEL_CMDLINE := console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime
-endif
-
 TARGET_NO_BOOTLOADER := true
 TARGET_NO_KERNEL := false
 TARGET_NO_RECOVERY := true
@@ -43,15 +36,7 @@
 BOARD_USES_GENERIC_AUDIO := true
 USE_CAMERA_STUB := true
 TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
-ifeq ($(TARGET_USERDATAIMAGE_4GB), true)
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 1595915776
-else
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 5588893184
-endif
-BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456
 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_FLASH_BLOCK_SIZE := 131072
 TARGET_USE_PAN_DISPLAY := true
 
 # enable to use the CPUSETS feature
diff --git a/hikey.kl b/common.kl
similarity index 100%
rename from hikey.kl
rename to common.kl
diff --git a/device.mk b/device-common.mk
similarity index 76%
rename from device.mk
rename to device-common.mk
index a9a7a66..d3ecf60 100644
--- a/device.mk
+++ b/device-common.mk
@@ -17,24 +17,6 @@
 # Adjust the dalvik heap to be appropriate for a tablet.
 $(call inherit-product-if-exists, frameworks/native/build/tablet-10in-xhdpi-2048-dalvik-heap.mk)
 
-ifeq ($(TARGET_PREBUILT_KERNEL),)
-LOCAL_KERNEL := device/linaro/hikey-kernel/Image-dtb
-LOCAL_DTB := device/linaro/hikey-kernel/hi6220-hikey.dtb
-LOCAL_FSTAB := fstab.hikey
-else
-LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
-LOCAL_DTB := $(TARGET_PREBUILT_DTB)
-LOCAL_FSTAB := $(TARGET_FSTAB)
-endif
-
-PRODUCT_COPY_FILES +=   $(LOCAL_KERNEL):kernel \
-                        $(LOCAL_DTB):hi6220-hikey.dtb \
-			$(LOCAL_PATH)/$(LOCAL_FSTAB):root/fstab.hikey \
-			$(LOCAL_PATH)/init.hikey.rc:root/init.hikey.rc \
-			$(LOCAL_PATH)/init.hikey.usb.rc:root/init.hikey.usb.rc \
-			$(LOCAL_PATH)/ueventd.hikey.rc:root/ueventd.hikey.rc \
-			$(LOCAL_PATH)/hikey.kl:system/usr/keylayout/hikey.kl
-
 # Set custom settings
 DEVICE_PACKAGE_OVERLAYS := device/linaro/hikey/overlay
 
@@ -49,9 +31,8 @@
 # Build and run only ART
 PRODUCT_RUNTIMES := runtime_libart_default
 
-# Build HiKey HDMI, bluetooth a2dp and usb audio HALs
-PRODUCT_PACKAGES += audio.primary.hikey \
-		    audio.a2dp.default \
+# Build default bluetooth a2dp and usb audio HALs
+PRODUCT_PACKAGES += audio.a2dp.default \
 		    audio.usb.default \
 		    audio.r_submix.default \
 		    tinyplay
@@ -62,15 +43,6 @@
     android.hardware.broadcastradio@1.0-impl \
     android.hardware.soundtrigger@2.0-impl
 
-# Include USB speed switch App
-PRODUCT_PACKAGES += UsbSpeedSwitch
-
-# Build libion
-PRODUCT_PACKAGES += libion
-
-# Build gralloc for hikey
-PRODUCT_PACKAGES += gralloc.hikey
-
 # Set zygote config
 PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote64_32
 PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64_32.rc:root/init.zygote64_32.rc
@@ -82,7 +54,6 @@
 			wl18xx-conf.bin
 
 # PowerHAL
-PRODUCT_PACKAGES += power.hikey
 PRODUCT_PACKAGES += android.hardware.power@1.0-impl
 
 # Copy hardware config file(s)
@@ -94,9 +65,6 @@
         frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \
         frameworks/native/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml
 
-# Include vendor binaries
-$(call inherit-product-if-exists, vendor/linaro/hikey/device-vendor.mk)
-
 # Include BT modules
 $(call inherit-product-if-exists, device/linaro/hikey/wpan/ti-wpan-products.mk)
 
@@ -111,4 +79,3 @@
 PRODUCT_COPY_FILES += \
         device/linaro/hikey/etc/media_codecs.xml:system/etc/media_codecs.xml \
         frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:system/etc/media_codecs_google_audio.xml
-
diff --git a/hikey.mk b/hikey.mk
index 0a8065c..2368566 100644
--- a/hikey.mk
+++ b/hikey.mk
@@ -6,7 +6,8 @@
 
 #
 # Inherit the full_base and device configurations
-$(call inherit-product, device/linaro/hikey/device.mk)
+$(call inherit-product, device/linaro/hikey/hikey/device-hikey.mk)
+$(call inherit-product, device/linaro/hikey/device-common.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
 
 #
diff --git a/hikey/BoardConfig.mk b/hikey/BoardConfig.mk
new file mode 100644
index 0000000..6d17130
--- /dev/null
+++ b/hikey/BoardConfig.mk
@@ -0,0 +1,17 @@
+include device/linaro/hikey/BoardConfigCommon.mk
+
+TARGET_BOARD_PLATFORM := hikey
+ifeq ($(TARGET_KERNEL_USE_4_1), true)
+BOARD_KERNEL_CMDLINE := console=ttyAMA3,115200 androidboot.console=ttyAMA3 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime
+else
+BOARD_KERNEL_CMDLINE := console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime
+endif
+
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
+ifeq ($(TARGET_USERDATAIMAGE_4GB), true)
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 1595915776
+else
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 5588893184
+endif
+BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456
+BOARD_FLASH_BLOCK_SIZE := 131072
diff --git a/board-info.txt b/hikey/board-info.txt
similarity index 100%
rename from board-info.txt
rename to hikey/board-info.txt
diff --git a/hikey/device-hikey.mk b/hikey/device-hikey.mk
new file mode 100644
index 0000000..0347358
--- /dev/null
+++ b/hikey/device-hikey.mk
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2011 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.
+#
+
+ifeq ($(TARGET_PREBUILT_KERNEL),)
+LOCAL_KERNEL := device/linaro/hikey-kernel/Image-dtb
+LOCAL_DTB := device/linaro/hikey-kernel/hi6220-hikey.dtb
+LOCAL_FSTAB := fstab.hikey
+else
+LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
+LOCAL_DTB := $(TARGET_PREBUILT_DTB)
+LOCAL_FSTAB := $(TARGET_FSTAB)
+endif
+
+PRODUCT_COPY_FILES +=   $(LOCAL_KERNEL):kernel \
+                        $(LOCAL_DTB):hi6220-hikey.dtb \
+			$(LOCAL_PATH)/$(LOCAL_FSTAB):root/fstab.hikey \
+			device/linaro/hikey/init.common.rc:root/init.hikey.rc \
+			device/linaro/hikey/init.common.usb.rc:root/init.hikey.usb.rc \
+			device/linaro/hikey/ueventd.common.rc:root/ueventd.hikey.rc \
+			device/linaro/hikey/common.kl:system/usr/keylayout/hikey.kl
+
+# Build HiKey HDMI audio HAL
+PRODUCT_PACKAGES += audio.primary.hikey
+
+# Include USB speed switch App
+PRODUCT_PACKAGES += UsbSpeedSwitch
+
+# Build libion
+PRODUCT_PACKAGES += libion
+
+# Build gralloc for hikey
+PRODUCT_PACKAGES += gralloc.hikey
+
+# PowerHAL
+PRODUCT_PACKAGES += power.hikey
+
+# Include vendor binaries
+$(call inherit-product-if-exists, vendor/linaro/hikey/device-vendor.mk)
diff --git a/fstab.hikey b/hikey/fstab.hikey
similarity index 100%
rename from fstab.hikey
rename to hikey/fstab.hikey
diff --git a/fstab.hikey-4.1 b/hikey/fstab.hikey-4.1
similarity index 100%
rename from fstab.hikey-4.1
rename to hikey/fstab.hikey-4.1
diff --git a/init.hikey.rc b/init.common.rc
similarity index 97%
rename from init.hikey.rc
rename to init.common.rc
index f990a3e..a13fa3c 100644
--- a/init.hikey.rc
+++ b/init.common.rc
@@ -1,4 +1,4 @@
-import init.hikey.usb.rc
+import init.${ro.hardware}.usb.rc
 
 on init
     # mount debugfs
@@ -12,7 +12,7 @@
     write /proc/sys/kernel/randomize_va_space 0
 
 on fs
-    mount_all /fstab.hikey
+    mount_all /fstab.${ro.hardware}
     setprop ro.crypto.fuse_sdcard false
 
 on post-fs-data
diff --git a/init.hikey.usb.rc b/init.common.usb.rc
similarity index 100%
rename from init.hikey.usb.rc
rename to init.common.usb.rc
diff --git a/ueventd.hikey.rc b/ueventd.common.rc
similarity index 100%
rename from ueventd.hikey.rc
rename to ueventd.common.rc