SUMMARY = "Microchip WILC devices firmware files for use with Linux kernel"
SECTION = "kernel"
LICENSE = "MICROCHIP_FW"

LIC_FILES_CHKSUM = "file://LICENCE.wilc_fw;beginline=6;md5=e1a0446d046c966a27276cf8e728f687"

SRCREV = "wilc_linux_15_2"
SRC_URI = "git://github.com/linux4wilc/firmware.git;protocol=https"
S = "${WORKDIR}/git"

inherit allarch

do_install() {
	install -d ${D}/lib/firmware/mchp/
	cp -r ${S}/* ${D}/lib/firmware/mchp/

	# remove unneeded file
	rm -f ${D}/lib/firmware/mchp/README.md
	rm -rf ${D}/lib/firmware/mchp/LICENCE.wilc_fw
	chmod -x ${D}/lib/firmware/mchp/*
}


FILES_${PN} += " \
	${base_libdir}/firmware/mchp/wilc*.bin \
	"

# TODO: use ALTERNATIVE like in "linux-firmware" package

SUMMARY = "Microchip WILC devices firmware files for use with Linux kernel"
SECTION = "kernel"
LICENSE = "MICROCHIP_FW"

LIC_FILES_CHKSUM = "file://LICENCE.wilc_fw;beginline=6;md5=e1a0446d046c966a27276cf8e728f687"

SRCREV = "wilc_linux_15_2"
SRC_URI = "git://github.com/linux4wilc/firmware.git;protocol=https"
S = "${WORKDIR}/git"

inherit allarch

do_install() {
	install -d ${D}${nonarch_base_libdir}/firmware/mchp/
	cp -r ${S}/* ${D}${nonarch_base_libdir}/firmware/mchp/

	# remove unneeded file
	rm -f ${D}${nonarch_base_libdir}/firmware/mchp/README.md
	rm -rf ${D}${nonarch_base_libdir}/firmware/mchp/LICENCE.wilc_fw
	chmod -x ${D}${nonarch_base_libdir}/firmware/mchp/*
}


FILES_${PN} += " \
	${nonarch_base_libdir}/firmware/mchp/wilc*.bin \
	"

# TODO: use ALTERNATIVE like in "linux-firmware" package

Use nonarch_base_libdir instead of hardcoding firmware path prefix
mchp-wireless-firmware: Use nonarch_base_libdir instead of hardcoding firmware path prefix

This helps the build with multilib
Fixes
ERROR: mchp-wireless-firmware-15.2-r0 do_package: QA Issue: mchp-wireless-firmware: Files/directories were installed but not shipped in any package:
  /lib
  /lib/firmware
  /lib/firmware/mchp
  /lib/firmware/mchp/wilc3000_ble_firmware.bin
  /lib/firmware/mchp/wilc3000_wifi_firmware.bin
  /lib/firmware/mchp/wilc1000_wifi_firmware.bin
  /lib/firmware/mchp/wilc3000_ble_firmware_no_rtc.bin

Signed-off-by: Khem Raj <729d64b6f67515e258459a5f6d20ec88b2caf8df@gmail.com>
