Rename and move kernel recipe

Rename linux-obmc to linux-aspeed and move to the Aspeed
layer.  Like recipes for u-boot forks, recipes for kernel
forks in support of different SOCs are typically provided
in the BSP supporting the SOC.

Moved a number of phosphor-isms out of the kernel recipe and put
those in a bbappend in aspeed-layer/bbappend.

Removed COMPATIBLE_MACHINE setting.  We simply use PREFERRED_PROVIDER
in machine configuration files to set the default kernel recipe.

Tested: Booted spoon/palmetto images using QEMU
Change-Id: I7dc73629cad4789dcd5aeb0f7b6214fe064c6adc
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/common/recipes-kernel/linux/linux-aspeed.inc b/common/recipes-kernel/linux/linux-aspeed.inc
new file mode 100644
index 0000000..5567840
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-aspeed.inc
@@ -0,0 +1,29 @@
+DESCRIPTION = "Linux kernel for Aspeed"
+SECTION = "kernel"
+LICENSE = "GPLv2"
+
+PROVIDES += "virtual/kernel"
+
+KCONFIG_MODE="--alldefconfig"
+
+KSRC ?= "git://github.com/openbmc/linux;protocol=git;branch=${KBRANCH}"
+SRC_URI = "${KSRC}"
+SRC_URI_append_ast2400 = " file://ast2400/defconfig"
+SRC_URI_append_ast2500 = " file://ast2500/defconfig"
+
+LINUX_VERSION_EXTENSION ?= "-${SRCREV}"
+
+PV = "${LINUX_VERSION}+git${SRCPV}"
+
+do_patch_append() {
+        for DTB in "${KERNEL_DEVICETREE}"; do
+               DT=`basename ${DTB} .dtb`
+                if [ -r "${WORKDIR}/${DT}.dts" ]; then
+                        cp ${WORKDIR}/${DT}.dts \
+                                ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts
+               fi
+       done
+}
+
+inherit kernel
+require recipes-kernel/linux/linux-yocto.inc
diff --git a/meta-ast2400/recipes-kernel/linux/linux-obmc/defconfig b/common/recipes-kernel/linux/linux-aspeed/ast2400/defconfig
similarity index 100%
rename from meta-ast2400/recipes-kernel/linux/linux-obmc/defconfig
rename to common/recipes-kernel/linux/linux-aspeed/ast2400/defconfig
diff --git a/meta-ast2500/recipes-kernel/linux/linux-obmc/defconfig b/common/recipes-kernel/linux/linux-aspeed/ast2500/defconfig
similarity index 100%
rename from meta-ast2500/recipes-kernel/linux/linux-obmc/defconfig
rename to common/recipes-kernel/linux/linux-aspeed/ast2500/defconfig
diff --git a/common/recipes-kernel/linux/linux-aspeed_4.13.bb b/common/recipes-kernel/linux/linux-aspeed_4.13.bb
new file mode 100644
index 0000000..42bff8f
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-aspeed_4.13.bb
@@ -0,0 +1,6 @@
+KBRANCH ?= "dev-4.13"
+LINUX_VERSION ?= "4.13.16"
+
+SRCREV="aca92be80c008bceeb6fb62fd1d450b5be5d0a4f"
+
+require linux-aspeed.inc
diff --git a/conf/machine/include/aspeed.inc b/conf/machine/include/aspeed.inc
index ff6c83e..88290ff 100644
--- a/conf/machine/include/aspeed.inc
+++ b/conf/machine/include/aspeed.inc
@@ -1,4 +1,4 @@
-PREFERRED_PROVIDER_virtual/kernel ?= "linux-obmc"
+PREFERRED_PROVIDER_virtual/kernel ?= "linux-aspeed"
 PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-aspeed"
 PREFERRED_PROVIDER_u-boot ?= "u-boot-aspeed"
 PREFERRED_PROVIDER_u-boot-fw-utils ?= "u-boot-fw-utils-aspeed"
diff --git a/meta-ast2400/conf/layer.conf b/meta-ast2400/conf/layer.conf
index 2ce719c..5757afe 100644
--- a/meta-ast2400/conf/layer.conf
+++ b/meta-ast2400/conf/layer.conf
@@ -1,10 +1,6 @@
 # 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_PATTERN_ast2400-layer = "^${LAYERDIR}/"
+BBFILE_PATTERN_ast2400-layer = ""
 BBFILE_COLLECTIONS += "ast2400-layer"
 LAYERVERSION_ast2400-layer = "1"
diff --git a/meta-ast2400/recipes-kernel/linux/linux-obmc_%.bbappend b/meta-ast2400/recipes-kernel/linux/linux-obmc_%.bbappend
deleted file mode 100644
index 7b49ba1..0000000
--- a/meta-ast2400/recipes-kernel/linux/linux-obmc_%.bbappend
+++ /dev/null
@@ -1,2 +0,0 @@
-FILESEXTRAPATHS_prepend_ast2400 := "${THISDIR}/${PN}:"
-SRC_URI_append_ast2400 = " file://defconfig"
diff --git a/meta-ast2500/conf/layer.conf b/meta-ast2500/conf/layer.conf
index 00dd677..c18b2cf 100644
--- a/meta-ast2500/conf/layer.conf
+++ b/meta-ast2500/conf/layer.conf
@@ -1,10 +1,6 @@
 # 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_PATTERN_ast2500-layer = "^${LAYERDIR}/"
+BBFILE_PATTERN_ast2500-layer = ""
 BBFILE_COLLECTIONS += "ast2500-layer"
 LAYERVERSION_ast2500-layer = "1"
diff --git a/meta-ast2500/recipes-kernel/linux/linux-obmc_%.bbappend b/meta-ast2500/recipes-kernel/linux/linux-obmc_%.bbappend
deleted file mode 100644
index ee9a010..0000000
--- a/meta-ast2500/recipes-kernel/linux/linux-obmc_%.bbappend
+++ /dev/null
@@ -1,2 +0,0 @@
-FILESEXTRAPATHS_prepend_ast2500 := "${THISDIR}/${PN}:"
-SRC_URI_append_ast2500 = " file://defconfig"