Edison SoC Definition and configuration files

Change-Id: I8e49345c3e4c97769108b646af1fbc5635238162
Author: Bruce Beare <bruce.j.beare@intel.com>
Author: David Zeuthen <zeuthen@google.com>
Author: Imberton, Guilhem <guilhem.imberton@intel.com>
Author: Jianxun Zhang <jianxun.zhang@intel.com>
Author: Kees Cook <keescook@google.com>
Author: Lee Campbell <leecam@google.com>
Author: Pavlin Radoslavov <pavlin@google.com>
Author: mabbas <mohamed.abbas@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
diff --git a/soc/edison/init.edison.rc b/soc/edison/init.edison.rc
new file mode 100644
index 0000000..4fc74b9
--- /dev/null
+++ b/soc/edison/init.edison.rc
@@ -0,0 +1,43 @@
+#
+# Copyright 2015 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.
+#
+
+on init
+    # Android creates by-name disk links with the disk controller
+    # in the generated path, so that the names pulled out of the GPT
+    # can be associated with the correct disk. Create a shortcut to
+    # /dev/block/by-name so that we can use the same fstabs everywhere.
+    symlink /dev/block/pci/pci0000:00/0000:00:01.0/by-name /dev/block/by-name
+    chown system root /dev/watchdog
+    chown root system /sys/module/bcm4334x/parameters/firmware_path
+    chmod 0660 /sys/module/bcm4334x/parameters/firmware_path
+    chown root system /sys/module/bcm4334x/parameters/nvram_path
+    chmod 0660 /sys/module/bcm4334x/parameters/nvram_path
+
+
+on fs
+    mount_all /fstab.${ro.hardware}
+    mkdir /dev/usb-ffs 0770 shell shell
+    mkdir /dev/usb-ffs/adb 0770 shell shell
+    mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
+    write /sys/class/android_usb/android0/f_ffs/aliases adb
+    write /sys/class/android_usb/android0/iSerial ${ro.hardware}${ro.serialno}
+
+service watchdogd /sbin/watchdogd
+    user system
+    group root
+    class core
+    critical
+    seclabel u:r:watchdogd:s0
diff --git a/soc/edison/sepolicy/file_contexts b/soc/edison/sepolicy/file_contexts
new file mode 100644
index 0000000..e52a322
--- /dev/null
+++ b/soc/edison/sepolicy/file_contexts
@@ -0,0 +1,9 @@
+# Serial console
+/dev/ttyMFD2        u:object_r:console_device:s0
+
+# Bluetooth UART device port
+/dev/ttyMFD0        u:object_r:bluetoothtbd_device:s0
+
+# Bluetooth ON/OFF functions
+/sys/devices/platform/bcm_bt_lpm.0/rfkill/rfkill0/state u:object_r:sysfs_bluetoothtbd_writable:s0
+/sys/devices/platform/bcm_bt_lpm.0/rfkill/rfkill0/type u:object_r:sysfs_bluetoothtbd_readable:s0
diff --git a/soc/edison/soc.kconf b/soc/edison/soc.kconf
new file mode 100644
index 0000000..38c5075
--- /dev/null
+++ b/soc/edison/soc.kconf
@@ -0,0 +1,27 @@
+#
+# Copyright 2015 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.
+#
+
+# Disable unused test modules (no module support).
+# CONFIG_DEBUG_NX_TEST is not set
+
+# Disable unused drivers (no module support).
+# CONFIG_VIDEOBUF2_CORE is not set
+# CONFIG_USB_VIDEO_CLASS is not set
+# CONFIG_USB_GSPCA is not set
+# CONFIG_DVB_TUNER_DIB0070 is not set
+# CONFIG_DVB_TUNER_DIB0090 is not set
+# CONFIG_USB_SERIAL_CP210X is not set
+# CONFIG_IIO_SYSFS_TRIGGER is not set
diff --git a/soc/edison/soc.mk b/soc/edison/soc.mk
new file mode 100644
index 0000000..33536d9
--- /dev/null
+++ b/soc/edison/soc.mk
@@ -0,0 +1,84 @@
+#
+# Copyright 2015 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.
+#
+
+LOCAL_PATH := hardware/bsp/intel/soc/edison
+
+# x86 device.
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := silvermont
+TARGET_CPU_VARIANT :=
+TARGET_CPU_ABI :=  x86
+TARGET_CPU_ABI2 :=
+TARGET_KERNEL_ARCH := i386
+
+# Disable building kernel and bootloader until we really support them.
+TARGET_NO_BOOTLOADER := false
+TARGET_NO_KERNEL := false
+
+# FIXME: Need to dynamically grab the serial number of the device from the hardware.
+BOARD_KERNEL_CMDLINE := console=ttyMFD2 earlyprintk=ttyMFD2,keep androidboot.hardware=edison
+
+TARGET_USERIMAGES_USE_EXT4 := true
+BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_FLASH_BLOCK_SIZE := 131072
+
+PRODUCT_COPY_FILES += \
+  $(LOCAL_PATH)/init.edison.rc:root/init.edison.rc \
+  system/core/rootdir/init.usb.rc:root/init.usb.rc \
+  system/core/rootdir/ueventd.rc:root/ueventd.rc \
+  $(LOCAL_PATH)/ueventd.edison.rc:root/ueventd.edison.rc \
+
+BOARD_SEPOLICY_DIRS += \
+	$(LOCAL_PATH)/sepolicy \
+
+TARGET_KERNEL_SRC := hardware/bsp/kernel/intel/edison-3.10
+TARGET_KERNEL_DEFCONFIG := i386_brillo_edison_defconfig
+TARGET_KERNEL_CONFIGS := $(realpath $(LOCAL_PATH)/soc.kconf)
+
+# Bt product packages
+DEVICE_PACKAGES += \
+    bt_bcm
+
+DEVICE_PACKAGES += \
+    keystore.default
+
+# Audio HAL
+DEVICE_PACKAGES += \
+    audio.usb.edison
+
+# Audio HAL support
+DEVICE_PACKAGES += \
+    libstagefright_soft_mp3dec
+
+# Boot control HAL package
+DEVICE_PACKAGES += \
+    bootctrl.edison
+
+# lights HAL package
+DEVICE_PACKAGES += \
+    lights.edison
+
+# Audio utilities. You may not need these for a product
+DEVICE_PACKAGES += \
+    tinyplay tinypcminfo tinymix tinycap
+
+# Device partition table
+DEVICE_PACKAGES += \
+    gpt.bin
+
+# Sensor HAL package
+DEVICE_PACKAGES += \
+    sensors.edison
diff --git a/soc/edison/ueventd.edison.rc b/soc/edison/ueventd.edison.rc
new file mode 100644
index 0000000..042f050
--- /dev/null
+++ b/soc/edison/ueventd.edison.rc
@@ -0,0 +1,3 @@
+# Device needed by shared transport layer
+/dev/rfkill                             0660   bluetooth  bluetooth
+/dev/ttyMFD0                            0660   bluetooth  net_bt_stack