inherit kernel
require recipes-kernel/linux/linux-yocto.inc

LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"

#FILESEXTRAPATHS_prepend := "${THISDIR}/files/xuantie-c910:"

#SRC_URI = " \
#    http://gitlab.alibaba-inc.com:thead-linux/d1_linux-kernel.git;branch=master \
#    "
#SRC_URI[sha256sum] = "acea641977739e9060800e56a32d137794ea7ed011f24353ba40448e2a6ba36a"

SRC_URI = " \
    git://git@gitlab.alibaba-inc.com/thead-linux/d1_linux-kernel.git;branch=d1-miniapp;protocol=ssh"

LINUX_VERSION ?= "${PV}"
LINUX_VERSION_EXTENSION ?= "-thead"

SRCREV="${AUTOREV}"

DEPENDS += "elfutils-native"

COMPATIBLE_MACHINE = "d1"

S = "${WORKDIR}/linux-${PV}"

# KBUILD_DEFCONFIG_qemu64-c910 = "qemux-c910_defconfig"
KBUILD_DEFCONFIG_d1 = "d1_defconfig"
# KBUILD_DEFCONFIG_ice-c910 = "ice-c910_defconfig"

do_configure_append() {
  [ -d ${STAGING_KERNEL_DIR} ] && rm -rf ${STAGING_KERNEL_DIR}
  [ -f ${STAGING_KERNEL_DIR} ] && rm -rf ${STAGING_KERNEL_DIR}

  ln -s ${S}  ${STAGING_KERNEL_DIR}
}
do_install_append() {

   [ -f ${STAGING_KERNEL_BUILDDIR} ] && rm -rf ${STAGING_KERNEL_BUILDDIR}
   [ -d ${STAGING_KERNEL_BUILDDIR} ] && rm -rf ${STAGING_KERNEL_BUILDDIR}

   ln -s ${B}  ${STAGING_KERNEL_BUILDDIR}
}

KCONFIG_MODE="--alldefconfig"
