Yocto : How to make opkg aware of deletion of a file during pkg_postinst_ontarget_${PN}()

148 views Asked by At

I have the following procedure to install a firmware on the target filesystem so this firmware can be flashed onto an external MCU :

SRC_URI = " \
    file://${FIRMWARE_NAME} \
"

FILES_${PN} += " \
    /home/root/${FIRMWARE_NAME} \
"

do_install() {
    install -d ${D}${FIRMWARE_INSTALL_DIR}
    install -m 0644 ${WORKDIR}/${FIRMWARE_NAME} ${D}/${FIRMWARE_INSTALL_DIR}/${FIRMWARE_NAME}
}

Once flashed onto the MCU, the firmware.bin is useless and deleted by pkg_postinst_ontarget() :

pkg_postinst_ontarget_${PN}() {
    < Flashing procedure of MCU with firmware.bin >
    rm -f ${FIRMWARE_INSTALL_DIR}/${FIRMWARE_NAME}
    echo "Deleted ${FIRMWARE_NAME} from filesystem."
}

If I upgrade my package, opkg warns me about this :

Collected errors:
 * remove_obsolesced_files: unlinking /home/root/firmware_old_version.bin failed: No such file or directory.
 * opkg_install_pkg: Failed to determine obsolete files from previously installed firmware-zephyr

How to modify my recipe so opkg would be aware that pkg_postinst_ontarget_${PN}() has deleted the file?

I've tried to search for documentation but no success.

0

There are 0 answers