meta-inventec: add meta-starscream machine

The meta-starscream equipped with Aspeed AST2600 BMC SoC.

Tested: Build Starscream image and load on the target hardware.

Change-Id: I8c37a9f11980e3273e4c21ce80d23500c870895c
Signed-off-by: Jason Lin Ying Yen <lin.jasonyy@inventec.com>
diff --git a/meta-inventec/OWNERS b/meta-inventec/OWNERS
index beb5ab9..58c368a 100644
--- a/meta-inventec/OWNERS
+++ b/meta-inventec/OWNERS
@@ -1,2 +1,3 @@
 owners:
-- mohammedhabeebinventec
+- lin.jasonyy@inventec.com
+- ye.vic@inventec.com
diff --git a/meta-inventec/meta-starscream/conf/layer.conf b/meta-inventec/meta-starscream/conf/layer.conf
new file mode 100755
index 0000000..10dae42
--- /dev/null
+++ b/meta-inventec/meta-starscream/conf/layer.conf
@@ -0,0 +1,11 @@
+# We have a conf and classes directory, add to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+# We have recipes-* directories, add to BBFILES
+BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
+            ${LAYERDIR}/recipes-*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "starscream"
+BBFILE_PATTERN_starscream = "^${LAYERDIR}/"
+BBFILE_PRIORITY_starscream = "7"
+LAYERSERIES_COMPAT_starscream = "nanbield scarthgap"
diff --git a/meta-inventec/meta-starscream/conf/machine/platform_configs.inc b/meta-inventec/meta-starscream/conf/machine/platform_configs.inc
new file mode 100644
index 0000000..48f1065
--- /dev/null
+++ b/meta-inventec/meta-starscream/conf/machine/platform_configs.inc
@@ -0,0 +1,21 @@
+# This include file is aim to pass variables to bb/bb.apppend files,
+# such as sysguid tool, and easily maintain platform settings
+
+
+##################### Configure default EEPROM setting #####################
+### The I2C bus is "0 based, decimal"
+### The address and offset are "hexcimal"
+### e.g.
+###     EEPROM_GUID_I2C_BUS = "3"
+###     EEPROM_GUID_I2C_ADDRESS = "0x54"
+###     EEPROM_GUID_OFFSET = "0x1F00"
+
+EEPROM_GUID_I2C_BUS= "3"
+EEPROM_GUID_I2C_ADDRESS = "0x54"
+EEPROM_GUID_OFFSET = "0x1F00"
+
+EEPROM_MAC_I2C_BUS = "14"
+EEPROM_MAC_I2C_ADDRESS = "0x50"
+EEPROM_MAC_OFFSET = "0x1000"
+
+############################################################################
diff --git a/meta-inventec/meta-starscream/conf/machine/starscream.conf b/meta-inventec/meta-starscream/conf/machine/starscream.conf
new file mode 100755
index 0000000..66dbce6
--- /dev/null
+++ b/meta-inventec/meta-starscream/conf/machine/starscream.conf
@@ -0,0 +1,14 @@
+KMACHINE = "aspeed"
+KERNEL_DEVICETREE = "aspeed/${KMACHINE}-bmc-inventec-${MACHINE}.dtb"
+
+require conf/machine/include/ast2600.inc
+require conf/machine/include/obmc-bsp-common.inc
+require conf/machine/include/inventec.inc
+
+UBOOT_MACHINE = "ast2600_openbmc_spl_defconfig"
+UBOOT_DEVICETREE = "ast2600-evb"
+SPL_BINARY = "spl/u-boot-spl.bin"
+SOCSEC_SIGN_ENABLE = "0"
+
+# To build a 64MB image, set FLASH_SIZE value to "65536".
+FLASH_SIZE = "65536"
diff --git a/meta-inventec/meta-starscream/conf/templates/default/bblayers.conf.sample b/meta-inventec/meta-starscream/conf/templates/default/bblayers.conf.sample
new file mode 100755
index 0000000..95ea73c
--- /dev/null
+++ b/meta-inventec/meta-starscream/conf/templates/default/bblayers.conf.sample
@@ -0,0 +1,19 @@
+# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
+# changes incompatibly
+LCONF_VERSION = "8"
+
+BBPATH = "${TOPDIR}"
+BBFILES ?= ""
+
+BBLAYERS ?= " \
+  ##OEROOT##/meta \
+  ##OEROOT##/meta-poky \
+  ##OEROOT##/meta-openembedded/meta-oe \
+  ##OEROOT##/meta-openembedded/meta-networking \
+  ##OEROOT##/meta-openembedded/meta-perl \
+  ##OEROOT##/meta-openembedded/meta-python \
+  ##OEROOT##/meta-phosphor \
+  ##OEROOT##/meta-aspeed \
+  ##OEROOT##/meta-inventec \
+  ##OEROOT##/meta-inventec/meta-starscream \
+"
diff --git a/meta-inventec/meta-starscream/conf/templates/default/conf-notes.txt b/meta-inventec/meta-starscream/conf/templates/default/conf-notes.txt
new file mode 100755
index 0000000..43d4ab0
--- /dev/null
+++ b/meta-inventec/meta-starscream/conf/templates/default/conf-notes.txt
@@ -0,0 +1,2 @@
+Common targets are:
+    obmc-phosphor-image
diff --git a/meta-inventec/meta-starscream/conf/templates/default/local.conf.sample b/meta-inventec/meta-starscream/conf/templates/default/local.conf.sample
new file mode 100755
index 0000000..89070b0
--- /dev/null
+++ b/meta-inventec/meta-starscream/conf/templates/default/local.conf.sample
@@ -0,0 +1,19 @@
+MACHINE ?= "starscream"
+DISTRO ?= "openbmc-phosphor"
+PACKAGE_CLASSES ?= "package_ipk"
+SANITY_TESTED_DISTROS:append ?= " *"
+EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
+USER_CLASSES ?= "buildstats"
+PATCHRESOLVE = "noop"
+BB_DISKMON_DIRS ??= "\
+    STOPTASKS,${TMPDIR},1G,100K \
+    STOPTASKS,${DL_DIR},1G,100K \
+    STOPTASKS,${SSTATE_DIR},1G,100K \
+    STOPTASKS,/tmp,100M,100K \
+    HALT,${TMPDIR},100M,1K \
+    HALT,${DL_DIR},100M,1K \
+    HALT,${SSTATE_DIR},100M,1K \
+    HALT,/tmp,10M,1K"
+PACKAGECONFIG:append:pn-qemu-system-native = " sdl"
+PACKAGECONFIG:append:pn-nativesdk-qemu = " sdl"
+CONF_VERSION = "2"
diff --git a/meta-inventec/meta-starscream/recipes-kernel/linux/linux-aspeed/starscream.cfg b/meta-inventec/meta-starscream/recipes-kernel/linux/linux-aspeed/starscream.cfg
new file mode 100644
index 0000000..ba68133
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-kernel/linux/linux-aspeed/starscream.cfg
@@ -0,0 +1,46 @@
+CONFIG_SLAB=y
+CONFIG_ARCH_MULTI_V6=y
+CONFIG_SECCOMP=y
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_FIRMWARE_MEMMAP=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEBUG_FS is not set
+COFIG_NCSI_OEM_CMD_GET_MAC=y
+CONFIG_PCI=y
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_MTD_UBI_BLOCK=y
+CONFIG_NET_VENDOR_INTEL=y
+# CONFIG_SERIO is not set
+CONFIG_I2C_MUX=y
+CONFIG_GPIO_ASPEED_SGPIO=y
+CONFIG_SENSORS_PECI_CPUTEMP=y
+CONFIG_SENSORS_PECI_DIMMTEMP=y
+CONFIG_ASPEED_LPC_CTRL=y
+CONFIG_ASPEED_LPC_SNOOP=y
+CONFIG_ASPEED_P2A_CTRL=y
+CONFIG_ASPEED_UART_ROUTING=y
+CONFIG_PECI=y
+CONFIG_PECI_ASPEED=y
+CONFIG_UBIFS_FS=y
+CONFIG_DEBUG_USER=y
+#CONFIG_ASPEED_JTAG is not set
+CONFIG_THERMAL=y
+CONFIG_MDIO_ASPEED=y
+CONFIG_MMC_SDHCI_IO_ACCESSORS=y
+CONFIG_USB_U_ETHER=y
+CONFIG_USB_F_ECM=y
+CONFIG_USB_F_SUBSET=y
+CONFIG_USB_F_RNDIS=y
+CONFIG_USB_CONFIGFS_RNDIS=y
+CONFIG_USB_ETH=y
+CONFIG_USB_ETH_RNDIS=y
+CONFIG_SENSORS_SBTSI=y
+CONFIG_SENSORS_MAX31790=y
+CONFIG_SENSORS_EMC2305=y
+CONFIG_SENSORS_EMC1403=y
+CONFIG_MAX1363=y
+CONFIG_I3C=y
+CONFIG_USB_HUB_USB251XB=y
+CONFIG_SENSORS_SBRMI=y
diff --git a/meta-inventec/meta-starscream/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-inventec/meta-starscream/recipes-kernel/linux/linux-aspeed_%.bbappend
new file mode 100644
index 0000000..8627c55
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-kernel/linux/linux-aspeed_%.bbappend
@@ -0,0 +1,4 @@
+FILESEXTRAPATHS:append:starscream := "${THISDIR}/${PN}:"
+
+SRC_URI:append = " file://starscream.cfg \
+                "
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/image/obmc-phosphor-image.bbappend b/meta-inventec/meta-starscream/recipes-phosphor/image/obmc-phosphor-image.bbappend
new file mode 100644
index 0000000..5dec1a2
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/image/obmc-phosphor-image.bbappend
@@ -0,0 +1,6 @@
+inherit extrausers
+
+EXTRA_USERS_PARAMS:append = " \
+useradd -e '' -ou 0 -d /home/root -G priv-admin,root,sudo,ipmi,web,redfish -p 'gzW59equAcJAg' sysadmin; \
+useradd -e '' -ou 0 -d /home/root -G priv-admin,root,sudo,ipmi,web,redfish -p 'kFdHdjRkot8KQ' admin; \
+"
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/init/starscream-init.bb b/meta-inventec/meta-starscream/recipes-phosphor/init/starscream-init.bb
new file mode 100644
index 0000000..89bf463
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/init/starscream-init.bb
@@ -0,0 +1,25 @@
+SUMMARY = "starscream init service"
+DESCRIPTION = "Essential init commands for starscream"
+PR = "r1"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit obmc-phosphor-systemd
+
+DEPENDS += "systemd"
+RDEPENDS:${PN} += "libsystemd"
+
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/starscream-init:"
+SRC_URI += "file://starscream-init.sh \
+"
+
+S = "${WORKDIR}"
+
+do_install() {
+        install -d ${D}${sbindir}
+        install -m 0755 starscream-init.sh ${D}${sbindir}
+}
+
+SYSTEMD_SERVICE:${PN} += "starscream-init.service"
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/init/starscream-init/starscream-init.service b/meta-inventec/meta-starscream/recipes-phosphor/init/starscream-init/starscream-init.service
new file mode 100644
index 0000000..c6410ad
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/init/starscream-init/starscream-init.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Essential init commands for starscream
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/sbin/starscream-init.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/init/starscream-init/starscream-init.sh b/meta-inventec/meta-starscream/recipes-phosphor/init/starscream-init/starscream-init.sh
new file mode 100644
index 0000000..c062f19
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/init/starscream-init/starscream-init.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Set BMC ready
+gpioset "$(gpiofind BMC_READY)"=0
+echo BMC ready !!
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend b/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
new file mode 100644
index 0000000..c0acaea
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
@@ -0,0 +1 @@
+FILESEXTRAPATHS:prepend:starscream := "${THISDIR}/${PN}:"
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json b/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json
new file mode 100644
index 0000000..08a410f
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json
@@ -0,0 +1,57 @@
+{
+  "1" : {
+    "name" : "eth1",
+    "is_valid" : true,
+    "active_sessions" : 0,
+    "channel_info" : {
+      "medium_type" : "lan-802.3",
+      "protocol_type" : "ipmb-1.0",
+      "session_supported" : "multi-session",
+      "is_ipmi" : true
+    }
+  },
+  "2" : {
+    "name" : "eth0",
+    "is_valid" : true,
+    "active_sessions" : 0,
+    "channel_info" : {
+      "medium_type" : "lan-802.3",
+      "protocol_type" : "ipmb-1.0",
+      "session_supported" : "multi-session",
+      "is_ipmi" : true
+    }
+  },
+  "3" : {
+    "name" : "usb0",
+    "is_valid" : true,
+    "active_sessions" : 0,
+    "channel_info" : {
+      "medium_type" : "lan-802.3",
+      "protocol_type" : "ipmb-1.0",
+      "session_supported" : "multi-session",
+      "is_ipmi" : true
+    }
+  },
+  "8" : {
+    "name" : "INTRABMC",
+    "is_valid" : true,
+    "active_sessions" : 0,
+    "channel_info" : {
+      "medium_type" : "oem",
+      "protocol_type" : "oem",
+      "session_supported" : "session-less",
+      "is_ipmi" : true
+    }
+  },
+  "15" : {
+    "name" : "ipmi_kcs3",
+    "is_valid" : true,
+    "active_sessions" : 0,
+    "channel_info" : {
+      "medium_type" : "system-interface",
+      "protocol_type" : "kcs",
+      "session_supported" : "session-less",
+      "is_ipmi" : true
+    }
+  }
+}
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json b/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json
new file mode 100644
index 0000000..4a2602a
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json
@@ -0,0 +1,8 @@
+{
+    "id": 1,
+    "revision": 128,
+    "addn_dev_support": 207,
+    "manuf_id": 6569,
+    "prod_id": 91,
+    "aux": 0
+}
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend b/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend
new file mode 100755
index 0000000..95f7c75
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend
@@ -0,0 +1 @@
+RMCPP_IFACE = "eth1"
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/leds/starscream-led-manager-config-native.bb b/meta-inventec/meta-starscream/recipes-phosphor/leds/starscream-led-manager-config-native.bb
new file mode 100644
index 0000000..ba88a9a
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/leds/starscream-led-manager-config-native.bb
@@ -0,0 +1,20 @@
+SUMMARY = "Phosphor LED Group Management for Starscream"
+PR = "r1"
+
+#Common code for packages distributed without a license that want Apache-2.0.
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit native
+
+PROVIDES += "virtual/phosphor-led-manager-config-native"
+
+SRC_URI += "file://led.yaml"
+S = "${WORKDIR}"
+
+# Copies example led layout yaml file
+do_install() {
+    SRC=${S}
+    DEST=${D}${datadir}/phosphor-led-manager
+    install -D ${SRC}/led.yaml ${DEST}/led.yaml
+}
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/leds/starscream-led-manager-config/led.yaml b/meta-inventec/meta-starscream/recipes-phosphor/leds/starscream-led-manager-config/led.yaml
new file mode 100644
index 0000000..73bdd88
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/leds/starscream-led-manager-config/led.yaml
@@ -0,0 +1,15 @@
+bmc_booted:
+    HB_LED:
+        Action: 'Blink'
+        DutyOn: 50
+        Period: 1000
+
+enclosure_identify:
+    UID_LED:
+        Action: 'On'
+
+enclosure_identify_blink:
+    UID_LED:
+        Action: 'Blink'
+        DutyOn: 50
+        Period: 1000
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/settings/phosphor-settings-manager/chassis-capabilities.override.yml b/meta-inventec/meta-starscream/recipes-phosphor/settings/phosphor-settings-manager/chassis-capabilities.override.yml
new file mode 100644
index 0000000..59fd947
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/settings/phosphor-settings-manager/chassis-capabilities.override.yml
@@ -0,0 +1,23 @@
+/xyz/openbmc_project/control/host0/chassis_cap:
+    - Interface: xyz.openbmc_project.Control.ChassisCapabilities
+      Properties:
+          CapabilitiesFlags:
+              Default: 0
+          ChassisIntrusionEnabled:
+              Default: 'false'
+          ChassisFrontPanelLockoutEnabled:
+              Default: 'false'
+          ChassisNMIEnabled:
+              Default: 'false'
+          ChassisPowerInterlockEnabled:
+              Default: 'false'
+          FRUDeviceAddress:
+              Default: 32
+          SDRDeviceAddress:
+              Default: 32
+          SELDeviceAddress:
+              Default: 32
+          SMDeviceAddress:
+              Default: 32
+          BridgeDeviceAddress:
+              Default: 32
diff --git a/meta-inventec/meta-starscream/recipes-phosphor/settings/phosphor-settings-manager_%.bbapend b/meta-inventec/meta-starscream/recipes-phosphor/settings/phosphor-settings-manager_%.bbapend
new file mode 100644
index 0000000..449e327
--- /dev/null
+++ b/meta-inventec/meta-starscream/recipes-phosphor/settings/phosphor-settings-manager_%.bbapend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS:append:starscream := ":${THISDIR}/${PN}"
+SRC_URI:append:starscream = " file://chassis-capabilities.override.yml \
+                            "