require conf/machine/include/csky/tune-csky.inc

EXTERNAL_TOOLCHAIN ?= "${HOME}/.thead/csky-linux"
TCMODE="external"
TARGET_PREFIX="csky-linux-gnuabiv2-"
TARGET_ARCH="csky"
TARGET_OS="linux"
QEMU_TOOLCHAIN_PATH="${HOME}/.thead/host/csky-qemu/bin/"
EXTERNAL_TOOLCHAIN_SYSROOT="${EXTERNAL_TOOLCHAIN}/csky-buildroot-linux-gnuabiv2/sysroot"
SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"

#INSANE_SKIP_${PN} += "glibc-so gobject-introspection-so"
INSANE_SKIP_${PN} += "glibc-so gobject-introspection-so glibc-external"

PREFERRED_PROVIDER_virtual/kernel ?= "linux-thead"
PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
PREFERRED_VERSION_openocd-native = "csky"
PREFERRED_VERSION_openocd = "csky"

# KERNEL_CLASSES  = "kernel-uimage"
# KERNEL_IMAGETYPES = "itbImage"

KERNEL_IMAGETYPE = "Image"
KERNEL_IMAGETYPES += "uImage"
KEEPUIMAGE = "no"

# MACHINE_FEATURES = "usbgadget usbhost vfat alsa touchscreen"
MACHINE_FEATURES = "screen keyboard ext2 ext3 serial"

## This sets u-boot as the default OpenSBI payload
CSKY_SBI_PAYLOAD ?= "u-boot.bin"

#EXTRA_IMAGEDEPENDS += "opensbi"
CSKY_SBI_PLAT = "thead/c860"

EXTRA_IMAGEDEPENDS += "u-boot"
UBOOT_MACHINE = "qemu-csky_defconfig"

## Do not update fstab file when using wic images
WIC_CREATE_EXTRA_ARGS ?= "--no-fstab-update"

## wic default support
WKS_FILE_DEPENDS ?= " \
    opensbi \
    e2fsprogs-native \
    bmap-tools-native \
"

IMAGE_BOOT_FILES ?= " \
    fw_payload.bin \
    fitImage \
    boot.scr.uimg \
"

WKS_FILE ?= "xuantie-opensbi.wks"

BAD_RECOMMENDATIONS += "\
    libcxx-dev \
    libcxx-staticdev \
    compiler-rt-dev \
    compiler-rt-staticdev \
"
ASSUME_PROVIDED += "\
    libcxx-dev \
    libcxx-staticdev \
    compiler-rt-dev \
    compiler-rt-staticdev \
"
