SUMMARY = "Mellanox BlueField Gigabit Ethernet kernel module"
LICENSE = "GPLv2 | BSD-3-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=f9a07a5c4b237896cbcb302428226784"

inherit module

do_cve_check[depends] += "${PN}:do_prepare_recipe_sysroot"

SRC_URI = "file://Makefile \
           file://mlxbf_gige_debug.c \
           file://mlxbf_gige_ethtool.c \
           file://mlxbf_gige_intr.c \
           file://mlxbf_gige_main.c \
           file://mlxbf_gige_mdio.c \
           file://mlxbf_gige_rx.c \
           file://mlxbf_gige_tx.c \
           file://mlxbf_gige.h \
           file://mlxbf_gige_regs.h \
           file://COPYING \
           file://92-oob_net.rules \
          "

OOT_KERNEL_MODULES = "mlxbf-gige"

export INSTALL_MOD_DIR="updates"

# All of the kernel modules listed in OOT_KERNEL_MODULES will be
# contained in packages prefixed with oot- (Out Of Tree).
KERNEL_MODULE_PACKAGE_PREFIX = "oot-"

python do_unpack_append() {
    import shutil
    info = {}

    info['workdir'] = d.getVar('WORKDIR')
    info['s'] = d.getVar('S')
    info['sources'] = d.getVar('SRC_URI').replace("file://", " ")

    for files in info['sources'].split():
      filename = info['workdir'] + '/' + files
      shutil.copy(filename, info['s'])
}

PROVIDES_${PN} =+ " mlxbf-gige"

FILES_${PN} =+ "etc/udev/rules.d/92-oob_net.rules"

do_install_append () {
	install -d ${D}/etc/udev/rules.d
	install -m 0644 ${S}/92-oob_net.rules ${D}/etc/udev/rules.d/
}
